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 1: Watch a sentence grow

What is a language model actually doing?

After this chapter: Explain next-token generation without calling it a lookup of a complete answer.

Imagine you see an unfinished sentence: “the cat …”. Several continuations are possible: “sat”, “ran”, or “slept”. A language model assigns probabilities to possible next pieces of text. It does not have to choose one immediately.

Our small teaching model gives “sat” the highest probability. If we choose it and append it, the text becomes “the cat sat …”. We then ask the same question again, using this longer input. This time, the model favors “on”.

Repeating this process produces “the cat sat on the mat”. The whole sentence was not written in one operation. Each chosen word became part of the input for the next operation.

For now, focus on this loop rather than the machinery inside the model. The probabilities here come from a deliberately hand-calibrated toy model. They illustrate the process; they are not evidence of a real trained model’s capabilities.

Keep this idea

Generation repeats: read the available text → choose a continuation → append it → repeat.

Now explore the visual

Step through the visual and watch one word appear at a time. Notice that the available input grows after each choice.

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

Next, we will turn those written words into something a numerical machine can use.

Chapter 1 / 12 · Watch a sentence grow

Start with “the cat …”

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

The story begins: the cat …

Supplied prefix

thecat

…a continuation will be added here

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

Explain next-token generation without calling it a lookup of a complete answer. Try aloud first, then write your explanation. Compare it with a worked explanation, not a keyword score.

No reference consulted yet.
Change the situation: If the model chooses a plausible but incorrect token, is the next token conditioned on the intended answer or on what was actually appended?

It conditions on the actual appended token. A fluent continuation is not evidence that the earlier claim was correct.

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