TensoriumInterview preparation
← Home

Core concepts · 62 topics

A guided path through the ideas behind modern LLMs.

Read the stages in order: how text becomes a prediction, what happens inside the Transformer block, how a model learns, then serving, scale, and post-training. Every topic names what to know first, then gives the intuition, the math with concrete numbers, the common misconception, and a self-check. Already comfortable with the basics? Switch to By area and jump straight to a topic.

New to machine learning? Start here instead.

These topics work best as a refresher; they assume ideas like probability and loss. Begin with three short beginner lessons (tokens, embeddings, next-token prediction), then the visual walkthrough for attention and the Transformer.

Finish line: You can explain how text becomes a prediction and what training does to improve that prediction.

Topic 19 of 62 · How a model learns

Learning rate, warmup, and clipping

Easy

What distinct problems do learning-rate warmup, decay, and gradient norm clipping solve?

Know firstAdam vs AdamW
Why this mattersWarmup, decay, and global norm clipping work on different parts of the update step; knowing what each one actually bounds stops you from using gradient clipping to mask a data or precision bug.

1 · Start with the intuition

These three controls act at different stages of training and are not interchangeable. Warmup starts training with a tiny learning rate and ramps it up over the first few hundred or thousand steps so early updates—taken when weights are random and Adam’s second-moment estimate vₜ has seen only a few batches—do not blow up the activations. Global gradient norm clipping caps the L2 norm of the gradient vector on any single step so an outlier batch cannot launch the weights into a bad region. Learning-rate decay (such as cosine decay) gradually shrinks the step size late in training so the model can settle into a sharper minimum instead of bouncing around it.

2 · How the mechanism works

Mechanism step 1 of 3 · no question to answer

Warm up early steps

Ramp ηₜ linearly from 0 to η_max over T_warmup steps while optimizer moments stabilize.

Next, we will look at: Clip extreme gradient norms. Move on when this operation makes sense.

Visualizing the behavior

Linear warmup, then cosine decay to 10% of peak

Illustrative
01230100025005000750010000optimizer stepLR (×10⁻⁴)warmup ends
  • learning rate
Peak 3e-4 after 1,000 warmup steps, decaying to 3e-5 at step 10,000 along lr = min + ½(max − min)(1 + cos(π·progress)). These are common shapes, not recommended values.

Norm clipping rescales but keeps direction (c = 2)

Derived
c = 2‖g‖ = 5g′ = [1.2, 1.6]
g is scaled by c/‖g‖ = 0.4, so the clipped gradient lies on the same ray, on the circle ‖g‖ = 2. Clipping each coordinate separately would change the direction instead.