TensoriumInterview preparation
← Home

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.

  1. Distinguish a Transformer from attention alone.
  2. Trace tokens, states, block operations, and logits.
  3. Derive attention and detect future-token leakage.
  4. Separate training updates from inference.
  5. Compare model changes by benefit, cost, and evidence.
Already know the basics? Explore GPT-2 → DeepSeek-V3 → Kimi K2 design trade-offs

Viewing a chapter is not proof of understanding. Teach-backs use self-review; code checks validate small examples, not overall mastery.

Read chapter 8: Turn a state into the next token

How do internal numbers become a word?

After this chapter: Separate model logits, vocabulary probabilities, and the decoding policy.

The Transformer’s output is still a vector, not a word. For the prefix “the cat”, take the final representation at “cat”, the last available position. Its causal representation can use information from both available tokens.

The output layer transforms this four-number representation into one score for every token in our vocabulary. These scores are called logits. They can be negative, and they do not yet sum to one.

Softmax turns the logits into probabilities that add up to one. This time the probabilities are over vocabulary entries, not the input positions used in attention.

We now need a selection rule. Greedy selection chooses the most probable token. Sampling draws from the whole probability distribution, so a less probable token can still be selected. Our sampling illustration uses a fixed draw to make replay reproducible.

Append the selected token and run the same process on the longer prefix. Notice what changes: the text and the calculated activations. The stored parameters stay fixed during ordinary generation. Generating a continuation is not an optimizer update.

Keep this idea

The model produces a distribution; a selection rule turns that distribution into a continuation.

Now explore the visual

Follow the last-position vector → vocabulary scores → probabilities → selected token. Then compare greedy selection with the fixed sampling example.

Use Next step below to move at your own pace. You can reopen this explanation from any scene in the chapter.

So far we have used fixed parameters. Next, we will see how training examples tell us whether those parameters are useful.

Chapter 8 / 12 · Turn a state into the next token

Read the last position

Chapter scene 1 of 4 · Next step controls this detailed explanation

Our recurring sentence: the cat sat on the mat

Supplied prefix

thecat

→ satnext word, appended on this step

Last state: cat
-1.6670.5600.9350.171
Output projection: four state features × learned weight table + eight biases
dog-2.996
on-2.996
cat-2.996
mat-2.996
ran-2.996
the-2.996
<end>-2.996
sat-0.431
Softmax: exponentiate each logit, then divide by the total

Next-token probabilities

dog
5.0%
on
5.0%
cat
5.0%
mat
5.0%
ran
5.0%
the
5.0%
<end>
5.0%
sat
65.0%

All 8 entries shown · total 100.0% · rounded labels

Computed teaching trace, not a real LLM measurement. The output head is deliberately calibrated to four prefixes; this is not evidence of general language ability.

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

Separate model logits, vocabulary probabilities, and the decoding policy. Try aloud first, then write your explanation. Compare it with a worked explanation, not a keyword score.

No reference consulted yet.
Change the situation: Does lower temperature verify the factual truth of the selected continuation?

No. It sharpens the distribution; the most likely continuation can still be false.

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