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 11: The scheduler supplies learning rates

How large should each training update be?

After this chapter: Distinguish scheduler, optimizer, update, batch, and epoch.

The gradient gives the local direction of increasing loss. The optimizer turns the gradient, together with any optimizer state, into a parameter update. For SGD without momentum, the update is simply minus learning rate times gradient.

The learning rate is a global multiplier. Adam also rescales each parameter using its own bias-corrected gradient statistics: learning rate × m̂ / (√v̂ + epsilon). The scheduler chooses the learning rate; the optimizer determines this per-parameter rescaling. Our comparisons below use plain SGD to isolate the learning-rate effect.

Keep the starting parameter and gradient fixed. A larger learning rate produces a larger gradient-descent change; a smaller rate produces a smaller change. This comparison isolates the effect of learning rate from everything else.

A scheduler chooses how the learning rate varies over training updates. In our illustration, the first updates use small rates and gradually increase them. This is warmup. The rate reaches 0.100 at update 4.

After warmup, a smooth cosine-shaped curve reduces the rate toward 0.010 at update 12. This is one illustrative schedule, not a universal requirement. Warmup was explicitly added; a cosine curve does not automatically provide it.

Keep the jobs separate: backpropagation computes gradients, the scheduler supplies a learning rate, and the optimizer uses them to update parameters. The learning rate belongs to training. It is not a vocabulary probability or a sampling-temperature setting used during generation.

Keep this idea

The scheduler controls how the update scale changes over training.

Now explore the visual

Move along the schedule and compare update sizes using the same initial parameter and gradient. Update 0 marks the boundary before training updates begin.

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

Finally, we will put training and generation side by side to see the complete system.

Chapter 11 / 12 · The scheduler supplies learning rates

Start with explicit warmup

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

Our recurring sentence: the cat sat on the mat
0.0000.0250.0500.0750.100014812learning rateOptimizer-update number
Updates 1–4: explicit linear warmupUpdates 5–12: cosine decay
Update number1
Scheduler supplies rate0.025
SGD subtracts rate × 0.50.013
0.8 becomes0.788

Each displayed scalar comparison starts again at 0.8 with gradient 0.5; it isolates the rate, rather than pretending these are consecutive training states.

Show the schedule math

For update u = 1…4: rate = 0.1 × u / 4. For u = 5…12: rate = 0.01 + 0.045 × (1 + cos(π × (u − 4) / 8)). Update 0 is a boundary, with no optimizer step. Rates are supplied before the correspondingly numbered update.

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

Distinguish scheduler, optimizer, update, batch, and epoch. 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 gradient accumulation combines four microbatches, must the scheduler advance four times?

Not for a schedule defined per optimizer update. Four accumulated microbatches can produce one update and one scheduler step.

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