AI & Machine LearningIntermediate

LLM

Large Language Model - Large-scale language models that can understand and generate human-like text, such as those powering GPT, Claude, and Gemini.

Pronunciation

/ɛl ɛl ɛm/
"ell-ell-emm"
Listen on:Forvo

What it is

LLM (Large Language Model) is a type of artificial intelligence model trained on massive amounts of text to:

  1. Understand natural language - Comprehend questions, instructions, and context
  2. Generate coherent text - Responses, code, documentation
  3. Reason - Follow logic, solve problems step by step
  4. Translate and summarize - Between languages and formats

LLMs are the “brain” behind ChatGPT, Claude, Gemini, and Copilot.

What else it is called

  • “Large Language Model” in full
  • “Modelo de lenguaje grande” (in Spanish)
  • “Foundation model” (broader term)

How it works

┌─────────────────────────────────────────────────────────────┐
│                    LLM ARCHITECTURE                          │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   TRAINING (once, plus later fine-tuning)                   │
│   ┌──────────────────────────────────────────────────────┐  │
│   │  Internet, books, code, conversations                │  │
│   │  → Trillions of text tokens                          │  │
│   │  → Weeks/months on thousands of GPUs                 │  │
│   └──────────────────────────────────────────────────────┘  │
│                           │                                  │
│                           ▼                                  │
│   TRAINED MODEL                                             │
│   ┌──────────────────────────────────────────────────────┐  │
│   │  Parameters: from billions to hundreds of billions   │  │
│   │  (or more)                                           │  │
│   │  Knowledge "frozen" in weights                       │  │
│   └──────────────────────────────────────────────────────┘  │
│                           │                                  │
│                           ▼                                  │
│   INFERENCE (each use)                                      │
│   ┌──────────────────────────────────────────────────────┐  │
│   │  User: "Explain what Kubernetes is"                  │  │
│   │  LLM: Predicts next token → next → ...               │  │
│   │  Response: "Kubernetes is a platform..."             │  │
│   └──────────────────────────────────────────────────────┘  │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Major LLM families

Family Company Weights Strength
GPT OpenAI Closed (API) General reasoning
Claude Anthropic Closed (API) Code, safety
Gemini Google Closed (API) Multimodal, search
Llama Meta Open (up to 405B in Llama 3.1) Self-hosting
Mistral Mistral AI Open and closed Efficiency, European company

Versions change every few months and most closed-model vendors don’t disclose parameter counts. Check each vendor’s documentation for the current model.

LLM vs SLM

Aspect LLM (Large) SLM (Small)
Parameters Tens or hundreds of billions From hundreds of millions up to ~10-15B
Hardware Powerful GPUs, cloud Laptop, phone, modest GPU
Cost Higher (pay per token via API) Lower, or just hardware when local
Capability Complex, varied tasks Specific tasks
Examples GPT, Claude, Gemini Phi-3, Llama 3.2 1B/3B

Practical Example: LLM in Development

Before (without LLM)

Developer: Search Stack Overflow
           Read documentation
           Copy/adapt code
           Debug manually

Now (with LLM)

Developer: "Implement JWT authentication in Express"

LLM: Generates a draft of code + tests + documentation
     Explains each part
     Suggests security improvements

Developer: Reviews, tests, and adjusts before merging

Time savings vary widely depending on the task and the team’s experience; human review remains essential.

Limitations

What LLMs can NOT do well

Limitation Description
Hallucinations Make up information that sounds real
Limited knowledge Training cutoff date
Complex math Errors in long calculations (without tools)
Private data Cannot access your database on their own
Real-time Don’t know the current date or events without tools

Mitigations

┌────────────────────────────────────────┐
│   HOW TO IMPROVE LLMs                   │
├────────────────────────────────────────┤
│                                         │
│   + RAG (Retrieval)                    │
│     → Access to current documents      │
│                                         │
│   + Tools/Function Calling             │
│     → Execute code, APIs               │
│                                         │
│   + Fine-tuning                        │
│     → Specialize in your domain        │
│                                         │
│   + Agents                             │
│     → Plan and execute tasks           │
│                                         │
└────────────────────────────────────────┘
  • Agentic AI - LLMs that can act autonomously
  • SLM - Small models for local devices
  • MCP - Protocol to connect LLMs to tools
  • Prompt Injection - Security attacks against LLMs

Remember: LLMs are powerful tools but not perfect. Always verify critical information and use your professional judgment.