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 24 of 62 · Generalizing and measuring it

Dropout and evaluation mode

Easy

How does inverted dropout work during training, and why must you switch to eval mode at inference?

Why this mattersSeparating module training mode (model.eval()) from autograd tracking (torch.no_grad()) prevents silent evaluation bugs.

1 · Start with the intuition

During training, dropout zeroes out each activation coordinate independently with probability p so downstream layers cannot rely on brittle co-adaptations of specific features. To keep the expected magnitude of activations identical between training and inference, frameworks use inverted dropout: surviving activations are multiplied by 1/(1 − p) during training, so at evaluation time the layer simply becomes the identity function.

2 · How the mechanism works

Mechanism step 1 of 3 · no question to answer

Sample Bernoulli mask

For each coordinate, draw mᵢ ~ Bernoulli(1 − p) independently on every forward pass during training.

Next, we will look at: Rescale survivors by 1/(1 − p). Move on when this operation makes sense.

Visualizing the behavior

Inverted dropout with p = 0.25 (keep probability 0.75)

Derived
Input x
3124
Sampled mask
10dropped11
Train output (÷ 0.75)
4.0002.675.33
Eval output
3124
Each coordinate’s expected training output equals its input: 0.75 × 4 = 3. A single sample does not (it sums to 12 here, not 10). Scaling during training means evaluation needs no correction; you just switch dropout off.