---
title: How a model works — inside the chat model, in nine lessons
description: Nine short lessons inside a language model: one pass to the next token, tokens, the embedding matrix, attention, layers, training, running, and kinds of model.
url: https://instibrain.ai/guides/how-a-model-works
updated: 2026-11-08
site: https://instibrain.ai/llms.txt
---

# 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.

Lesson 1: One pass, one token  →  AI basics comes first

No mathematics beyond multiplying, adding, and raising e to a power. Lesson 6 has a live toy to move.

the lessons · the words under it

## 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.

- 1One pass, one token Text, tokens, vectors, layers, a score for every token, one picked; then the whole pass runs again.
- 2Tokens are learned pieces A tokenizer merges the pair it sees most, again and again; worked by hand on seven words.
- 3The embedding matrix Each token fetches its row from a table of 128,256 rows: its vector, a point on a map of meaning.
- 4Attention Each token takes a share of the tokens before it; three tokens worked by hand, every number shown.
- 5Layers and weights Attention, then feed-forward, 32 times; count the 8 billion weights matrix by matrix.
- 6Picking the next token A score for every token, softmax, and the temperature you move in a live toy.
- 7Training, in four stages Random numbers nudged after every guess; pretraining, then three stages to the chat model you use.
- 8Running a model Every token reads every weight once, so memory decides speed; the KV cache and thinking tokens.
- 9Kinds of models One design, three last steps: a chat model writes, an embedding model finds, a reranker orders.
Start lesson 1   →

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.

| 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 |

the next series  RAG

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 matters  Why instibrain

The same models answer every company; the difference is what yours reads.
every series  Guides

The four kinds, what you need, and how a lesson works.

---

instibrain is made by WebWork AI, Inc. Everyone uses the same models · the difference is what yours knows.
