AI for Beginners · Lesson 13

Alignment

Next-token prediction alone doesn't explain why a model answers you helpfully instead of just continuing your sentence, or why it knows when to say no. This lesson names the second training pass behind that — RLHF, and the broader goal it serves.

CourseAI for Beginners
Lesson13 of 14
Builds onRAG
A question this course has been quietly dodging

Why doesn't it just continue your sentence?

Go back to Lesson 3's "Cat eats ___." Left purely to next-token prediction, a model just continues whatever pattern is in front of it. So why, when you type "How do I bake bread?", doesn't it just continue with more questions in the same style — "How do I bake a cake? How do I roast a chicken?" — the way a raw pattern-continuer plausibly might?

Real assistants reliably answer you instead. They also, just as reliably, decline to help with clearly harmful requests. Neither behavior is guaranteed by next-token prediction alone — training on the open internet teaches a model to continue any pattern that shows up there, harmful ones included. Something else is happening, on top of everything Lesson 2 already told you.

One more coat of paint

Training actually happens twice

What Lesson 2 called training is really only the first pass — reading a vast scrape of the internet, painting the floor to continue whatever pattern it's shown. That pass is usually called pretraining, and it's where almost all the reading happens. But nearly every model you'd actually talk to gets a second pass afterward, on a much smaller, carefully chosen set of examples, aimed at one specific goal: behaving like a helpful, truthful assistant instead of a raw pattern-continuer.

That second pass is usually called post-training. Mechanically, nothing about it is new — it's still weights getting nudged, still next-token prediction underneath. It's the same floor, painted a second time, with a far smaller brush and a far more specific target.

Humans grading the homework

RLHF

RLHF — Reinforcement Learning from Human Feedback — is the best-known way that second pass gets done. For the same prompt, the model produces several different draft answers. A person reads them and ranks them, best to worst. That ranking is used to train a small helper — a reward model — to predict which kind of answer people prefer. The language model then gets nudged, over and over, toward whatever the reward model scores highest.

The RLHF loop: draft, rank, learn the pattern, nudge Four boxes left to right: one prompt with several draft answers, a person ranking them best to worst, a reward model learning the pattern behind that ranking, and the model being nudged toward whatever scores highest. A label above notes this repeats millions of times. REPEATED MILLIONS OF TIMES One prompt, several draft answers A person ranks them, best to worst A reward model learns the pattern The model is nudged toward what scores high
Not a new mechanism — a training loop, exactly like Lesson 2's, just using human rankings instead of raw internet text as the signal for which continuation to favor.
Same machine, narrower aim

Nothing in the mechanism is new

This doesn't fix Lesson 7. The model isn't reasoning any harder, and it isn't checking its own facts. All that changed is which continuations the floor now favors — toward answering directly, toward admitting uncertainty instead of guessing, toward declining certain requests outright.

That's also the real answer to "why does it refuse to help with that?" It isn't a rule bolted on from outside. Somewhere during this second pass, "decline and explain why" was the continuation that scored highest for prompts that looked like this one — the exact same kind of nudge that once made "mouse" win for "Cat eats ___," just aimed at a different, much narrower target.

The umbrella term

Alignment

RLHF is one specific technique. The broader goal it serves has its own name: alignment — the general project of making a model's behavior actually match what people want, not just what's statistically likely to follow in a wall of internet text. It's an active, fast-moving field; RLHF is the best-known method, not the last word on it.

Every time you've heard a model described as helpful, truthful, and harmless, that's alignment work being described in three words.

Next

One more kind of "safe" to check

Alignment is why a model usually behaves helpfully and knows when to say no. "Usually" isn't "always," and none of it says anything about what happens to what you actually type. The last lesson covers that other half of the question.

The whole picture, continued

The glossary, 5 rows longer

Everything from the lessons before this one, plus what this lesson added.

The board The word for it
The board and its pegsThe structure — the model
A single pegA neuron
A single step from one peg to the nextA connection
How red or blue a patch of floor isA weight — a parameter
The whole painted floorThe trained model
Boards stacked, one on the nextLayers — "deep"
Smearing the floor in, coin by coinTraining
Dropping one coin through a finished boardUsing it — inference
Which slot you pour intoYour input — your prompt
The bins, relabelled with tokensThe vocabulary — every token it could pick
The tallest pile among the binsThe prediction — the likeliest next token
Feeding the growing line back in and running againThe loop — how one guess becomes a sentence
One bin's label, preciselyA token — not always a whole word
How many bins there are, in totalVocabulary size — tens of thousands
The size of the mountain of text it was shownTraining data — measured in tokens
A bin's own address, plotted in spaceAn embedding — meaning turned into a list of numbers
How close two addresses sitSimilarity — how related two things are
The measurement's real name, out in the wildCosine similarity — same idea as similarity, different name
About meaning, not exact spellingSemantic
A neighbourhood of addresses that share a topicA domain — a cluster of related meaning
Scanning every address for whichever one sits closest to a new pointNearest neighbor — the closest real match to a computed point
A small, separate machine that only plots words as points — it never writes a sentenceAn embedding model — not the same as a language model
The total number of coloured patches, across every boardParameters — the number people quote
How many tokens the funnel can hold in one pourInput tokens — the context window
How many tokens come back outOutput tokens — what it writes back
Everything you've met so far, built at real-world sizeA Large Language Model — an LLM
A shorter pile winning, extended forward with full confidenceA hallucination
The point where the training reading stoppedThe knowledge cutoff
How sharp or blended the colour stays before a coin is pouredTemperature — the dial on how often a stray pick wins
Pouring the same slot twice, not always the same pileNon-deterministic — same input, no guaranteed identical output
Background, examples, or a role, added right into the pourContext
Asking for many small steps instead of one big leapChain-of-thought prompting
A friendly chat window built around the boardA product — like ChatGPT or Claude.ai
A door that lets software pour in and read out directlyAn API
What each million tokens costs to send in or get backAPI pricing — pricier for bigger models, and for output
Recalling the start of the line instead of re-pouring itCached tokens — priced far cheaper than fresh input
The board asking the app to go do something real before it answersTool use — or function calling
One shared shape for listing tools and calling themMCP — Model Context Protocol
A program that speaks that shape and hands back its whole toolboxAn MCP server
The loop deciding, acting, and watching what happened, on repeatAn agent — a model with tools, looping until the goal is met
Deciding its own steps, and knowing when it's doneAutonomy
Reading what just happened before deciding what's nextReactivity
Starting on its own, from a schedule or an eventPro-activeness
Talking to other agents, and to people, not just toolsSocial ability
Search first, hand the model what you found, then let it answerRAG — Retrieval-Augmented Generation
Folding the search step into the loop, so it can search again if neededAgentic RAG
+ New in this lesson
The first, giant reading pass, before the floor is fine-tuned at allPretraining
A second, much smaller painting pass, aimed at a narrower targetPost-training — or fine-tuning
A person ranking draft answers, best to worstRLHF — Reinforcement Learning from Human Feedback
A small helper trained to predict which answer people preferA reward model
Making a model's behavior actually match what people wantAlignment

51 rows now. It keeps growing as the course goes on.

Lesson 13 of 14

Sign in to orqo

Choose how you'd like to continue.

More ways to sign in are on the way.