Labs
Take one mechanism and play with it. Every lab runs on small example numbers you can edit — sized so that every number fits on the screen and changing an input visibly changes the result — and every number is computed by the same functions the modules use, so a lab and a module never disagree.
BERT, step by step
The route goes through BERT from text to the training step. Each step is one part of the model, with the lab that takes it apart on numbers you can edit; take them in order, or start where you need to. Steps 2 and 8 share one small input: what the embeddings lab outputs is what step 8's lab, One encoder block, receives, one row (vector) per token. The other labs use their own small example numbers, sized for the one part they show.
- 1
- 2
Embed
Each token's row, its sentence's row and its position's row, summed and normalised.
- 3
Position
A closer look at the position row step 2 adds: attention alone cannot see order. BERT learns its position table; the lab shows the fixed ones.
Inside one encoder block
Steps 4 to 7 are the parts of one encoder block, not four stages in a row: attention (with its heads) and the feed-forward are the block's two sublayers, and add & norm wraps each. Step 8 assembles them.
- 4
Attention
Each token scores every token, itself included, and mixes their values by those weights.
- 5
Heads
The same attention split into heads that look for different things, then mixed back into one row by an output matrix.
- 6
- 7
- 4
- 8
One block
The four parts above chained into one block — BERT-base stacks twelve of them.
- 9
Masked words
Hide some tokens and predict them from both sides — BERT's first training task.
- 10
Sentence pair
The [CLS] row through the pooler (a dense layer and tanh), then asked whether sentence B follows A — the second task.
- 11
Sentence vector
Many token vectors made one, and two of those compared.
- 12
Training
A loss, its gradient sent back through every layer, and a step taken.
The whole route, end to end: The traced BERT — 3 sentences, then 64IT/ML track — this module is not part of the language-professional track — every block on one small model, every number on the page.
Concept labs
One mechanism, on test data you can edit, sized to show everything it does.
BERT, part by part
BERT's input sum, one whole encoder block, and the two prediction heads it is trained with — each on test data.
Embeddings summed
BERT's input is three rows added — the token's, its position's and its sentence's — then one LayerNorm before the first block. BERT learns all three tables; this lab uses the fixed sinusoidal position table and a zero sentence-A row, so its numbers match the ones the modules under Learn it compute.
6 tokens · d_model = 8 · a vocabulary of 10 · 2 segments
OpenOne encoder block, assembled
Attention, add & norm, feed-forward, add & norm — the parts the labs before this one take apart, chained into the block BERT-base stacks twelve times (BERT-large, 24).
6 tokens · d_model = 8 · 2 heads · d_ff = 32
OpenMasking and the prediction head
Fifteen per cent of the tokens chosen — 80 % masked, 10 % replaced by a random word, 10 % kept — the prediction head's scores over the vocabulary at every position, and a loss counted at the chosen positions only.
8 tokens · a vocabulary of 12 · d_model = 8
OpenPooler and next-sentence head
The [CLS] row through a dense layer and tanh — the pooler — then two logits: is sentence B the one that followed A?
2 pairs · d_model = 8 · W_pool 8 × 8 · W_NSP 8 × 2
Open
Scores and attention
How a row of numbers becomes a row of weights.
The attention matrix
Each query scores every key, the scores become weights, and the weights mix the values.
6 tokens · d_k = d_v = 4
OpenSoftmax
Logits become probabilities; temperature, masking and scale decide how peaked they are and whether a gradient survives.
8 logits
OpenHeads split and mixed
One attention split into heads by slicing the projections, each head's map on its own, the contexts concatenated and mixed back by W_O.
6 tokens · d_model = 8 · 2 heads of d_k = 4
Open
Vectors
What a dot product, a matrix product and a pooled vector actually compute.
Dot product and cosinefrom a module
Two vectors, one number: how much they point the same way, with and without their lengths.
OpenMatrix multiplicationfrom a module
Every cell of the product is one dot product — rows of A against columns of B.
OpenPooling with and without the mask
One sentence vector from a batch's token rows — [CLS], mean or max — and what the padding rows do to it unless the mask keeps them out.
8 rows × 4 dims · 2 of them padding
OpenDot product against cosine
The same vectors under both measures, whose neighbour changes, and anisotropy — a shared offset that makes every cosine high until the mean is subtracted.
8 vectors × 4 dims · two clusters
Open
Inside the block
The rest of one encoder block, one sublayer at a time.
Dropoutfrom a module
Zero a random share of activations while training, and scale the rest so the sum holds.
OpenLayer normalisationfrom a module
Centre and scale one row to zero mean and unit variance, then let γ and β undo what training wants undone.
OpenThe sinusoidal tablefrom a module
Position as a fingerprint of sines and cosines at geometrically spaced frequencies.
OpenRoPE and ALiBifrom a module
Position as a rotation of the query–key pair, or as a penalty on distance — the two modern answers.
OpenPositions encoded and compared
The sinusoidal table and why PE·PEᵀ depends only on the offset; the same property as a rotation (RoPE) and as a penalty on distance (ALiBi).
32 positions × d_model = 16
OpenRows normalised
Each row to mean 0 and variance 1 on its own, then γ and β; where ε matters, and what batch norm would have done to the same matrix instead.
4 rows × 8 features
OpenTokens expanded and projected
The feed-forward sublayer one position at a time: widen to d_ff, activate, narrow back — and what the activation and the expansion each buy.
4 rows · d_model = 4 → d_ff = 16 → 4
Open
Training
What happens across one step, many steps, and many layers.
The perceptronfrom a module
A weighted sum, a threshold, and the smallest unit that can learn a line.
OpenCross-entropy against MSE
The same batch of predictions scored two ways — how hard each loss punishes a confident mistake, what a batch mean hides, and which positions a mask lets count.
5 classes · a batch of 4
OpenForward and backward
A small MLP run forward, its loss sent back through the chain rule, every gradient checked against the definition of a derivative, and one step taken.
3 → 4 → 4 → 3 · a batch of 4
OpenSGD, momentum and Adam
The same gradient taken three ways across a drawn surface: plain descent, descent with velocity, and a per-coordinate step — and what the learning rate does to each.
a 2-D surface · 60 steps
OpenA gradient down twelve layers
What the backward pass still carries at each depth — with the residual path, without it, and with LayerNorm before or after.
12 layers × width 8 · a batch of 4
Open
Size and tokens
How big the model is, and what the vocabulary under it is made of.
Parameters, FLOPs and memory
A model's size from its dials — every parameter counted by the platform's own derivation, the FLOPs a token costs, and what training it holds in memory.
this platform's model, up to a 7B decoder
OpenOne distribution, one token
Greedy, temperature, top-k and top-p on one next-token distribution, with a thousand seeded draws to show what each keeps and what each throws away.
12 candidates · 1,000 draws
OpenBPE against WordPiece
Two merge rules on one editable word table — the most frequent pair against the highest-scoring one — and how each then splits a word it has never seen.
10 words · 20 merges
Open
Worked examples
One small model computed end to end, every number on the page.
Workflows
The concepts connected, on a real corpus.
The Atlas
The pipeline node by node, on the served corpus.
OpenThe console
Run the live BERT pipeline.
OpenInspect
Probe and train the checkpoint.
OpenSide by side
The two engines on one corpus.
OpenThe corpus-scale analysis
Where signal emerges from noise as the corpus grows — the ladder as a story.
OpenThe attention demo
Real multi-head attention over your corpus, with a hand-entered scratchpad.
Open
Real cases
The platform applied to your own text or to a production lifecycle.