- 1One pass, one tokenText, tokens, vectors, layers, a score for every token, one picked; then the whole pass runs again.
- 2Tokens are learned piecesA tokenizer merges the pair it sees most, again and again; worked by hand on seven words.
- 3The embedding matrixEach token fetches its row from a table of 128,256 rows: its vector, a point on a map of meaning.
- 4AttentionEach token takes a share of the tokens before it; three tokens worked by hand, every number shown.
- 5Layers and weightsAttention, then feed-forward, 32 times; count the 8 billion weights matrix by matrix.
- 6Picking the next tokenA score for every token, softmax, and the temperature you move in a live toy.
- 7Training, in four stagesRandom numbers nudged after every guess; pretraining, then three stages to the chat model you use.
- 8Running a modelEvery token reads every weight once, so memory decides speed; the KV cache and thinking tokens.
- 9Kinds of modelsOne design, three last steps: a chat model writes, an embedding model finds, a reranker orders.
What happens inside the model, in nine short lessons.
AI basics says what a model reads. This series opens the model: one pass from your text to the next token, how the numbers inside it were set, and what it takes to run them. Claude's shape is not published, so the counts use Llama 3, an open model whose maker publishes its shape.
No mathematics beyond multiplying, adding, and raising e to a power. Lesson 6 has a live toy to move.
Nine lessons, from your text to the next token.
Lesson 1 is the whole pass. Lessons 2 to 6 walk it step by step. Lesson 7 says how the numbers inside were set, lesson 8 what it takes to run them, and lesson 9 names the kinds of model.
The map: every word, in its place.
Tokens are the addresses, vectors the content. Attention mixes them, the layers refine them, and the last step picks the next token.
| Where | The words | Lesson |
|---|---|---|
| The pass | pass, weights, LM head, inference | 1 |
| In | token, vocabulary, byte-pair encoding, merge, token ID | 2 |
| Inside | matrix, embedding matrix, dimension, dot product | 3 |
| Inside | query, key, value, attention weights, head, causal mask | 4 |
| Inside | layer, feed-forward, residual stream, parameters | 5 |
| Out | logit, softmax, temperature, top-p | 6 |
| Training | loss, backpropagation, gradient descent, base model, fine-tuning, preference training, reasoning training | 7 |
| Running | graphics card, quantization, KV cache, prompt caching, thinking tokens | 8 |
| Kinds | transformer, decoder, encoder, reranker, mixture of experts, multimodal, diffusion | 9 |
Running retrieval beside your brain: what to index, the job, the cuts, hybrid search, the reranker, the prompt, the measure, and where the pages sit.
why it mattersWhy instibrainThe same models answer every company; the difference is what yours reads.
every seriesGuidesThe four kinds, what you need, and how a lesson works.