Large Language Models (LLMs) are AI models trained on massive amounts of text data to understand, generate, and manipulate human language. They predict the next word in a sequence based on the context of previous words.
💡 Simple Analogy
Think of an LLM as an extremely advanced autocomplete. When you type "The capital of France is..." an LLM predicts "Paris" based on patterns it learned from millions of texts.
Popular examples:
GPT-4 (OpenAI) – powers ChatGPT
Claude 3 (Anthropic) – known for reasoning and safety
LLMs are built on a neural network architecture called the Transformer (introduced by Google in 2017). Key innovation: self-attention – the model learns which words in a sentence are most relevant to each other.
🧠 Simplified Mental Model
Input: "The cat sat on the ___"
Step 1: Break into tokens (words/subwords)
Step 2: Apply attention (which words matter?)
Step 3: Predict probability distribution over all possible next tokens
Step 4: Select the most likely completion → "mat"
Term
Meaning
Token
A piece of text (word, part of word, or character). GPT-4 uses ~2-3 tokens per word on average.
Context Window
How many tokens the model can "see" at once. GPT-4 Turbo: 128k tokens (~300 pages of text).
Parameters
Trainable weights in the neural network. GPT-3: 175 billion.
Temperature
Controls randomness. Low (0.1) = deterministic/predictable. High (0.9) = creative/unpredictable.
📚 Training vs. Inference
📌 Two Main Phases
Training: The model learns patterns from massive datasets (internet text, books, code). Expensive and requires supercomputers. Happens once (or periodically).
Inference: Running the trained model to generate responses. What happens when you type a prompt into ChatGPT. Relatively cheap and fast.
🔄 Training Pipeline Summary
1. Pre-training: Learn from huge internet corpus (unsupervised)
↓
2. Fine-tuning: Train on human-created examples (supervised)
↓
3. RLHF: Reinforcement Learning from Human Feedback (align with preferences)
⚠️ Limitations of LLMs
⚠️ Important Limitations to Understand
Hallucinations: LLMs can confidently produce false information. They don't "know" truth – they predict plausible text.
No memory by default: Each conversation is stateless unless you send the conversation history.
Biases: LLMs reflect biases in their training data (stereotypes, cultural biases).
Knowledge cutoff: Models only know what existed before their training cutoff date (e.g., GPT-4 → April 2023).
No reasoning: LLMs perform pattern matching, not logical reasoning. They can appear to reason but often fail on true reasoning tasks.
📊 Popular LLMs Comparison
Model
Company
Context Window
Multimodal
Open Source
GPT-4 Turbo
OpenAI
128k tokens
Yes (vision)
No
Claude 3 Opus
Anthropic
200k tokens
Yes (vision)
No
Gemini 1.5 Pro
Google
1M tokens
Yes (native)
Limited
Llama 3 70B
Meta
8k tokens
No
Yes
Mixtral 8x7B
Mistral
32k tokens
No
Yes
✍️ Exercises
Exercise 1.01.1 – Check your understanding
Answer the following questions in your own words:
What does LLM stand for and what do these models do?
Explain the difference between training and inference.
What is a "hallucination" in the context of LLMs?
What is the purpose of the "temperature" parameter?
Sample Answers:
1. Large Language Model – AI models trained on massive text data to understand and generate human language.
2. Training = learning patterns from data (expensive, one-time). Inference = using the trained model to generate responses (cheap, repeated).
3. When the model confidently produces false or nonsensical information that isn't based on training data.
4. Temperature controls randomness: low = deterministic/predictable, high = creative/unpredictable.
Exercise 1.01.2 – Hands-on exploration
Choose an LLM (ChatGPT, Claude, or Gemini) and ask it:
"What are your limitations?"
"What is your knowledge cutoff date?"
"Write a haiku about how you work."
Prompting Tips:
For best results, be specific: "Explain your knowledge cutoff date and what that means for users."
Most LLMs will honestly describe their limitations when asked directly.
Exercise 1.01.3 – Research task
Research and write a one-paragraph explanation of the "Transformer architecture" and why it was revolutionary.
Key Points to Include:
- Introduced in 2017 by Google in "Attention Is All You Need"
- Replaced RNNs (recurrent neural networks)
- Key innovation: self-attention mechanism that processes all words in parallel
- Enabled training on much larger datasets (hence "Large" language models)
- Foundation for GPT, BERT, and all modern LLMs
📌 Key Takeaways
LLMs are next-word predictors trained on massive text datasets