How AI Writes: Inside Language Models
You can explain how large language models generate text one token at a time, why the same prompt can produce different outputs, and where those words actually come from.
A complete interactive classroom, not just a preview.
Start when you are ready to enter this Stage's 10 scenes and explore, respond, and learn as you go.
When an AI writes a sentence, what's actually happening inside the box?
- what-is-an-llm
- A language model is a pattern-matching system that learned from massive text and generates words based on probabilities.
- tokens
- Text is broken into chunks called tokens before a model processes it; tokens are not always whole words.
- next-token-prediction
- The model writes by repeatedly predicting the most likely next token given everything before it.
- temperature
- A 'temperature' setting controls how predictable or creative the next-token choices are.
- training-data
- All of a model's knowledge and style comes from patterns absorbed during training on huge text corpora.
- hallucination
- Models can confidently produce statements that are factually wrong because they predict plausible patterns, not verified facts.
AI 'thinks' and 'understands' language the way humans do.
Show that a model is a statistical pattern-matcher predicting the next likely token, not a thinker with understanding.
AI looks up answers from a database of facts.
Show that the model generates text token-by-token from learned patterns, not by retrieving stored answers.
AI always gives true and reliable information.
Demonstrate how confident-sounding outputs can be factually wrong because the model optimizes for plausibility, not truth.
- neural network math (transformer internals, attention equations)
- training procedures like RLHF in depth
- model architecture diagrams of neurons/layers
- comparing specific commercial models
- Learner describes in their own words how a model picks the next word.
- Learner predicts how changing temperature will change output style.
- Learner identifies when an AI output is likely to be a hallucination.
- Apply this mental model to judge the reliability of any AI-generated text they encounter in daily life.
Curious beginners with no programming or AI background. Comfortable with everyday technology but new to how AI language models work.
- 01What Is AI Writing, Really?slideOrientation
Set up the central mystery: when AI writes, what's happening inside? Introduce the learning journey.
- AI writing feels magical
- It's actually a predictable process
- We'll peek under the hood
- 02Tokenize a SentenceinteractiveModel buildingObserve
Learner feeds phrases into a tokenization simulator and watches text get sliced into tokens — seeing that tokens aren't always whole words.
- Text breaks into tokens
- Tokens can be word pieces
- Same sentence → different token splits
- 03Tokens: The AI's AlphabetslideModel buildingExplain
Connect the simulation to the bigger idea: tokens are the model's basic unit, and they shape everything the model does next.
- Tokens, not characters or words
- Why splitting matters
- Foundation for prediction
- 04Predict the Next TokeninteractivePredictionPredict
Learner sees a partial sentence and must guess which token the model thinks comes next; the simulation reveals the model's probability distribution.
- Model scores many options
- Top tokens rise to the top
- Probability ≠ certainty
- 05One Token at a TimeslideModel buildingExplain
Reveal the core loop: the model writes by repeatedly picking a token, appending it, and predicting again — explaining why output builds word-by-word.
- Generate → append → repeat
- Each step depends on the last
- This is how full essays appear
- 06Temperature Dial: Predictable vs CreativeinteractiveMisconception repairChoose
Learner turns a temperature slider and watches the same prompt produce outputs ranging from robotic-and-safe to wild-and-varied.
- Low temp = safe, repetitive
- High temp = varied, surprising
- The model never changes — only the dial
- 07Where's It Coming From? Training Data ExplorerinteractiveModel buildingObserve
A diagram showing the flow from massive training corpora → learned patterns → the model's output, helping learners see output originates from training data, not live lookup.
- Trained on huge text
- Outputs reflect patterns learned
- No live internet lookup
- 08Spot the HallucinationinteractivePracticeChoose
Learner reads short AI outputs and pinpoints the confident-sounding but factually wrong claim, building intuition for when AI makes things up.
- Confident ≠ correct
- Plausible patterns can be false
- Always verify surprising claims
- 09Why AI Gets Things WrongslideSynthesisExplain
Tie hallucination back to the core loop: the model picks plausible tokens, not true ones — so confident outputs can be fabricated.
- Optimizes for plausibility
- No truth-checker inside
- Pattern ≠ fact
- 10Your Mental Model for AI WritingslideSynthesisExplain
Pull the whole picture together: tokens → next-token prediction → temperature → training data → possible hallucination. Leave the learner with a portable mental model.
- Tokens → predict → repeat
- Temperature tunes risk
- Verify when stakes are high
Discussion threads for a Stage aren't available yet.