How Does ChatGPT Actually Work?
ChatGPT is a large neural network that predicts the next word in a sequence, trained first on huge amounts of text and then refined with human feedback, so its replies are shaped predictions rather than looked-up facts.
A complete interactive classroom, not just a preview.
Start when you are ready to enter this Stage's 9 scenes and explore, respond, and learn as you go.
How does ChatGPT turn a prompt into a fluent reply?
Every day, millions of people type a question and get a fluent, thoughtful reply in seconds. But what is happening inside the box when you hit Enter?
ChatGPT feels like it understands you, yet it is made of nothing but math and patterns. How can 'just predicting the next word' produce something that looks like reasoning?
Compare a tiny simulated language model on a slide next to a real ChatGPT response, then let the learner adjust a temperature slider to see how randomness changes the output.
The model is a next-token predictor trained on text, guided by human feedback. That simple objective, scaled up, is what produces the surprisingly capable assistant in your browser.
Many people assume ChatGPT searches a database or 'knows' facts the way a person does, and that its answers come from stored knowledge being retrieved.
- The full mathematical internals of transformer attention
- Specific commercial product details such as GPT-4 architecture size
- Step-by-step code implementation
- Comparisons with other model families like recurrent or convolutional networks
- 01The Mystery in the Chat WindowslideQuestion
Frame the driving question by showing a familiar chat exchange and asking what could possibly be producing the reply.
- ChatGPT writes fluent, context-aware replies
- It is not searching the web or looking up a database
- Something inside the model is generating each word
- 02What Do You Think ChatGPT Is Doing?quizPrediction
Let the learner commit to one intuition before the mechanics are revealed.
- Choose the model that best matches your current intuition
- Your guess will be revisited after the explanation
- 03Try a Tiny Next-Word PredictorinteractiveEvidence
A simple simulation that, given a few prompt words, shows the probability distribution over possible next words so the learner can see prediction in action.
- The model assigns a probability to many possible next words
- One token is sampled from that distribution
- The chosen token is appended and the process repeats
- 04Tokens, Not WordsslideEvidence
Show how text is broken into tokens, the actual units a language model reads and writes, with a visual of a sentence split into colored token blocks.
- Models do not see letters or words directly
- A tokenizer breaks text into common subword pieces
- Each token is converted into a vector of numbers
- 05Attention and the TransformerinteractiveExplanation
An interactive diagram where the learner highlights which earlier tokens a given token attends to, revealing how context flows through the model.
- Attention lets each token weigh the relevance of every other token
- Multiple attention heads run in parallel
- This is the core mechanism behind long-range coherence
- 06Two Stages of TrainingslideExplanation
Walk through pretraining on broad text and then reinforcement learning from human feedback, explaining why two stages are needed.
- Pretraining teaches general language patterns at huge scale
- Human feedback teaches helpfulness, safety, and style
- The same next-token objective drives both stages
- 07Change the TemperatureinteractiveTransfer
Let the learner adjust a temperature slider on the same prompt and compare the sampled outputs, testing the idea that randomness shapes style but not knowledge.
- Low temperature yields predictable, repetitive text
- High temperature yields varied but riskier text
- The underlying knowledge distribution is the same
- 08What ChatGPT Is NotslideBoundary
Address common misconceptions: ChatGPT does not store facts as a database, does not think in human sense, and can confidently produce wrong information.
- It has no live search by default
- It has no internal truth-checker
- Confidence in tone does not equal correctness
- 09So How Does ChatGPT Work?slideResolution
Tie everything back to the driving question with a single, clear answer and revisit the learner's earlier intuition.
- It tokenizes your prompt and predicts the next token, repeatedly
- Training on text plus human feedback shapes those predictions
- Scaled up, this simple objective produces helpful, conversational replies
Discussion threads for a Stage aren't available yet.