Tensorium onboarding flow
From “the cat …” to a language model
A self-paced introduction for technical people new to LLMs. Read each chapter’s explanation first, then explore its visuals one step at a time. Follow the same sentence through text, representations, a Transformer, generation and learning.
12 chapters · 59 short scenes · optional practice · no locked steps
An explanation you can defend
Learn the mechanism, then explain the trade-off.
First follow one sentence through a small Transformer. Then use optional teach-backs, experiments, and short coding exercises to make the explanation your own. Nothing locks the next chapter.
- Distinguish a Transformer from attention alone.
- Trace tokens, states, block operations, and logits.
- Derive attention and detect future-token leakage.
- Separate training updates from inference.
- Compare model changes by benefit, cost, and evidence.
Viewing a chapter is not proof of understanding. Teach-backs use self-review; code checks validate small examples, not overall mastery.
Read chapter 3: Tokens become learned vectors
What numbers can the model actually work with?
After this chapter: Explain an embedding lookup and distinguish parameters from activations.
An ID tells us which token we have, but an arbitrary catalogue number is not a useful description. We use that ID to select a row from another table: the embedding table.
Each row in our model contains four numbers. A list of numbers is called a vector; a table of numbers is called a matrix. The operation is simply: find “cat” → get its ID → retrieve its four-number row.
These numbers are adjustable parameters: stored values that training can change to help the model perform its task. Do not try to assign a literal meaning to every coordinate. The first number is not necessarily “animal”, and the second is not “size”. The numbers work together.
This chapter also introduces Word2Vec’s skip-gram idea: use a center word to predict nearby context words. With “cat” in the center and a window of one word on each side, the examples are cat → the and cat → sat. This is a historical way to learn embeddings, not a required component of our Transformer.
Our Transformer learns its own embedding table through next-token training. An embedding is only the initial representation. Later calculations will make that representation depend on the available context.
Keep this idea
An embedding turns a token into a small numerical starting representation.
Now explore the visual
Watch the token ID select an entire row, rather than multiply it. Treat the two-dimensional word map as an illustration, not as a plot of the actual four-number embeddings.
Use Next step below to move at your own pace. You can reopen this explanation from any scene in the chapter.
Next, we will see how a neural network transforms those numbers.
Chapter 3 / 12 · Tokens become learned vectors
A list of numbers
Chapter scene 1 of 5 · Next step controls this detailed explanation
| Token / row | feature 1 | feature 2 | feature 3 | feature 4 |
|---|---|---|---|---|
| 0 · dog | -0.388 | 0.702 | 0.380 | -0.706 |
| 1 · on | 0.786 | 0.524 | -0.259 | -0.784 |
| 2 · cat | -0.616 | 0.279 | 0.131 | -0.507 |
| 3 · mat | -0.468 | -0.623 | -0.733 | -0.792 |
| 4 · ran | 0.798 | -0.759 | 0.671 | -0.539 |
| 5 · the | 0.724 | -0.142 | -0.797 | -0.269 |
| 6 · <end> | -0.291 | 0.792 | -0.490 | -0.309 |
| 7 · sat | -0.200 | -0.408 | 0.776 | -0.686 |
These are reusable parameters. Context has not been mixed in yet.
Play advances within this chapter every 14 seconds. Pause to inspect; Next never requires an answer.
Place remembered on this device. Chapters are directly linkable; use the address bar to share the current scene. Keyboard: left/right arrows when outside a control.
Make this chapter your own · optional practice
Read and explore first. Then explain it without looking, compare the worked answer, and try a changed example. You can leave and return without losing your draft in this browser.
Explain it in your own words
Explain an embedding lookup and distinguish parameters from activations. Try aloud first, then write your explanation. Compare it with a worked explanation, not a keyword score.
Change the situation: Does an embedding table change merely because a new prompt arrives?
Not in ordinary inference. The prompt changes which rows are selected and the resulting activations.
Draft and self-review saved in this browser, not to your account. Do not enter confidential information on a shared device.
Show the model details and provenance
Deterministic teaching trace v1, vocabulary IDs permuted to distinguish identity from position; each word retains its original embedding and next-token probabilities. The numerical model has 8 vocabulary entries, 4 features, 2 attention heads of 2 features, one pre-LayerNorm block, 8 GELU hidden units, learned-position tables, final LayerNorm (epsilon 0.00001), and an untied output head. Parameters are hand-authored, not learned from a corpus. The output head is calibrated by a four-equation solve to give the next token 65% and each of seven alternatives 5% on four demonstration prefixes. All later activations, probabilities, losses and local derivatives are computed from these same parameters. The output-head gradient is analytic; earlier embedding, query-weight and feed-forward-bias slopes are explicitly labelled central-finite-difference estimates. The Word2Vec map and the standalone SGD/AdamW examples are separately labelled illustrations. Source: src/lib/llmJourney/{numbers,model,training}.js. No actual LLM is called or downloaded.
{
"attentionOutputProjection": [
[
0.14641127923648062,
-0.2694030992674085,
-0.28534247505748717,
0.12225196631435749
],
[
-0.3499898627155085,
0.304777848091882,
-0.17851121408531348,
0.00477013728751681
],
[
0.1512332961032762,
-0.3304774710513706,
0.31472392260927506,
-0.11326800780012626
],
[
0.22137536557939866,
0.3456861375716631,
0.12671029797581895,
-0.21809629998076752
]
],
"feedforward": {
"up": "4 × 8",
"activation": "GELU (tanh approximation)",
"down": "8 × 4"
},
"layerNorm": {
"epsilon": 0.00001,
"scale": 1,
"offset": 0
}
}Show the code structure
# Architecture pseudocode, not an executable training script x = token_table[token_ids] + position_table[positions] x = x + attention(layer_norm_1(x), causal_mask=True) x = x + linear_down(gelu(linear_up(layer_norm_2(x)))) state = final_layer_norm(x) logits = output_projection(state) probabilities = softmax(logits, vocabulary_axis) # Training only: loss = mean(-log(P(observed_next_token))) # backward computes gradients; optimizer changes parameters # Inference only: select token, append, run again
Executable deterministic calculation and focused tests are maintained with this course; no external LLM service is used.
Primary references
- Word2Vec: skip-gram predicts context words from a center word ↗
- Attention Is All You Need: scaled dot products, heads, masking ↗
- GPT-2 report: pre-normalization and final normalization ↗
- GPT-2 reference operations: learned positions, GELU, pre-LN ↗
- PyTorch: LayerNorm, population variance and per-feature affine parameters ↗
- Adam: gradient statistics, bias correction and learning-rate multiplier ↗
- PyTorch: backpropagation and automatic differentiation ↗
- PyTorch: AdamW and decoupled weight decay ↗
- PyTorch: cosine decay (warmup is supplied separately here) ↗