Reading time: ~9 min Prerequisites: Session 4 Keywords: how ChatGPT works, large language models explained, LLMs for beginners, tokens and context window, next-word prediction

Session 5: Large Language Models — How ChatGPT Actually Works

It's the world's most sophisticated game of "guess the next word" — and it's simpler and stranger than you think.

What Is a Large Language Model (LLM)?

Analogy: Think of an LLM as the world's best autocomplete. Your phone's autocomplete predicts the next word from a few words of context. An LLM does the same thing — but considers thousands of words of context, learned from trillions of words of training data.

How Next-Word Prediction Creates Intelligence

Key LLM Vocabulary

Term What It Means
Token A chunk of text (~3/4 of a word). "ChatGPT is amazing" ≈ 4 tokens
Context window How much text the model can "see" at once (input + output). GPT-4o: ~128K tokens. Claude: ~200K tokens. Think of it as the model's short-term memory for this conversation.
Parameters Internal settings learned during training. More parameters = more knowledge capacity
Training data Massive text corpus (books, websites, code, conversations)
Inference When the model generates a response — the "thinking" phase
Temperature Controls randomness. Low = predictable. High = creative
Fine-tuning Additional training on a specific dataset to specialize the model

What LLMs Can and Can't Do

Can Do Well

Can't Do

Why Different LLMs Exist

Real-Life Examples

🎯 Try It Yourself

Activity: Explore How Context and Wording Change LLM Output

  1. Open ChatGPT or Claude
  2. Send: "Explain quantum computing."
  3. Note the response style and length
  4. Send: "Explain quantum computing to a skeptical 8-year-old using only food analogies. Keep it under 100 words."
  5. Compare: same topic, wildly different output — because you changed the context and constraints
  6. Try: "You are a stand-up comedian. Explain quantum computing as part of your comedy set."
  7. Notice how a role instruction changes the tone entirely

What you learned: The way you ask dramatically shapes the response. This is the foundation of prompt engineering (covered in Session 6).

💡 Why This Matters

📋 Quick Recap

🎭 Fun Analogy

An LLM is like a world-class improv actor who's memorized every script ever written. Give them a scene setup (your prompt), and they'll improvise something that sounds brilliant and perfectly in character. But they're not actually thinking about the scene — they're drawing on patterns from every performance they've ever absorbed. And occasionally, they'll throw in a completely fabricated "fact" with total confidence, because in improv, the show must go on.