CT-GENAI-900  /  Chapter 3 — How Models Learn — and Why They Lie
Generative AI
CHAPTER 3 · ~24 MIN · CINEMATIC

How Models Learn —
and Why They Lie.

Pretraining, fine-tuning and RLHF; the sampling dials you actually turn; and the real mechanism behind hallucination.

3stagespretrain · finetune · RLHF
Ttemperaturethe creativity dial
0lookupwhy it invents citations
24minthe mechanism, not the excuse
ENkaraoke subs
CT-GENAI-900 · Generative AI: From Tokens to Agents
▶ VIDEO · CHAPTER 3 · ~24 MIN · CINEMATIC

Three stages of learning — and the honest truth about hallucination

The player screen is a live animation stage with real diagrams — three stages of learning run end to end, a real temperature dial reshapes a live probability distribution on camera, and the true mechanism behind hallucination is built up piece by piece rather than hand-waved away. Karaoke subtitles in English, fullscreen.

That was the first 10 minutes.

The rest of this chapter — and chapters 2 to 5 — come with lifetime access.

$11.99one payment · lifetime access
Get the full course Already bought it? Sign in
Chapter 3 · How Models Learn · Generative AI: From Tokens to Agents
How Models Learn: pretraining, tuning, and the truth about lies
0:00 / 0:00
REFERENCE · THE MESSAGE CATALOGUE
The concept catalogue →
Every idea the chapter builds — what it is, what it does, and where it lands in the story.
REFERENCE · THE CHAPTER 3 CONCEPT CATALOGUE

Every idea in the chapter

Each concept the video builds — what it is, what it does, and where it lands in the story. Click any row to open its full breakdown. Filter to find any of them.

IdeaCategoryWhat it doesIn one lineLesson
Chapter 3 · How Models Learn — and Why They Lie
REFERENCE · NOISE → KNOWLEDGE → JUDGMENT → VOICE

How a model is taught, and why it lies

Everything Chapter 3 builds, as a reference you can scan: the three stages that turn random noise into an assistant, the dials that give it a voice, and the honest mechanics of hallucination.

The three stages — knowledge, skill, judgment
StageDataWhat it teachesDoctor analogy
Pretrainingtrillions of tokens · the whole internetraw knowledge — facts, grammar, logic, style, a little reasoningschool
Fine-tuningtens of thousands of clean, expert-written conversationshow to be helpful — answer what was asked, follow instructionsmedical school
RLHFthousands of human rankingsalignment — helpful, honest, harmless, by learned preferenceresidency

The costs are wildly lopsided. Pretraining runs for months and costs millions. The later stages finish in hours. Almost all raw intelligence is built in that first brutal run — the rest is shaping knowledge that is already there.

Base model vs instruct model
Base modelThe raw result of pretraining. Powerful, but wild and hard to talk to. Ask a question and it may just continue with more questions — that is what it saw online. Knowledge, no manners.
Instruct / chat modelThe same base, after fine-tuning and feedback. Tamed, aligned, ready to help. Same brain — very different manners.
The alignment taxEvery time we align a model to make it safer and more obedient, a little raw creativity can be sanded away. The art is gaining the helpfulness while paying as little of that tax as possible.
The sampling dials — the model's voice
DialWhat it doesUse it when
greedy (T=0)always the single most likely token; deterministicyou need the exact same answer every time
temperaturedivides the raw scores before probabilities — small divisor → top token dominates; large → many become equal0.7 is the everyday sweet spot
low Tpredictable, safe, repetitivefacts · code · reliability
high T (~1.5)creative, surprising, sometimes nonsensebrainstorming · poetry
top-kkeep only the k most likely tokens — a fixed numbera blunt guard against the absurd
top-p (nucleus)keep just enough tokens to reach e.g. 90% — few if confident, many if unsurethe default in most systems
repetition penaltydiscourages saying the same thing twicelong generations that loop
seedfixes the randomness — same prompt, identical answertesting
beam searchkeeps several sentences alive in parallel, picks the best overalltranslation · stiff for open chat

Why the same prompt gives different answers: unless temperature is zero, there is a roll of the dice every single token. The model is not malfunctioning — it is sampling.

Hallucination — the honest mechanics
The objective“Predict the next token. Be plausible.” Read it again and notice what is missing: truth, verification, honesty. None appear anywhere. The model was never rewarded for being correct — only for being convincing.
Not a databaseIt does not look things up. Asked for a citation it does not retrieve one — it generates text with the shape of a citation. Right rhythm, right format, plausible names, believable year. The form is perfect; the substance may be fiction.
Same sourceA model that can creatively combine ideas into a poem can, by the very same machinery, combine them into a case that never existed. Creativity and hallucination come from one place — which is why it cannot simply be patched out.
The defences
ToolWhat it does
Retrieval (RAG)fetch the real documents and put them in the prompt — it reads a source instead of inventing one
Citationsmake it show its work; a claim it cannot ground is a red flag
Verificationa human or second system checks before anything is trusted — especially law, medicine, finance
lower temperatureless likely to wander into fiction
permit doubttell it in the system prompt that “I am not sure” is allowed
give it toolsa calculator, a search engine — let it look things up instead of guessing
the wobble testask a few times with randomness: solid facts stay stable, invented details drift
Every idea in this chapter — searchable

Filter by idea, category or lesson.

Chapter 3 · the one sentence: pretraining pours in knowledge by guessing the next token, fine-tuning and RLHF shape it into an assistant, sampling gives it a voice — and because truth was never in the objective, it will sometimes be confidently, fluently wrong.
QUIZ · 10 QUESTIONS

Training & hallucination check

Questions and answers reshuffle every load. 70%+ and Chapter 3 is yours.