AI Training and Alignment
The main guide shows what happens when you use a model. This page shows how the model got there: how raw text becomes a base model, how a base model becomes an assistant, and how labs try to make that assistant honest, useful, and safe. Two of the steps you will not just read about — you will run them, on a real model, in this tab.
The Core Pipeline
Every modern AI assistant goes through roughly the same six stages. Watch one model travel down the line and see what it is called at each point, or pick a stage to read about it.
Training Data
A model can only learn patterns that exist in what it reads. Large models are trained on trillions of tokens: web pages, books, code, reference works, licensed datasets, and increasingly images, audio, and video. The quality of that mixture matters as much as its size — a model trained on sloppy text learns sloppy habits.
The data behind the model on this page
The tiny model you are about to train has a training set too. It is small enough to count exactly.
A frontier model sees roughly a billion times more tokens and has roughly ten million times more weights. The procedure in the next chapter is the same.
Pretraining
Pretraining is one deceptively simple game: guess the next token. The model reads some text with the ending hidden, predicts what comes next, and is scored on how wrong it was — a number called the loss. An algorithm called backpropagation works out how to adjust every weight to be slightly less wrong next time. Repeat that enough and the model is forced to absorb grammar, facts, and patterns, because all of them help it guess better.
One training example, in slow motion
A real sentence from the training set. The model sees the tokens on the left and has to bet on the hidden one.
Now train it yourself
This is the same model the main guide runs on. Wipe its weights to random numbers and the slow-motion example above turns to noise. Then press Train and watch the loss fall, the sentences it writes turn from babble into grammar, and its word map sort itself into groups — all from the single instruction "be less surprised".
Fine-Tuning
Fine-tuning takes a trained model and keeps training it — on a much smaller, hand-picked dataset showing the behaviour you actually want. Same game, same maths, new examples. It is how a base model becomes an assistant, and how a general model becomes a specialist.
Teach the model a word it has never seen
The model's vocabulary contains a token for dragon, but no training sentence ever used it. Look at the first two lines in the panel below: it still writes something grammatical, because it knows how sentences go, but it is guessing — it has learned nothing about what dragons do. Here are ten new sentences:
The fine-tune that makes an assistant
For chat models the hand-picked examples are conversations: a user asks, the assistant answers helpfully. This is supervised fine-tuning, and it teaches the model that a question deserves an answer rather than a continuation.
RLHF and Alignment
Fine-tuning shows the model what good answers look like. But "good" is fuzzy — helpful, honest, harmless, appropriately confident — and nobody can write enough perfect examples to pin it down. So labs use reinforcement learning from human feedback (RLHF): show people two candidate answers, ask which is better, train a reward model to predict those preferences, then nudge the assistant toward answers the reward model scores highly. You are about to generate that signal yourself.
2 · The assistant, before and after
Before feedback, assume the assistant is as likely to do each of these as not. Finish the three rounds, then apply.
Evals and Red Teaming
Before a new model ships it gets examined: benchmark suites for reasoning, coding, and maths; human evaluations of usefulness and style; safety testing for jailbreaks, dangerous capabilities, and privacy leaks; and red teams whose whole job is to make the model misbehave. The most important rule is the least glamorous: a new model must not quietly get worse at things the old one did well.
The Deployment Layer
The trained model is not what you talk to. Products wrap it in a system prompt that sets role and rules, tool access, retrieval, memory, moderation filters, and rate limits. That wrapper is why the same underlying model can feel like a different product in different apps.
RAG and Embeddings
Retraining a model to teach it your documents is slow and expensive. Retrieval-augmented generation (RAG) skips that: store your documents, search them when a question arrives, and place the best matches into the model's context so it can answer from evidence.
Real retrievers search by meaning, not by matching words
The demo above counts shared words, which is easy to follow but brittle. Production systems convert every text into an embedding — a list of numbers where similar meanings land near each other — so "watering schedule" can find "irrigation notes" without sharing a word. Here are real embeddings from this page's model: pick a word and see which tokens sit closest to it.
Limits and Open Questions
An honest explainer ends with what is still unsettled.
See the trained model at work
The main guide follows one prompt through this same model: tokens, embeddings, attention, layers, and the dice roll at the end. (It loads the shipped weights; training done here stays on this page.)