instibrain
instibrain  /  guides  /  how a model works

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.

what you learned

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.

WhereThe wordsLesson
The passpass, weights, LM head, inference1
Intoken, vocabulary, byte-pair encoding, merge, token ID2
Insidematrix, embedding matrix, dimension, dot product3
Insidequery, key, value, attention weights, head, causal mask4
Insidelayer, feed-forward, residual stream, parameters5
Outlogit, softmax, temperature, top-p6
Trainingloss, backpropagation, gradient descent, base model, fine-tuning, preference training, reasoning training7
Runninggraphics card, quantization, KV cache, prompt caching, thinking tokens8
Kindstransformer, decoder, encoder, reranker, mixture of experts, multimodal, diffusion9