Every question here comes from the notes on this site: the Q&A inside each note and its closing self-check. When the site is built, they are pulled out and arranged by the Foundations tracks; when a note changes, this page follows, so there is no second question bank to maintain.
How to use it: answer in your head, then open the question for the reference answer and where it comes from. The answers to the "ask yourself" questions are in the notes themselves; if you are stuck, follow the link back. To get a question at random, use "Random question".
How a model reads
Sigmoid: when should one logit be read as a probability or a gate?From linear to neural
Reference answer
$$ \sigma(x)=\frac{1}{1+e^{-x}},\qquad \sigma'(x)=\sigma(x)(1-\sigma(x)). $$
At $x=0$ the output is $0.5$; large negative inputs approach 0 and large positive inputs approach 1. A binary classifier can interpret $\sigma(z)$ as the positive-class probability. A multi-label classifier applies an independent sigmoid to each label, so “person, car, road” can all be true at once. The LSTM forget / input / output gates use it too, keeping each channel between 0 and 1.
The cost is saturation: the derivative peaks at only $0.25$ and approaches 0 for large $|x|$. Sigmoid therefore fits output and gating semantics, not the ordinary hidden layers of a modern deep network.
From From linear models to neural networks · How a model reads, stop 1 of 9Open the note
Tanh: why does RNN state need bounded values of both signs?From linear to neural
Reference answer
$$ \tanh(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}},\qquad \tanh'(x)=1-\tanh^2(x),\qquad \tanh(x)=2\sigma(2x)-1. $$
Tanh is zero-centered and squashes values into $(-1,1)$. A plain RNN uses
$$h_t=\tanh(W_xx_t+W_hh_{t-1}+b),$$
while an LSTM uses it to produce signed candidate memory. A sigmoid gate answers “how much passes?”; a tanh candidate answers “what signed content gets written?” Tanh also saturates at large magnitudes, so it does not solve long-range vanishing gradients. What really matters in the LSTM is the additive path through the cell state.
From From linear models to neural networks · How a model reads, stop 1 of 9Open the note
ReLU: how can a simple max stop a deep network from being equivalent to a linear layer?From linear to neural
Reference answer
$$ \operatorname{ReLU}(x)=\max(0,x),\qquad \operatorname{ReLU}'(x)=\begin{cases}0,&x<0\\1,&x>0.\end{cases} $$
Without an activation, $W_2(W_1x)=(W_2W_1)x$, so many layers are still one linear map. ReLU opens different linear paths in different input regions, turning the network into a piecewise-linear function. Its derivative on the positive side is 1, which avoids the positive-side saturation of sigmoid / tanh, and it is cheap to compute.
If a unit stays in the negative region for a long time, both its output and its gradient are 0, and it may become a dying ReLU. Leaky ReLU keeps a small slope on the negative side; modern Transformer FFNs more often use GELU, SiLU, and SwiGLU.
From From linear models to neural networks · How a model reads, stop 1 of 9Open the note
Softmax: why is it not an elementwise activation?From linear to neural
Reference answer
$$ p_i=\operatorname{softmax}(z)_i=\frac{e^{z_i}}{\sum_j e^{z_j}}, \qquad \sum_i p_i=1. $$
Softmax turns a whole group of logits into one categorical distribution. $[2,1,0]$ becomes approximately $[0.665,0.245,0.090]$. It is used for mutually exclusive multiclass classification, for each row of attention weights, and for a language model's next-token distribution.
It is invariant to a common shift, so a stable implementation subtracts the maximum first:
$$ \operatorname{softmax}(z)=\operatorname{softmax}(z-\max_j z_j). $$
This step prevents $e^{z_i}$ from overflowing without changing the result. Softmax itself is not “pick the maximum”: it keeps several nonzero weights, and only approaches one-hot, and saturates, when the logit gaps are large.
From From linear models to neural networks · How a model reads, stop 1 of 9Open the note
What does the universal approximation theorem actually guarantee?From linear to neural
Reference answer
With a suitable nonlinear activation and a wide enough network, on a compact set $K$, for any continuous target function $f^*$ and any $\varepsilon>0$, there exists a set of parameters such that
$$ \sup_{x\in K}\left|f_\theta(x)-f^*(x)\right|<\varepsilon. $$
This shows that the network's function family has enough expressivity, but it does not guarantee that:
- gradient descent will find those parameters;
- finite training data is enough to pin down the right function;
- the required network is small enough and cheap enough to train;
- the model still extrapolates correctly out of distribution;
- a low training loss implies good generalization.
“Universal approximator” is therefore an existence result, not a quality certificate saying “this model will learn well.”
From From linear models to neural networks · How a model reads, stop 1 of 9Open the note
How many parameters does multi-head attention have?Attention
Reference answer
Four $d_\text{model} \times d_\text{model}$ matrices, so $4d^2$ (without biases) — independent of the number of heads. Splitting into heads only regroups the same parameters.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
What is the time and memory complexity?Attention
Reference answer
For batch size B and model width d, time including projections is $O(BTd^2+BT^2d)$; explicitly storing the per-head attention matrices takes $O(BhT^2)$ space. FlashAttention uses tiling to avoid writing those full matrices to GPU memory. It does not remove dense attention's quadratic compute, nor the storage for other activations, KV, and parameters.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
Why do Q and K use two different matrices? Can they be shared?Attention
Reference answer
They can be shared, but that restricts the matching function. In this self-attention example without extra positional transformations, Q=K makes the raw scores $QQ^\top$ symmetric. Row-wise softmax uses different denominators, so the final weights need not be symmetric. Separate projections let even the raw scores differ by direction; symmetric scores do not imply symmetric attention weights.
Set $Q=K$ and leave out masks and position biases. If all vectors are identical, every score in a row is the same and the weights are uniform. If the vectors are mutually orthogonal with equal nonzero norm, the diagonal score is largest, but the weights approach the identity only when the scaled diagonal score dominates the others. In general it is the dot product that matters: a position need not attend only to itself.
These internal coordinates are also not unique. For any invertible $R$, setting $Q'=QR$ and $K'=KR^{-\top}$ still gives $Q'K'^\top=QK^\top$: a different internal basis, the same function. Interpreting a single entry of $W_Q$ in isolation is therefore usually meaningless; what matters is the function the projection implements and its causal effect on the output.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
Why doesn't V take part in the scoring?Attention
Reference answer
Separate projections allow matching features to differ from the content being transmitted. Matching might emphasize entity type while values retain particular attributes. Q/K/V all come from the input, so content already affects scores. Involving V in scoring does not inherently cause collapse; the standard design simply separates these computational roles.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
Can multiple heads collapse into one?Attention
Reference answer
Some heads can be redundant. Head-pruning research removed subsets of heads with little performance change in some models and tasks. That does not imply that most heads can safely be removed from any model: head selection, fine-tuning, and evaluation data all matter.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
Why must the mask be added before the softmax? Would filling with 0 work?Attention
Reference answer
Adding zero to a blocked logit does not mask it. Setting it to zero still leaves an unnormalized weight of $e^0=1$. Setting it to $-\infty$ before softmax removes it from the denominator. Zeroing weights after softmax and renormalizing is mathematically equivalent on a nonempty allowed support, but zeroing alone is not, and numerical stability is harder to handle.
From Multi-head attention: from equations to implementation · How a model reads, stop 4 of 9Open the note
What problem do residual connections solve?Residuals
Reference answer
They make updates relative to the input easier to represent and add an identity term to the Jacobian. Total gradients can still cancel or amplify; the existence of one path is not unconditional stability.
Separate optimization from overfitting by inspecting training error as well as validation error. Higher training error is not explained merely by saying the larger model overfits.
From Residual connections · How a model reads, stop 5 of 9Open the note
Why add instead of concatenate?Residuals
Reference answer
Concatenation, as in DenseNet, also preserves information but increases later input widths, requiring parameter and memory management. Addition preserves the current width and makes stacking convenient; it neither permits infinite depth nor requires identical parameter counts in every layer.
Addition also makes "do nothing" a reachable solution ($f = 0$). With concatenation, later layers have to actively learn to ignore what was appended.
From Residual connections · How a model reads, stop 5 of 9Open the note
What happens to the variance of $x + f(x)$?Residuals
Reference answer
For one coordinate, write the full expression:
$$\operatorname{Var}(x+f)=\operatorname{Var}(x)+\operatorname{Var}(f)+2\operatorname{Cov}(x,f).$$
Approximately linear growth requires negligible covariance and comparable update variance across layers. If $f=-x$, the output variance is zero instead. Branch scaling controls each increment; final normalization only controls the scale entering the output head, not every intermediate propagation problem.
Inspect activation and gradient distributions before choosing initialization, residual scaling, or normalization.
From Residual connections · How a model reads, stop 5 of 9Open the note
How should we compare pre-norm and post-norm?Residuals
Reference answer
Pre-norm often makes deep networks easier to optimize because normalization stays in the branch rather than the main skip. Suitable learning rates, initialization, and training budgets still matter.
Post-norm normalizes each residual output and has different training and representation behavior. Compare quality at matched budgets rather than claiming one universally wins. The gradient-path derivation is in normalization.
From Residual connections · How a model reads, stop 5 of 9Open the note
Where does dropout go, and why not on the residual stream?Residuals
Reference answer
On the branch output: $x + \text{Dropout}(f(x))$.
Applying dropout to the skip changes its direct Jacobian to a random mask rather than $I$. This explains the standard branch placement; it does not prove every other dropout design is ineffective.
Embedding, attention, and residual dropout occupy different locations; inspect their settings separately.
From Residual connections · How a model reads, stop 5 of 9Open the note
How does this relate to an LSTM's cell state?Residuals
Reference answer
Both provide additive paths. In $c_t = f_t \odot c_{t-1} + i_t \odot \tilde c_t$, holding gates fixed gives the forget gate as the direct derivative along cell state. Values near 1 help propagation across time; the total derivative also includes the gates' dependence on history.
This is a useful analogy between propagation across time and depth, not an equivalence between the architectures.
From Residual connections · How a model reads, stop 5 of 9Open the note
Why do deep networks need normalization?Normalization
Reference answer
Quick learning
A residual network repeatedly applies
$$ x_{\ell+1}=x_\ell+f_\ell(x_\ell). $$
If branch outputs have uncontrolled scale, residual additions let activation scale drift with depth. During backpropagation, curvature and gradient scale may also differ sharply across layers and directions. This does not mean values must monotonically explode; it means one learning rate has trouble serving every layer and direction.
Normalization gives each sublayer more predictably scaled inputs, reducing sensitivity to initialization and parameter scale. It often improves effective conditioning, which makes it easier to use larger learning rates and train deeper networks.
Reference answer
The residual stream accumulates updates from every layer. If sublayer input scales drift, activations and gradients become harder to control and the optimization problem becomes ill-conditioned. LayerNorm or RMSNorm brings each token's sublayer input back to a predictable scale, improving gradient propagation and making deep Transformers easier to train.
Deep dive: residual scale, conditioning, and what “stable” means
If residual updates are temporarily treated as approximately uncorrelated,
$$ \operatorname{Var}(x_L) \approx \operatorname{Var}(x_0)+ \sum_{\ell=0}^{L-1}\operatorname{Var}\big(f_\ell(x_\ell)\big). $$
This explains why residual-stream scale may grow with depth. Real networks contain correlations and adaptive weights, so it is not a theorem that variance must grow linearly. The more precise statement is: depth can introduce scale drift, while normalization controls the input scale of each branch.
From an optimization perspective, a learning rate can be unstable in high-curvature directions yet too small in low-curvature ones when the Hessian has widely separated eigenvalues. Normalization does not guarantee a well-conditioned global Hessian. It does reduce scale disparities between layers and often makes gradients vary more smoothly with parameter perturbations, improving effective conditioning.
Also note that Pre-LN does not keep the residual stream $x_\ell$ itself at unit variance; it only feeds $\operatorname{Norm}(x_\ell)$ into Attn / FFN. Common recipes add a final LN to control the scale passed to the output head, as in the Pre-LN architecture in Table 1 of Xiong et al.. This is an architectural choice, not a mathematical consequence of placing Norm before each branch. When reproducing an existing model, retain the final norm required by its configuration.
From Normalization: BatchNorm, LayerNorm, and RMSNorm · How a model reads, stop 6 of 9Open the note
Why do Transformers usually avoid BatchNorm?Normalization
Reference answer
Quick learning
- Variable length and padding: ordinary
BatchNorm1dtakes no padding mask, so padding enters the statistics. A custom valid-token pool for lengths[3,1]would contain 4 tokens. Only a separate estimate at each position has just one valid sample at the later positions. - Batch-composition dependence: during training, changing neighboring examples changes this token's output, and small batches produce noisy statistics.
- Train/inference mismatch: training uses current-batch statistics, while inference normally uses running statistics. Autoregressive decoding often runs with tiny batches or batch size one, so it cannot rely on statistics computed from the batch at hand.
- Possible causality violation: statistics computed across time from the current sequence let future tokens affect past outputs, bypassing the causal attention mask. Frozen running statistics do not create this path.
The usual Transformer configuration, LayerNorm(d), reduces only over a token's hidden features, independently of the batch, other positions, and train/eval mode. LayerNorm((T,d)) does not: changing the last token can change the first token's output.
Reference answer
Transformers typically use LN over each token's hidden dimension, with the same normalization in training and inference. BN requires handling batch composition, padding, and running statistics; computing statistics across the current sequence also reads future positions. The axes and mode matter, not just the layer's name.
Deep dive: when does BatchNorm really leak the future?
The answer depends on tensor layout and reduction axes; “BatchNorm always leaks” is too broad.
- For $X\in\mathbb R^{B\times T\times d}$, a separate normalization at every position $t$ that reduces only over $B$ does not directly read future tokens from the same sequence. It still depends on other batch members, and each position may have a different valid sample count.
- A common sequence training forward of
BatchNorm1dcomputes current-input statistics over both $B$ and $T$ per channel. Then $\mu_j$ and $\sigma_j$ include tokens with $t'>t$. The normalized result at position $t$ already contains future information; causal attention masking cannot block this separate path. - Flattening $B\times T$ before computing current-input BN statistics has the same problem.
The precise conclusion is:
Computing statistics across the current sequence makes earlier positions depend on future ones. Eval with fixed running statistics does not. BN still requires care with train/eval differences, batch composition, and padding.
Batch size one does not mean BatchNorm must fail at inference: eval mode can use running statistics. The deeper issue is that those statistics came from the training distribution rather than the current token, and training and inference execute different functions.
From Normalization: BatchNorm, LayerNorm, and RMSNorm · How a model reads, stop 6 of 9Open the note
Where do Pre-LN and Post-LN go, and why is Pre-LN more stable?Normalization
Reference answer
Write the structure first
Post-LN (2017 original) Pre-LN (common today)
x = LN(x + Attn(x)) x = x + Attn(LN(x))
x = LN(x + FFN(x)) x = x + FFN(LN(x))
...
x = LN(x) ← final LN
Reference answer
Post-LN places LayerNorm after residual addition, so the main-path gradient crosses an LN in every block. Pre-LN moves the LN into the branch and leaves a direct identity path in the residual stream. Every block Jacobian therefore contains an explicit identity term, making deep gradient propagation more stable. The trade-off is that the residual stream is not normalized after every addition; the standard Pre-LN recipe shown here uses a final LN after all blocks.
Deep dive: the identity path in the Jacobian
Ignoring the multi-branch details, Post-LN is
$$ x_{\ell+1}=\operatorname{LN}\big(x_\ell+f_\ell(x_\ell)\big), $$
with Jacobian
$$ \frac{\partial x_{\ell+1}}{\partial x_\ell} = J_{\operatorname{LN}}\big(I+J_{f_\ell}\big). $$
Across many layers, the gradient repeatedly multiplies by $J_{\operatorname{LN}}$. This does not imply that every layer necessarily shrinks the gradient, but the main path is no longer a pure identity, making training more sensitive to initialization, residual scaling, and learning-rate warmup.
Pre-LN is
$$ x_{\ell+1}=x_\ell+f_\ell\big(\operatorname{LN}(x_\ell)\big), $$
so
$$ \frac{\partial x_{\ell+1}}{\partial x_\ell} = I+J_{f_\ell}J_{\operatorname{LN}}. $$
Even when the branch contribution is small, $I$ remains a direct gradient path. The more careful claim is that Pre-LN significantly reduces the dependence of deep training on warmup; it does not guarantee that every configuration needs no warmup at all. Xiong et al. (2020) used mean-field analysis to show that, at initialization, Post-LN has large expected gradients for parameters near the output layer, which warmup keeps from causing overly large early updates; Pre-LN gradients are well behaved at initialization, and their experiments trained it without warmup. That holds in the paper's setting; it is not a theorem that every configuration must, or need not, use warmup.
Pre-LN has its own trade-off. Residual-stream scale can grow, and later-layer updates may become small relative to the main stream, reducing effective depth. Final LN repairs the output scale, not every expressivity issue.
From Normalization: BatchNorm, LayerNorm, and RMSNorm · How a model reads, stop 6 of 9Open the note
Why can RMSNorm work with re-scaling alone?Normalization
Reference answer
Quick learning
LayerNorm performs both
$$ x\longmapsto x-\mu \quad\text{(re-centering)}, \qquad x\longmapsto \frac{x}{\sqrt{\operatorname{Var}(x)+\epsilon}} \quad\text{(re-scaling)}. $$
RMSNorm removes mean subtraction, usually omits $\beta$, and keeps
$$ x\longmapsto \frac{x}{\sqrt{\frac{1}{d}\sum_jx_j^2+\epsilon}}\odot\gamma. $$
Its success in modern LLMs suggests that controlling vector magnitude and sublayer input scale often matters more than forcing every token's feature mean to zero.
Reference answer
RMSNorm keeps LayerNorm's scale control and learned gain, but removes mean subtraction and bias. It eliminates a mean reduction, simplifying computation and communication. In practice it often retains similar quality, suggesting that re-scaling is usually more important than re-centering.
Deep dive: does RMSNorm prove that the mean never matters?
No. Its success is strong empirical evidence, not a mathematical proof. LayerNorm divides by the standard deviation,
$$ \sqrt{\frac{1}{d}\sum_j(x_j-\mu)^2+\epsilon}, $$
while RMSNorm divides by the square root of the second moment plus epsilon,
$$ \sqrt{\frac{1}{d}\sum_jx_j^2+\epsilon}. $$
“Small mean” must be relative to the vector's scale. Since $\mathbb E[x^2]=\operatorname{Var}(x)+\mu^2$, the denominators are close only when $\mu^2\ll\operatorname{Var}(x)+\epsilon$. The outputs also differ by the centering step.
For example, [0.000001,0.000003] has a small absolute mean. Ignoring epsilon, LN still gives [-1,1], whereas RMSNorm gives about [0.447,1.342]. Scaling the whole input down does not remove the difference. The formulas coincide at exactly zero mean with matching epsilon and affine settings. How a model adapts to a nonzero mean remains a training and architecture question; these equations alone do not establish model quality.
RMSNorm's engineering gain is one fewer mean reduction and less associated synchronization and memory traffic. Implementations normally accumulate sums of squares in fp32 to avoid bf16 or fp16 numerical error.
From Normalization: BatchNorm, LayerNorm, and RMSNorm · How a model reads, stop 6 of 9Open the note
Ask yourself · the answer is in the note
- Why is the gradient of CE with respect to the logits $p-y$, and why does the stable implementation use LogSumExp?ML mathematics
- Why does the subgradient of L1 at zero produce exact sparsity, while L2 usually does not?ML mathematics
- Which loss does the standard bias–variance identity depend on?ML mathematics
- Which regularizers do the Gaussian and Laplace priors correspond to?ML mathematics
- Which Gauss–Markov conditions does BLUE need, and why is normality not required?ML mathematics
- Why do many linear layers with no activation in between still amount to a single linear layer?From linear to neural
- Does sigmoid + cross-entropy really improve expressive power, or optimization behavior?From linear to neural
- How would you use the XOR figures to demonstrate the statement “the hidden layer learns a new coordinate system”?From linear to neural
- Why does multi-label classification use Sigmoid, while mutually exclusive multiclass classification uses Softmax?From linear to neural
- Why do LSTM gates use Sigmoid, while the candidate memory uses Tanh?From linear to neural
- Why is lm_head a linear readout, while the whole Transformer is not a linear approximator?From linear to neural
- What does the universal approximation theorem guarantee, and what does it not guarantee?From linear to neural
- How can a new name be split into known pieces? What extra mechanism is needed if even its characters are unknown?Tokens
- Why can the same sentence cost a different amount of inference when the tokenizer changes?Tokens
- At which step does (B, T) become (B, T, d) ?Tokens
- Why does adding parameters or stacking more RNN layers not automatically solve long-term memory?RNN and LSTM
- Why does the LSTM cell state pass gradients more easily than a plain hidden state?RNN and LSTM
- An LSTM mitigates forgetting, so why is it still unsuited to large-scale parallel training?RNN and LSTM
- Why does it not matter that the source and the target have different lengths?Seq2Seq
- Compared with a fixed context vector, exactly which assumption does attention relax?Seq2Seq
- Why does teacher forcing make training easy yet cause exposure bias at generation time?Seq2Seq
- Why is the attention score divided by $\sqrt{d_k}$?The Transformer architecture
- Once pre-norm moves the norm inside the residual branch, what direct path does the gradient gain?The Transformer architecture
- Why does RoPE's relative property require rotating both Q and K?The Transformer architecture
- How do you prove that a KV cache is implemented correctly, rather than the generations merely "not looking broken"?The Transformer architecture
- Which four parts of the block changed between the original Transformer and Llama 3, and what did each fix?The Transformer, interactively
- Under what conditions can KV be reused, and why can memory bandwidth still limit decoding after computation is reduced?The Transformer, interactively
- What exactly do GQA, MQA and MLA cache? Why is the MLA cache independent of the number of heads?The Transformer, interactively
- With a sliding window each layer sees only $w$ tokens. How does information travel further than that?The Transformer, interactively
- Why is FlashAttention exact, and which kind of cost does it remove?The Transformer, interactively
- What do total and active parameters each scale with in an MoE?The Transformer, interactively
- Write scaled dot-product attention without looking at code, then use two scores to compare masking first with only zeroing weights after softmax.Attention
- Why is the divisor $\sqrt{d_\text{head}}$ rather than $\sqrt{d_\text{model}}$? What happens without it?Attention
- How do the results of view(B,T,H,dh).transpose(1,2) and view(B,H,T,dh) differ? Why does the latter raise no error yet get everything wrong?Attention
- By what factor does multi-head attention multiply the parameter count?Attention
- Why is this an optimization fix rather than an overfitting fix, and what experiment separates the two?Residuals
- What does the $I$ in $\partial y/\partial x = I + \partial f/\partial x$ do during backprop?Residuals
- Why does post-norm break that path?Residuals
- How does residual-stream variance behave with depth, and what are the usual remedies?Residuals
- For activations shaped $B\times T\times d$, which axis does LayerNorm reduce over?Normalization
- Why is “BatchNorm always leaks the future” too broad? Which implementation really leaks?Normalization
- Write Pre-LN and Post-LN and locate the final LN.Normalization
- Why does the Pre-LN Jacobian contain an identity path?Normalization
- What does RMSNorm remove, and does its success prove re-centering never matters?Normalization
- Where do Q/K/V come from in encoder self-attention, decoder self-attention, and cross-attention?The full Transformer
- Why must Q and K share the same final dimension, while $d_v$ may differ?The full Transformer
- Why divide by $\sqrt{d_k}$? What happens to softmax and the gradients without the scaling?The full Transformer
- If $Q=K$ is forced, what property does the raw score matrix have, and how is expressiveness limited?The full Transformer
- Why can Transformer training be parallel while generation is still token by token?The full Transformer
- If positional encoding is removed, exactly what information does the model lose?The full Transformer
- Why do inputs and labels only need to be offset by one token?Decoder-only
- Prefill and decode use the same model, so why are their performance characteristics completely different?Decoder-only
- Do temperature, top-k, and top-p change the model, or the way the model's distribution is read?Decoder-only
How a model learns
Where does $C\approx6ND$ come from? With 64 H100s for 4.6 days, how big a model does Chinchilla suggest?Scaling
Reference answer
For each training token a dense Transformer does about $2N$ FLOPs in the forward pass (one multiply-add per weight) and about twice that in the backward pass, $6N$ in total, multiplied by the number of tokens $D$. It drops the attention term that grows with context; Kaplan's $N$ excludes embeddings, Chinchilla's includes them. The budget is GPUs × peak × MFU × time: $64\times989.4$ TFLOPS (BF16 dense) $\times0.4\times3.95\times10^{5}$ seconds $\approx10^{22}$ FLOPs. At 20 tokens per parameter, $N=\sqrt{C/120}\approx9.1\times10^{9}$ and $D\approx1.8\times10^{11}$. Using the sparse peak would overstate the budget by a factor of two.
Why do Kaplan and Chinchilla give different optimal allocations?Scaling
Reference answer
Kaplan (2020) found $N_{\rm opt}\propto C^{0.73}$; Chinchilla (2022) found 0.46–0.50. Chinchilla points out that all of Kaplan's runs used one fixed-length cosine, so when losses were read off midway the learning rate had not yet decayed, the losses were too high, and the effect of less data was underestimated; Kaplan's models were also small. Pearce and Song show that counting only non-embedding parameters and fitting at small scale pushes the exponent up. Porian et al. start from 0.864 on OpenWebText2 and, correcting last-layer compute, warmup, cosine decay and per-scale hyperparameters (including AdamW's $\beta_2$) in turn, get down to 0.518, and find that Chinchilla's result holds even without learning-rate decay.
Under what conditions does "20 tokens per parameter" hold, and how costly is it to miss?Scaling
Reference answer
It comes from Table 3 of Chinchilla's approach 1 (for example, 1B parameters with 20.2B tokens). Conditions: MassiveText, data seen about once; $N$ includes embeddings and tokens use their tokenizer; a cosine decayed 10x and matched to the run length. The original approach-3 fit favours smaller models, but Besiroglu et al.'s refit also returns to about 20; DeepSeek LLM found that data quality moves the exponent from 0.450 to 0.578. The optimum is flat: on the refit surface at $10^{22}$ FLOPs, a model half or twice the optimal size has a loss only about 0.01 higher, and 15%–26% more compute makes up the gap.
How do you fit a scaling law from a few small runs, and how far can you trust the extrapolation?Scaling
Reference answer
IsoFLOP: 3–5 small budgets, 5–10 sizes each, schedule matched to run length; fit a parabola to loss versus $\log N$, take its minimum, then fit a line through the minima on log–log axes. The teaching points from $(10^{18},9\times10^7)$ to $(10^{21},2.9\times10^9)$ give a slope of about 0.50 and extrapolate to about 9.2B parameters at $10^{22}$. An exponent error of ±0.04 changes a 10x extrapolation by only about 10%, but a 1000x extrapolation ranges from 70B to 121B. Risks: the frontier bends (Chinchilla Appendix E), the law must fail somewhere (Kaplan §6.3), seed noise is about 0.02, and smooth loss does not mean smooth downstream metrics. The successful predictions by GPT-4, DeepSeek LLM and Llama 3 are all self-reported.
Why train Llama 3 8B on 15T tokens? How does inference volume change the optimum?Scaling
Reference answer
Chinchilla minimizes training compute only. Sardana et al. fix a target loss and minimize $6ND_{\rm tr}+2ND_{\rm inf}$: the more inference, the smaller the model and the more data. On the refit surface, targeting the loss of the compute-optimal model at $10^{22}$ FLOPs, $D_{\rm inf}=10^{12}$ gives an optimum of about 4.6B parameters and 447B tokens: 24% more training compute, 23% less in total. Sardana et al. also found that fits on typical ratios overestimate the value of data at extreme ratios, so the savings at very large inference volumes are optimistic upper bounds. The Llama 3 report self-reports that the smaller models were trained far past compute-optimal and do better at the same inference budget, while 405B sits close to its own fitted optimum (402B, 16.55T).
When data runs short, what is repeated training worth?Scaling
Reference answer
Muennighoff et al. convert repetition into effective data: $D'=U_D+U_DR_D^*(1-e^{-R_D/R_D^*})$ with $R_D^*\approx15.4$. 100B unique tokens trained for 4 epochs is worth about 372.6B (93%); 16 epochs about 1.06T (66%); the ceiling is about 16.4 times. The paper concludes that at fixed compute, repeating about 4 times is nearly as good as new data (an 8.7B model at 4 epochs had only about 0.5% higher validation loss), after which returns fall fast. The decay constant for excess parameters, $R_N^*\approx5.3$, is smaller, so when data is limited more passes beat a bigger model.
What is the critical batch size? How should batch size and learning rate be converted together?Scaling
Reference answer
McCandlish et al.: $S=S_{\min}(1+B_{\rm crit}/B)$, $E=E_{\min}(1+B/B_{\rm crit})$, $B_{\rm crit}=E_{\min}/S_{\min}$, roughly the gradient noise scale. With the teaching value $B_{\rm crit}=2$M, going from 4M to 16M saves only 25% of the steps but costs 3 times the data. It grows as loss falls (Kaplan: it doubles for about every 13% drop in loss), and recent work finds it grows mainly with data size (Zhang et al.: with data fixed, growing only the model gives an exponent of just 0.087). Conversion: the linear rule for SGD; for Adam the square-root rule (learning rate times $\sqrt\kappa$, $1-\beta$ times $\kappa$), valid only in the noise-dominated small-batch regime. DeepSeek LLM's fit can serve as a starting point: about $5.5\times10^{-4}$ and 4.6M tokens at $10^{22}$ FLOPs.
What problem does µP solve? Why should the hidden-layer learning rate shrink with width? What does not transfer?Scaling
Reference answer
Under the standard parametrization (SP) the optimal learning rate moves with width (about an order of magnitude from width 256 to 8192 for TP5's MLP). Under the conditions in the hyperparameters chapter—batch size 1, zero-initialized moment estimates, no weight decay, and nonzero gradients much larger than $\epsilon$—Adam's first update is about $-\eta\,{\rm sign}(g)$ and is aligned with the input $x$. For nonzero $\delta_i$, its effect has magnitude $|(\Delta Wx)_i|\approx\eta\,n\,\mathbb E|x|$: with $x=\pm1$ and $\eta=0.01$, the change is 5.12 at width 512 and 40.96 at width 4096. These are magnitudes; the direction also depends on $\operatorname{sign}(\delta_i)$. µP makes the Adam learning rate of hidden and output layers $\propto1/\text{fan\_in}$, sets the output initialization variance to $1/\text{fan\_in}^2$, and uses $1/d$ attention, so the hidden learning rate at width 4096 is 0.00125. What does not transfer: regularization such as dropout and weight decay; depth, batch size and training length are only validated empirically, and multi-layer Transformer blocks face fundamental limits in depth (TP6). Everett et al. found that SP with the right per-layer learning rates also transfers.
Ask yourself · the answer is in the note
- Given GPU count, peak, MFU and days, how do you get to Chinchilla's $N$ and $D$ in one pass? Which step most easily doubles the budget by mistake?Scaling
- Why does Kaplan's fixed cosine length make models trained on less data look worse and push the exponent up?Scaling
- If the fitted exponent is off by 0.04, how large is the effect at 10x and at 1000x extrapolation? Why does the flatness near the optimum make this less alarming?Scaling
- As inference tokens grow from 0 to $10^{13}$, how does the optimal model change? Why are the savings on the right of the table optimistic?Scaling
- When width grows 8 times under SP, by how much does Adam's first step change the activations? How does µP bring it back, and what can it not guarantee?Scaling
How a model is taught
One-sentence distinction: Prompt Tuning also produces K/V at every layer, so why is it different?Model Adaptation
Reference answer
Soft prompts pass through the frozen model like ordinary input embeddings, producing K/V at each layer. Those states all follow from the same set of input vectors and the frozen model's computations. Prefix tuning supplies the per-layer K/V directly. Even if a shared small network generates them, they need not follow the original model's layer-to-layer transformations.
From Model Adaptation: Full Fine-Tuning, LoRA, Prompt Tuning, and DistillationOpen the note
Step 1: can the reward be verified automatically?After PPO
Reference answer
When verification is possible, consider a verifier / RLVR first. Math answers, code tests, and structural constraints can be judged by a stable program without first fitting a Reward Model. Still audit whether the verifier checks only final answers, leaves test loopholes, or fails to represent the actual product objective.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Step 2: can training keep sampling from the current policy?After PPO
Reference answer
With only static chosen/rejected pairs, the DPO family is usually the direct choice, accepting coverage gaps and distribution mismatch. If training can keep rolling out and obtaining rewards or environment feedback, an online method such as PPO or GRPO can discover the current policy's new failures. It costs more generation compute, system complexity, and optimization variance.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Step 3: what is the real systems or optimization bottleneck?After PPO
Reference answer
If Critic memory, compute, or stability is the bottleneck, consider critic-free methods such as GRPO or RLOO. If long responses are diluted, low-probability tokens cannot recover, or entropy keeps falling, consider DAPO's token-level loss, Clip-Higher, dynamic sampling, and length handling. Do not choose an algorithm name first and force the data to fit it afterwards.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Is the reward learned or verified, and what should each monitor?After PPO
Reference answer
For a learned Reward Model, monitor reward hacking, length or style shortcuts, and whether agreement with human judgment decays as the policy drifts. For a verifier, audit the specification gap: whether tests cover the real requirement, final-answer checking rewards guessing, or the model can exploit formatting and execution loopholes.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
What fraction of GRPO groups are all-right or all-wrong?After PPO
Reference answer
Log the zero-variance group rate directly (problem one above explains why these groups carry no signal). If the rate is high, adjust problem difficulty, group size, or reward resolution, or use dynamic sampling to filter uninformative groups—while monitoring the distribution shift caused by filtering.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
What bias do reward and length normalization introduce?After PPO
Reference answer
Plot reward, correctness, response length, entropy, and within-group reward variance together. Group-standard-deviation normalization changes the weight of low-variance groups; response-length averaging can dilute tokens in long sequences. If length rises while correctness stays flat, the model may be exploiting normalization or a reward shortcut.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Are long-response tokens being outweighed by short responses?After PPO
Reference answer
First determine whether the loss uses a per-sequence mean or batch-wide per-token aggregation. If every response has equal total weight, a token in a 1000-token answer usually receives less weight than one in a 50-token answer. Long-reasoning tasks may need token-level loss aggregation and both response-level and token-level metrics.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Which policy produced the DPO preference data, and why does it matter?After PPO
Reference answer
Record the generation checkpoint, sampling temperature, decoding constraints, and annotation date. Old pairs may miss errors that the updated model now makes, but policy distance alone does not tell you how well the data covers those errors. Look for actual gaps on held-out prompts before deciding to resample, relabel, or move to an iterative / online preference loop.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Write the three central equations for PPO, GRPO, and DPO.After PPO
Reference answer
With Monte Carlo returns, PPO can use $\hat A_t=G_t-V_\phi(s_t)$; GAE additionally involves bootstrapping. The clipped surrogate flattens selected gains; it does not hard-bound the resulting ratio or KL after an update. GRPO commonly uses $\hat A_i=(R_i-\mu_R)/(\sigma_R+\varepsilon)$. DPO uses $-\log\sigma\!\left(\beta[\Delta_w-\Delta_l]\right)$, where each $\Delta$ is the current policy's log-probability change relative to Reference.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Why does GRPO remove the Critic but not rollout?After PPO
Reference answer
It still needs the current or recent policy to generate multiple responses to one prompt and score every response; otherwise there is no group-relative baseline. What disappears is the Critic that learns $V_\phi(s)$.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Why does DPO need no explicit Reward Model?After PPO
Reference answer
Under the support and integrability conditions above, the optimal policy for a KL-regularized objective with fixed $\beta>0$ can be inverted to give the reward: $r=\beta\log(\pi^*/\pi_{\mathrm{ref}})$ plus a term that depends only on the prompt. Subtracting two responses to the same prompt cancels that term, so the reward difference becomes the difference of chosen/rejected policy-to-reference log-ratios. Reward did not vanish; it is implicit in the DPO loss. See the derivation above.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
Two-minute conclusion: can DPO fully replace PPO?After PPO
Reference answer
Not in general. Ask where data comes from and when feedback is refreshed. Offline DPO does not collect new failures by itself; PPO / GRPO usually generate and score responses during training. Online DPO can refresh preference data too, so online versus offline and preference loss versus policy gradient are separate choices. Count the whole cost as well: offline DPO avoids online generation during training, but collecting and labeling the pairs still costs something, while PPO / GRPO pay for generation and more system coordination. Compare cost, coverage, and evaluation on matched tasks and budgets rather than ranking the names.
From PPO, GRPO, and DPO: turning feedback into an update · How a model is taught, stop 7 of 8Open the note
What roles appear in typical PPO-style RLHF, and which train?RLHF
Reference answer
The four common roles are Actor, Critic, Reward, and Reference; they do not require four full models to be resident simultaneously. Actor and Critic update weights in this setup. Reward is frozen after stage 2; Reference is a frozen SFT copy. Actor and Reference start identical, but only the Actor changes as policy training proceeds.
Why are the reference model and KL penalty needed? What happens if you remove them?RLHF
Reference answer
Preferences learned from limited data may not generalize to later policy outputs. Stronger optimization can find high-scoring answers that people do not actually prefer, such as accommodating a stylistic bias instead of improving the answer.
Reference KL adds a cost for deviating from an anchor. Increasing $\beta$ generally strengthens that cost, but its effect also depends on reward scale. Removing KL does not guarantee collapse, and retaining it does not guarantee freedom from reward hacking. Compare its presence and coefficient with independent evaluation rather than treating a nonzero coefficient as a law. See Reference and Critic for the derivation and numerical example.
What is the Critic for, and how does GRPO avoid it?RLHF
Reference answer
The Critic estimates state value $V_t$ to construct advantages such as $\hat A_t=\hat G_t-V_t$. A suitable baseline can reduce variance; TD or GAE also introduces a bootstrapping bias tradeoff. Training without a Critic is still possible; REINFORCE is one example.
GRPO constructs relative signals from answers to the same prompt instead of training a separate Critic. It saves Critic-related costs but requires group sampling; all-correct or all-wrong groups (see DAPO's dynamic sampling), reward scales, and length normalization still matter. Counting fewer models does not establish lower total training cost.
What is the key difference between DPO and PPO?RLHF
Reference answer
DPO uses a derivation: a KL-regularized reward objective with fixed $\beta>0$ has a closed-form optimum under the policy-support and integrability conditions. This is not a per-update guarantee of a fixed KL radius. The reward can then be rewritten in terms of the policy and the preference loss differentiated directly. Standard offline DPO therefore trains no separate reward model and runs no online RL loop; the reward difference is implicit in the loss. See the DPO derivation for the full objective and conditions.
One limitation of standard offline DPO is its fixed preference dataset. The policy changes while the data does not, so training cannot actively explore the current policy's new failures. PPO and other online RL methods resample from the current policy and are more natural for exploration, environment interaction, or verifiable multi-step outcomes, but rollout is expensive and training less stable.
DPO therefore cannot replace PPO everywhere, but PPO is not universally better either. Use DPO when high-quality static preferences cover the task; use online methods when the current policy must keep producing new evidence. Online DPO variants reinforce that the real distinction is the data-and-feedback loop, not only the loss name.
Can reward-model scores be compared directly?RLHF
Reference answer
Bradley–Terry directly constrains the gap between chosen and rejected answers to the same prompt. Adding a constant to every score leaves the loss unchanged, so the zero point has no identifiable meaning; a score of $2.4$ is not “2.4 units of satisfaction.”
A fixed Reward Model's raw outputs can of course be used numerically, but comparisons across prompts, domains, or model versions require evidence that calibration and scale are stable. Implementations may also whiten or normalize rewards; that is an optimization choice, not a rule implied by Bradley–Terry.
Why is independent evaluation still needed with a verifier?RLHF
Reference answer
A verifier only checks the conditions implemented in it. Incomplete tests, faulty answer extraction, or missing boundary cases can reward incorrect outputs. A deterministic program need not express the full task correctly.
RLVR fits tasks or subgoals with automatically checkable outcomes. Open-ended dialogue can also use format or tool-argument checks, but these do not cover all aspects of answer quality. Reserve independent problems, different test families, and human review where needed to distinguish task learning from checker exploitation. Verifiable rewards starts from a worked counterexample: a constant-output “solution” that passes a single sorting test.
Ask yourself · the answer is in the note
- Why does a soft prompt not correspond to vocabulary tokens, and why can it usually not be read as words?Model Adaptation
- Where do Prompt Tuning and Prefix Tuning inject their parameters?Model Adaptation
- Why is “LoRA versus SFT” an incomplete comparison?Model Adaptation
- How can a generative classifier be forced to return only legal enum values?Model Adaptation
- What information does response distillation lose compared with token-distribution distillation?Model Adaptation
- What each role does in typical PPO-style RLHF, and why four roles do not imply four resident weight copies.RLHF
- What the reference KL and the old-policy ratio each compare the current policy against.RLHF
- What the Critic helps estimate, and what tradeoffs GRPO makes by not training one.RLHF
- Why DPO needs no reward model, and what it gives up for that.RLHF
- For PPO-style clipping, which two combinations of advantage sign and ratio crossing make the local gradient zero?RLHF
How a model runs
Does temperature act on the logits or on the probabilities? Why?Decoding
Reference answer
On the logits, before the softmax: $p_i = \text{softmax}(z_i/T)$.
Given the original softmax probabilities, $p_i^{1/T}/\sum_j p_j^{1/T}$ is mathematically equivalent to $\operatorname{softmax}(z/T)$: the common normalization factor cancels. Implementations usually keep logits to avoid probability underflow. Multiplying all probabilities by the same coefficient and renormalizing changes nothing.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
How do top-k and top-p differ in the number of candidates they retain?Decoding
Reference answer
Top-k keeps a fixed $k$ candidates; top-p keeps the smallest set whose cumulative probability just reaches $p$.
The difference is whether the candidate pool changes with the distribution. Top-p can retain few tokens when it is concentrated and many when it is flat. Adaptation does not guarantee quality: a confidently wrong model can still put high probability on the wrong token.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
Why can beam search find a higher-scoring but worse answer?Decoding
Reference answer
Model likelihood is not task quality; open-ended generation needs checks for repetition and diversity. Beam search is finite-width approximate search, not a global optimizer. Translation and summarization also admit multiple valid answers. Compare with sampling, reranking, or verification under the same budget.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
Are temperature=0 and greedy the same thing?Decoding
Reference answer
With a unique maximum logit, probability concentrates on that token as $T \to 0^+$. Tied maxima share the limiting probability, while greedy implementations typically use a fixed tie-breaking rule.
The formula cannot take $T=0$: it would divide by zero. Some APIs use zero as a shortcut for greedy decoding; others select greedy through a separate option. With fixed logits and a fixed tie-breaking rule, argmax is deterministic. Different kernels or batching can change the computed logits slightly, which can change the winning token when scores are close.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
Which acts first: temperature, top-k, or top-p? Does the order affect the result?Decoding
Reference answer
This article uses temperature → top-k → top-p. Check the framework; interchanging arbitrary steps does not preserve the configuration.
Positive temperature preserves the top-k candidate set: it does not change ranking, provided ties use the same rule.
It does matter for top-p: top-p looks at cumulative probability; temperature changes each token's relative share, so the number of tokens needed to accumulate to $p$ changes. Measured with the same top_p=0.9: at $T=0.7$, temperature first gives 4 candidates and temperature last gives 5; at $T=1.5$ it is 6 versus 5. At $T=1$ the two are equal — so testing only at the default temperature will not reveal it.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
What is the difference between the frequency penalty and the presence penalty?Decoding
Reference answer
Both act on the logits: $z_i \leftarrow z_i - \alpha_p\mathbb{1}[c_i>0] - \alpha_f c_i$.
With positive coefficients, the presence penalty charges the same amount after 1 occurrence or 10. The frequency penalty charges in proportion to the count. These change relative token probabilities; neither guarantees a change of topic or less repetition of the same idea.
Both also hit tokens that are supposed to repeat — punctuation, pronouns, code indentation and brackets, a person's name that recurs in the text. Turned up too high, the output becomes awkward, and code generation is especially easy to break.
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
How should the sampling parameters be set for rollouts in RL training?Decoding
Reference answer
First identify the actual rollout distribution $\mu$. An untransformed old policy is an easy baseline to audit. Other sampling settings can be deliberate, but the target policy, recorded probabilities, and correction method must be explicit.
In ordinary PPO, the denominator is the old policy that collected the batch, not the current updating policy. Treating samples from $\mu$ as samples from an untransformed old policy changes the estimator. Also check support: actions with zero probability under $\mu$ cannot be recovered from this batch (the same issue in offline estimation is covered in OPE estimators).
From Decoding strategies: temperature, top-k, top-p · How a model runs, stop 1 of 9Open the note
What do W4A16, W8A8 and an FP8 KV cache each buy? When do you pick which?Quantization
Reference answer
W4A16 compresses only the weights: it saves memory and cuts the bytes read per decode step, so at small batch the speedup is almost proportional to the bytes saved, but after dequantizing it still computes on 16-bit Tensor Cores and gains nothing once compute-bound. W8A8 (INT8 or FP8) compresses the activations too: besides halving the bytes, it uses 8-bit Tensor Cores, doubling the H100 SXM5 dense peak from 989.4 to 1,978.9 TFLOPS, so prefill and large batches get faster. FP8 KV compresses the KV cache: at long context its bytes often exceed the weights; one 128K sequence of the teaching model is 16 GiB, and in FP8 the number of sequences that fit on an 80 GB GPU goes from 3 to 6. Work out first whether the bottleneck is weight bytes, compute or KV, then choose.
Why can one outlier ruin per-tensor INT4? How much do per-channel and per-group fix? Why can activations not have per-input-channel scales?Quantization
Reference answer
The step is set by the largest value among the numbers sharing a scale. In the 8-weight example, with a maximum of 1.40, $s=0.2$ and the MSE over all eight weights is 0.0042; with 14.0 instead, $s=2$, the other 7 values all round to 0 and the eight-weight MSE is 0.2592. Comparing only the same seven unchanged values gives 0.0048 → 0.29623; either consistent denominator gives about 61.7×. Grouping confines the damage to one group; it does not remove the outlier. The weights' output channels and the activations' tokens are the outer dimensions of the GEMM, so their scales can be applied after the integer matrix multiplication; the activations' input channels are the summed dimension, so the scale would change partway through the dot product, which cannot be inserted into the Tensor Core's integer accumulation. LLM activation outliers sit precisely in a few fixed input channels, which is why SmoothQuant uses an equivalent transformation.
How does the error of FP8 (E4M3) differ from INT8? And how do MXFP4 and NVFP4 differ?Quantization
Reference answer
INT8's grid is evenly spaced, so its absolute rounding-error bound is constant within the unclipped range. E4M3 has 8 grid points in each normal power-of-two interval: for scaled values in the normal range, without overflow or clipping, the round-to-nearest relative error is bounded by about 6.25%. Subnormal values are different: at scale 1, $0.001$ rounds to $2^{-9}$ with 95.3125% relative error, and underflow to zero gives 100%. Quantizing $[0.02,-0.3,1.7,12]$ per tensor, 0.02 becomes 0 in INT8 but has a 0.45% error in E4M3, while 1.7 is more accurate in INT8. Qualcomm's conclusion is that it comes down to outliers: FP8 is better when a distribution has significant outliers, INT8 when it is well behaved. At 4 bits both need block scaling: MXFP4 shares one power-of-two scale (E8M0) across 32 values, 4.25 bits on average; NVFP4 uses one E4M3 scale per 16 values times a tensor-level FP32, 4.5 bits on average. For the block $[0.3,-1.2,2.4,5.0]$, the MX scale can only be 1, 5.0 reads back as 4, and the MSE is 0.31; the NVFP4 scale is 0.8125 and the MSE is about 0.0072.
Why does the roofline estimate predict a W4A16 speedup above threefold at batch 1, but no speedup at large batch? How do you estimate the crossover?Quantization
Reference answer
Under the main text's hardware-peak assumptions and without KV cache, BF16 batch-1 decode does about 1 operation per byte read, so its time lower bound is roughly weight bytes divided by bandwidth. The teaching 8B model is 16 GB and 4.77 ms in BF16; W4A16 g128 (output layer kept in BF16) is 4.87 GB and 1.45 ms, a predicted 3.29× speedup, short of 4× because of the uncompressed output layer and scales. W4A16 computes in BF16, so its compute-time lower bound at batch $B$ is $B\times2N/(989.4\times10^{12})$ seconds. Equating this to 1.45 ms gives $B\approx90$. W4A16 becomes compute-bound first; BF16 does so at about 295. Only once both face the same compute ceiling does the model predict no speedup. FP8 W8A8 also crosses over at about 295: its quantized layers have roughly twice the peak compute, but retaining the BF16 output layer limits whole-model throughput to about 1.88×. Actual results also depend on dequantization, kernels, activations and KV traffic. Marlin self-reports close to 4× up to batch 16–32, declining thereafter; Kurtic et al. recommend W4A16 for synchronous low-latency serving and W8A8 for high-throughput continuous batching.
How does GPTQ compensate for quantization error? How does AWQ's idea differ?Quantization
Reference answer
GPTQ minimizes $\|WX-\hat WX\|^2$ layer by layer, with Hessian $H=2XX^\top$; after quantizing a weight, it updates the unquantized weights by $\delta_F=-\frac{w_q-\mathrm{quant}(w_q)}{[H_F^{-1}]_{qq}}(H_F^{-1})_{:,q}$. With two highly correlated inputs, $w=[0.62,0.37]$ and step 0.25: RTN gives $[0.5,0.25]$ with a sum of squared output errors of 0.353; GPTQ first quantizes $w_1$ to 0.5 and pushes its 0.12 error onto $w_2$ via $H_{12}/H_{22}\approx1.01$, giving $[0.5,0.5]$ and an error of 0.00176. In engineering terms, it scales to 175B by sharing one $H^{-1}$ through a fixed order, lazy updates in blocks of 128 columns, and a Cholesky decomposition. AWQ does not change rounding directions; it finds important channels by activation size, multiplies their weights by $s$ and divides their inputs by $s$, grid-searching $s=s_X^{\alpha}$; it needs less calibration data and is steadier across domains (perplexity up 0.5–0.6 on OPT-6.7B, against 2.3–4.9 for GPTQ).
How does SmoothQuant make W8A8 work? What does $\alpha$ do?Quantization
Reference answer
Activation outlier channels leave ordinary channels with only two or three grid points under per-tensor or per-token quantization, and per-input-channel activation scales cannot enter an INT8 GEMM. SmoothQuant applies the equivalent transformation $Y=(X\operatorname{diag}(s)^{-1})(\operatorname{diag}(s)W)$ with $s_j=\max|X_j|^{\alpha}/\max|W_j|^{1-\alpha}$, moving difficulty from activations to weights, and folds $\operatorname{diag}(s)^{-1}$ offline into the previous layer. At $\alpha=0.5$, every channel on both sides ends up with maximum $\sqrt{\max|X_j|\max|W_j|}$; in the teaching example channel 1 goes from about 3 usable grid points to about 40, and the relative output error drops from 1.95% to 0.15%. Too small an $\alpha$ leaves activations hard to quantize, too large makes weights hard; on OPT-175B, 0.4–0.6 works best.
Why does KIVI quantize keys per channel and values per token? Is that the only option?Quantization
Reference answer
KIVI observed that keys have a few fixed channels with very large magnitudes, values have no clear outlier pattern, and the attention output comes mainly from the values of a few important tokens. Quantizing keys per token lets the outlier channel stretch each row's step: the 4×4, 2-bit example uses each group's real-valued minimum as its offset, not an integer zero-point that preserves zero exactly. Under that convention, the ordinary channels all collapse to one value and the scores go from $[1.2,0.9,0.9,1.6]$ to $[0.3,-0.1,-0.8,0.6]$; per channel, the largest error is only 0.067. The relative error of $K$ itself, 8.6% against 0.6%, understates how badly the scores are damaged. In KIVI's Llama-2-7B results at 2 bits, GSM8K is only 0.83 with both per token, against 12.74 for KIVI-2 (13.50 at 16 bits). This does not make the grouping universal: QuaRot rotates keys, then quantizes channel groups within each token and head. Choose the layout for the resulting distribution and kernel. In deployment, watch the engine's defaults too: vLLM sets all KV scales to 1.0 without calibration.
How do you decide whether a quantized model is ready to use? Why is accuracy alone not enough?Quantization
Reference answer
When accuracy barely changes, many individual answers can still flip between right and wrong. Dutta et al. measured GPTQ W4A16 on Llama2-70B-chat losing only 0.45 points on MMLU while 4.26% of answers flipped. Check three things: mean KL and top-1 agreement on fixed text, since a flip at a near-tied position makes the rest of the text diverge; paired results on the same questions, where the example with 1,000 items, 56 flips and a net change of −0.4 gives a 95% interval of about $[-1.87,+1.07]$ points; and slices defined in advance, including long context (4-bit methods lose up to 59 points), non-English (Japanese, 1.7% on automatic metrics against 16.0% by human judgment), and math reasoning.
Also record whether calibration data overlaps the evaluation, the format and scales of each part, and the engine and kernels. Without support for the chosen format, the engine falls back to weight-only quantization.
Ask yourself · the answer is in the note
- At which step does temperature act? Why is multiplying the probabilities by a coefficient useless?Decoding
- With the same 0.9, how large is the top-p candidate pool on a steep distribution and on a flat one?Decoding
- On which tasks is beam search appropriate, and on which does it tend to fail? Why?Decoding
- After changing rollout sampling, what must agree between log-probs and the training objective?Decoding
- Given a 70B model and one 80 GB GPU, how much do BF16, FP8 and INT4 g128 weights take, how much is left for KV, and what is the batch-1 floor per token?Quantization
- Why can a weight's output-channel scale be applied after the GEMM, while scales grouped along the input dimension need dequantization inside the kernel or Blackwell's block-scaled MMA?Quantization
- The MX specification sets the block scale to the power of two not exceeding the maximum; what happens to FP4 elements when the block maximum is 3.5? Why does the MXFP8 training recipe round up instead?Quantization
- At 128K context and batch 3, by how much do the bytes read per step fall when only the weights are compressed, and when only the KV is? Why does the conclusion flip at short context?Quantization
- After a quantization, which fields would you record and which metrics and slices would you report, so others can reproduce it and believe that "not much was lost"?Quantization
How the hardware computes
Why is a process node name such as "7 nm" or "N4" not a physical size? What should you compare when comparing two chips?AI infrastructure
Reference answer
Early node names roughly matched a physical dimension of the transistor; today a node name is closer to the name of a process generation. A 2020 IEEE Spectrum article points out that most critical features of a "7 nm" transistor are much larger than 7 nm, and describes LMC, an alternative metric proposed by Wong and colleagues (logic density, memory density, and the density of connections between them). Vendor figures need their baseline checked: TSMC calls N4 an enhanced version of N5, and N4P's "11% performance boost" is relative to N5; N2P versus N3E is 18% faster at the same power or 36% lower power at the same speed, which usually cannot be had at once. NVIDIA's 4N and 4NP are custom processes, and no public statement was found on how they differ from TSMC's public N4 family.
So the node name is only a starting point; in the end, compare measured performance, power and cost on the same workload. The constraint that really caps a single die is the exposure field: 26 mm × 33 mm, or 858 mm², and the GH100's 814 mm² already takes 95% of it. See How chips are made.
Why is batch-1 decode limited by memory bandwidth? What does a larger batch change, and what does it not change?AI infrastructure
Reference answer
To generate one token, each weight does a single multiply-add (2 FLOP) but costs 2 bytes to read in BF16, an arithmetic intensity of about 1 FLOP per byte; the H100 SXM5's ridge point is its dense BF16 989.4 TFLOPS divided by 3,352 GB/s, about 295. A 7B model's BF16 weights are about $1.4\times10^{10}$ bytes; reading them once takes at least 4.18 ms, so a single request tops out at about 239 tokens/s, while the arithmetic itself needs only 0.014 ms.
A larger batch shares the weights: counting weights only, the intensity is roughly the batch size $B$, and while $B$ is below about 295, step time barely changes and throughput grows linearly with $B$. What cannot be shared is the KV: every request has its own, and the attention part has an intensity of only about 4 FLOP per byte, independent of the batch. With a 4096-token context per request, the step lower bound is already 14.4 ms at $B=64$, for a throughput bound of about 4,440 tokens/s; at $B=128$ the weights plus KV take about 77 GiB. KV bandwidth and capacity run out before compute does. See Performance.
What determines a kernel's occupancy? Is higher always better?AI infrastructure
Reference answer
Occupancy is the number of active warps on an SM divided by the maximum number of warps that SM can hold, and it is set by whichever resource runs out first. At compute capability 9.0 (for example the H100), each SM holds at most 2048 threads (64 warps), 32 blocks, 65,536 32-bit registers and 228 KB of shared memory. With 256 threads per block: 32 registers per thread fits 8 blocks, 100%; 64 registers leaves 4 blocks, 50%; 48 KB of shared memory per block also gives 4, 50%; 80 registers leaves 3, 37.5%. Registers are also rounded up to 256 per warp; for a real kernel, read usage with nvcc --resource-usage and check with Nsight Compute or cudaOccupancyMaxActiveBlocksPerMultiprocessor.
Occupancy answers "are there enough warps to switch between", not "is this kernel fast". The Best Practices Guide says that past a certain point, higher occupancy does not improve performance; high-performance matrix-multiply kernels often use many registers per thread with low occupancy, hiding the wait with instruction-level parallelism and asynchronous copies (hardware async copy from Ampere, TMA on Hopper). Latency can be hidden; the bandwidth ceiling cannot. See CUDA and GPU architecture.
What is memory coalescing, and why does strided access waste bandwidth?AI infrastructure
Reference answer
Global memory moves data in 32-byte units. When a warp executes one load, the hardware coalesces the 32 threads' addresses and issues one transaction per 32-byte segment touched. With each thread reading one float32 and an aligned start: adjacent threads reading adjacent elements use 4 segments, all 128 bytes; offsetting the start by one element takes 5 segments, 80% used; at stride 32 each thread gets its own segment, so 1024 bytes are moved for 128 used, 12.5%. Reading a row-major matrix by column is exactly this case.
Segment counts are not time: the Best Practices Guide measured the offset copy on a V100 at about 9/10 of the aligned bandwidth, not the 4/5 the segment count suggests, because neighbouring warps reuse data already pulled into cache. When debugging, check sectors/request in Nsight Compute: ideal is 4 for 32-bit accesses, close to 32 at stride 32. The fix is to make threadIdx.x index the lowest dimension of the address. See CUDA.
How do dense and sparse datasheet numbers differ? What must you align before comparing two GPU generations?AI infrastructure
Reference answer
Sparse figures come from 2:4 structured sparsity, introduced with Ampere: when at most 2 of every 4 values are non-zero, Tensor Core throughput doubles, which an ordinary dense model does not get. The H100 product page's BF16 1,979 TFLOPS is marked with sparsity; whitepaper V1.04's dense value is 989.4 TFLOPS. But you cannot always divide by 2: the GB300 NVL72 page lists FP4 as 1,440 (sparse) versus 1,080 (dense).
Three more things need aligning: the SKU (both are H100, but the SXM part has 80 GB and 3.35 TB/s, the NVL part 94 GB and 3.9 TB/s); the unit counted (a GB200 superchip is 1 Grace plus 2 GPUs, and the HGX page gives 8-GPU totals); and preliminary versus final specs (the 2022 Hopper blog's 1,000 TFLOPS and 3,000 GB/s were preliminary). Once aligned, from V100 FP16 to GB300 NVFP4 the dense peak rose 120× while memory bandwidth rose only about 9×, so for read-heavy, compute-light work such as decode, generational speedups mostly follow bandwidth. Official pages also disagree with each other: Rubin's per-GPU memory bandwidth, for example, is given as both 22 and 19.2 TB/s. See NVIDIA GPU generations.
What does MFU measure? How does it differ from GPU utilization in nvidia-smi, and from HFU?AI infrastructure
Reference answer
MFU was introduced in the PaLM paper: observed tokens/s divided by the tokens/s the hardware could reach in theory at peak FLOPs. The theoretical value counts only the operations required for the forward and backward passes (about $6N$ per token for a dense decoder, plus $12LHQT$ for the attention matmuls), not recomputation. HFU also counts recomputation, depends on the implementation and is not suited to cross-system comparison; the paper reports an MFU of 46.2% and an HFU of 57.8% for PaLM 540B. nvidia-smi utilization is something else again: NVML defines it as the fraction of the sample period during which at least one kernel was running.
Change the basis and the number changes. In one teaching example (a 7B model on 8 H100 SXM5s at 72,018 tokens/s): counting only $6N$ gives 38.2%, adding attention gives 44.1%, HFU with full recomputation is 50.9%, and wrongly using the sparse peak as the denominator gives only 19.1%. When reporting MFU, state whether attention is counted, which precision the peak refers to, dense or sparse, and whether tokens/s includes padding. See Performance.
What does torch.compile fuse, and why does that make things faster?AI infrastructure
Reference answer
In eager mode, y = torch.relu(x @ w + b) is 3 ATen operators and at least 3 kernels: each operator goes through a Python call, the dispatcher, output allocation and kernel submission, and each elementwise operator reads and writes its intermediate result in memory. torch.compile has TorchDynamo capture an FX graph (with guards, recompiling when they fail; unsupported Python causes a graph break), AOTAutograd capture the backward pass ahead of time, and TorchInductor generate Triton code for the GPU and fuse kernels.
What it saves is not multiplications. With 4096×4096, BF16 and a teaching bandwidth of 2 TB/s: eager's add and relu read and write 128 MiB, about 67 µs; one fused kernel moves 64 MiB, about 34 µs; with bias and ReLU both in the GEMM epilogue there is no extra traffic. At a teaching compute of 500 TFLOP/s the GEMM itself is about 275 µs, so eager's elementwise part is about 24% of it. With $M$ cut to 8, the bytes become negligible and the saving is mostly CPU submissions; reduce-overhead uses CUDA Graphs to merge a chain of submissions into one. The costs are first-call compile time, recompilation when shapes change, and graph breaks. See Frameworks.
Why does distributed training on Kubernetes need gang scheduling?AI infrastructure
Reference answer
The default kube-scheduler places one Pod at a time, but distributed training needs every rank present before it can start; and a GPU is an extended resource that comes only in whole numbers and cannot be overcommitted. Work it by hand: 3 nodes with 8 GPUs each; in order, two 4-GPU jobs arrive, then a 16-GPU training job T16 (2 Pods of 8 GPUs each), then an 8-GPU job T8. Default scoring looks only at CPU and memory, so the two 4-GPU jobs may land on different nodes; one T16 Pod takes the third node and the other does not fit, so the half that started holds 8 GPUs while waiting; the two remaining halves of 4 free GPUs cannot form T8 either. Only 8 of 24 GPUs are working, and another T16 would also queue. Two jobs waiting on each other require an extra condition: with only two whole nodes available for training and the third occupied long-term, each T16 may hold one node and wait for its other half. Deadlock then requires that no resource release, timeout-based reclamation or preemption resolves the wait; the original table's fragmentation does not establish this by itself.
Gang scheduling binds nothing if the whole group does not fit, leaving the third node for T8, so 16 GPUs work; adding GPU bin packing (MostAllocated with GPU weighted) packs the two small jobs onto one node, and all 24 work, with T8 now queued. There are several implementations: core Kubernetes gang scheduling is beta and off by default in v1.37; Kueue uses waitForPodsReady to evict and requeue on timeout; Volcano uses the PodGroup's minMember. Note that "gang scheduling" in the Slurm docs means time-slicing, not all-or-nothing. See Kubernetes.
Ask yourself · the answer is in the note
- why, at the same $D_0=0.1$ per cm², a monolithic 800 mm² die gives about 29 good dies per wafer while two 400 mm² halves give 48 pairs, and which costs that arithmetic leaves out;AI infrastructure
- why tiling cuts a matrix multiply's global reads from $2n^3$ to $2n^3/T$, yet the Best Practices Guide's V100 example only raises effective bandwidth from 119.9 GB/s to 195.5 GB/s;AI infrastructure
- what basis NVLink 900 GB/s, PCIe 128 GB/s and InfiniBand 400 Gb/s are each quoted on, and how far apart HBM and the network card are once all are converted to bytes per direction;AI infrastructure
- why, for a 70B model at batch 1, FP8 on one H100 and BF16 on two H100s share the same 20.9 ms per-token floor, and why two A100s are slower than five V100s;AI infrastructure
- why, with the busbw values assumed in the text, the same 14 GB of BF16 gradients take only about 1.9% of a step to all-reduce on one 8-GPU node but 18% on two 8-GPU nodes, how much of that DDP buckets can hide, and why tensor parallelism cannot hide it.AI infrastructure
Agents
What is the difference between a workflow and an agent? When should you not use an agent?Agents
Reference answer
A workflow chains models and tools along code paths written in advance; an agent lets the model decide the process and the tools. When the steps can be listed in advance, when there is no verification signal, or when a wrong step is costly (sending, paying, deleting), do not reach for an agent directly: write a workflow first, or add a person's confirmation at the critical steps.
What parts make up an agent?Agents
Reference answer
A model (decides the next step), tools (act on the world), a loop (results go back to the model), and a stopping condition (done, or out of budget), plus a context or memory holding intermediate state. ReAct's "think a step, take a step" is the most common form of the loop.
Why is coding one of the most mature settings for agents?Agents
Reference answer
Because its verification signal is the strongest: code runs, tests pass, every step gets objective feedback, and the agent can try again in a sandbox, with a person still reviewing the diff once tests pass. Settings such as customer support or personal assistants are much harder to judge automatically and lean more on rules, permissions, and people. Even in coding, passing tests does not mean the change is right.
How do you evaluate the reliability of a customer-support agent?Agents
Reference answer
Not by single-run success alone: check whether the same task succeeds in every one of several independent repeats, as with τ-bench's pass^k (the probability that all k runs succeed). Also check policy compliance, whether tool calls are correct, whether hard cases are handed to a person, and read complete run traces rather than only the final answer.
When do you use a frontier API, and when do you self-host an open model?Agents
Reference answer
Compare specific models, tools, and deployment configurations on your own end-to-end evaluation set. If one open model misses the bar, evaluate stronger candidates, including frontier APIs; neither openness nor hosting method guarantees sufficient capability, and open-weight models can also run behind hosted APIs. If data has strict boundaries, first check whether an API's region, retention, contracts, and private connections satisfy them; consider self-hosting if they cannot. With high, steady traffic, spare compute, or deep customization needs, self-hosting may be cheaper and more controllable once idle capacity, operations, and maintenance are counted; there is no universal volume threshold. At low or uncertain volume, start on an API that meets the data requirements and measure quality and cost. In practice they are often mixed: routing, cascades, distillation, fallback. See model selection and routing for the comparison process.
Why does a small gap in per-step accuracy grow large in an agent?Agents
Reference answer
If steps are independent and any failure is unrecoverable, errors compound: at 95% per step, all 20 steps are right only about 36% of the time; at 99% per step, about 82%. Real errors correlate and systems can retry or recover, so the product is a warning that motivates end-to-end evaluation and recording where failures happen, not a prediction.
What is reward hacking? Give two examples.Agents
Reference answer
A model optimizes the reward you actually give it, not the goal you had in mind, and any gap between the two gets exploited. In OpenAI's boat race the reward was the pickups along the course, so the agent spun in a circle farming them and outscored finishing the race. LLMs do the same: reward "the tests pass" and an agent may edit the tests; in RLHF, if the reward model favors long or agreeable answers, the policy learns to write longer and flatter more.
Cascades and routers both split requests between a small model and a frontier one. What is the difference?Agents
Reference answer
A cascade lets the small model answer first and decides whether to escalate after seeing the answer. The answer provides an additional signal, but better decisions depend on how well the checker works on the actual tasks. Escalated requests pay for the first answer, the check, and the second answer, and wait for them in sequence. A router decides before any answer exists. Without retries or fallback, it generates one candidate answer, plus the routing overhead. This can avoid the wait for trying a small model before escalating, but end-to-end latency still depends on the router, the selected model, queues, and recovery. Output checks or fallback can catch misrouting; their costs and delays count too. Compare quality, full cost, and latency on the same tasks rather than inferring a winner from the decision point alone. See FrugalGPT and RouteLLM for the mechanisms.
Ask yourself · the answer is in the note
- where the line between a workflow and an agent sits, and what each costs;Agents
- why having a verification signal is the key test of whether a setting suits an agent;Agents
- why an agent that reads web pages must treat their content as data, not instructions;Agents
- why self-hosting has a fixed cost floor, and when it becomes cheaper than an API;Agents
- what besides cost decides between a frontier API and an open model.Agents
Go deeper
What sets the total and the active parameter count? Why is Mixtral 8x7B not 56B?MoE
Reference answer
At fixed expert size, total expert parameters grow with N and main expert compute per token grows with k; the router still scores N experts. Mixtral 8x7B duplicates FFNs, not eight complete models, yielding 46.7B total and 12.9B active parameters rather than 8×7B.
How does the router compute gate weights? Top-k has no gradient, so how does the router learn?MoE
Reference answer
A common router scores experts with a linear layer, then selects top-k. Mixtral renormalizes selected weights; Switch top-1 retains the selected full-softmax probability instead of turning its sole gate into one. Ordinary autograd does not differentiate discrete indices; task gradients flow through continuous gates. Unselected expert parameters receive no task gradient from that token, but their router logits may receive gradients through the full softmax or auxiliary objectives.
Why is load balancing needed? Why is the Switch auxiliary loss f_i times P_i?MoE
Reference answer
An expert that receives more tokens gets more training and can become even more likely to be chosen; this self-reinforcing imbalance can also leave devices waiting. Switch uses $\alpha N \sum f_i P_i$: assignment fraction $f_i$ is nondifferentiable, while mean router probability $P_i$ is differentiable. Gradients flow through $P_i$. The value is $\alpha$ at perfect balance, not a strict lower bound over all routing distributions.
What is the capacity factor? Where do tokens over capacity go?MoE
Reference answer
Switch top-1 sets capacity from $\frac{\text{tokens}}{N}\times\text{CF}$, rounded according to the implementation. This caps each expert's capacity rather than guaranteeing equal runtime per device. An overflowing expert branch can be skipped while the token continues through the residual path. Top-k and dropless implementations may behave differently; one capacity formula is not universal.
How does DeepSeek-V3's auxiliary-loss-free balancing work? Is there really no balance loss?MoE
Reference answer
The bias affects top-k selection while gate weights use original affinities. Overloaded experts have their bias reduced; underloaded experts have it increased. This update needs no auxiliary-loss gradient, but can change the selected set, outputs, and task gradients. V3 still retains a small sequence-wise balance loss ($\alpha=0.0001$), so it is not entirely free of auxiliary objectives.
What do fine-grained experts and shared experts each solve?MoE
Reference answer
Fine-grained experts allow more combinations of smaller experts at comparable expert matmul cost. More combinations do not guarantee better specialization or unchanged communication. Shared experts provide a common computation path; reducing duplication is a design aim, not a predetermined division of knowledge. DeepSeek-V3 uses both; Qwen3-235B-A22B / 30B-A3B have no shared experts.
Does MoE save memory? What are the main costs in deployment?MoE
Reference answer
Sparse activation does not automatically shrink weight storage by k/N. All parameters must live somewhere: GPU residency, device sharding, and offloading have different costs. Expert parallelism typically adds token dispatch and return traffic, while large batches may use many experts. Comparing memory or speed with a dense baseline requires matching quality, precision, batch, and deployment conditions.
How does a looped Transformer differ from ALBERT's parameter sharing?Looped Transformers
Reference answer
Both share parameters. ALBERT also factorizes embeddings, so its total reduction cannot be attributed to sharing alone. Looped models keep weights shared and let execution depth vary. Fixed parameters do not mean fixed compute, KV, or latency, or guaranteed depth extrapolation.
What does looping add, and what does it not add?Looped Transformers
Reference answer
It adds depth of computation over shared weights, not external facts or independent weights per loop. Whether that computation helps is empirical. Roughly 2 bits per parameter is a small-model synthetic-task measurement, not a measurement of the released Ouro checkpoints or a capacity theorem; more loops need not improve accuracy.
What is input injection, and why is it needed?Looped Transformers
Reference answer
Each loop receives input representation $e$ again, as when Huginn combines its prelude output with the current state through an adapter. This avoids relying entirely on the recurrent state to retain the input. It is a design choice, not a necessary or sufficient condition for stable training of every looped model.
What are the approaches to adaptive depth? Does Ouro's early exit save compute in the released code?Looped Transformers
Reference answer
ACT, PonderNet, exit gates, and depth routers use different objectives. Separate conditional halting probabilities, actual exit probabilities, output selection, and skipped work. The three-step example in adaptive depth averages 2.2 steps. Ouro snapshot 7ea635b executes all configured loops before selecting an output, so selected depth is not executed compute.
Why does a looped model's KV cache grow? Can the loops share it?Looped Transformers
Reference answer
The weights are shared but hidden-state inputs differ, so full caches usually distinguish (loop, layer). Sharing changes computation and needs error measurements. Checkpoints, prefill policies, and generation lengths differ across papers; protocol differences are not strict reproduction failures. See costs and limits for memory accounting and sources.
How does looping relate to chain-of-thought?Looped Transformers
Reference answer
CoT adds generated positions; looping adds hidden-state updates. They can coexist. Cached per-token forwards do not recompute the whole prefix. Theoretical CoT simulation requires extra structure and input-length conditions; it does not make arbitrary pretrained models interchangeable. Visible text is not necessarily a faithful explanation either.
Ask yourself · the answer is in the note
- why a dense model's parameter count and its compute per token are tied, and how MoE unties them;MoE
- what the normalization after top-k runs over, and whether an unchosen expert gets any gradient from this token;MoE
- what happens without load balancing, and what an auxiliary loss and a bias-only fix each cost;MoE
- where tokens over capacity end up;MoE
- why MoE saves compute rather than memory, and how batch size changes the arithmetic of decoding.MoE
- why an ordinary Transformer's depth and parameters are tied, and how looping unties them;Looped Transformers
- which budgets differ between shared and independent weights when both execute twelve layer evaluations;Looped Transformers
- how ACT's accumulation, PonderNet's stepwise sampling, and Ouro's cumulative-probability threshold differ, and whether all require per-token decisions;Looped Transformers
- when full KV storage scales directly with loop count, and why Huginn's 2+4+2 layout needs only 2.5 times the KV at four loops versus one;Looped Transformers
- which tasks suit a looped model and which do not.Looped Transformers
Still moving
When someone says "world model", which questions do you ask first to know which kind they mean?World models
Reference answer
Ask four things: what it predicts, in what space, conditioned on what (actions or not), and what it is used for. With those four, common usages split into learned simulators in RL (Dreamer, MuZero), representation-space prediction in the JEPA line, interactive video (Genie 3), world foundation models for robots and driving (Cosmos, GAIA), 3D spatial generation (Marble), and the question of whether LLMs or video models carry an implicit world model inside. World Labs' June 2026 taxonomy is more compact, sorting by output: renderers output observations, simulators output state, planners output actions.
Models with the same name can learn completely different things: Dreamer reconstructs its inputs, JEPA predicts embeddings, and MuZero predicts only reward, value and policy, with hidden states that need not correspond to any real state. See the guide.
What are the parts of DreamerV3's RSSM, and how is the actor trained "in imagination"?World models
Reference answer
A deterministic recurrent state $h_t=f_\phi(h_{t-1},z_{t-1},a_{t-1})$ carries memory, and a stochastic categorical latent $z_t$ expresses uncertainty; the encoder gives the posterior $q(z_t\mid h_t,x_t)$, the dynamics give a prior $p(z_t\mid h_t)$ that sees no observation, and there are reward, continue and decoder heads. The loss sums a prediction term, $L_{\rm dyn}$ (the prior chases the posterior) and $0.1\,L_{\rm rep}$ (the encoder becomes predictable), with both KL terms clipped at 1 nat by free bits.
Imagination starts from replayed real states and rolls the prior forward 16 steps; the critic fits the λ-return, and the actor's policy gradient is weighted by "advantage divided by the 5th–95th percentile range of returns (at least 1)". The actor sees only the numbers the model gives it. Dreamer 4 (September 2025) swapped in a 2B video world model and obtained Minecraft diamonds from offline data only, but in just 0.7% of episodes. See Dreamer.
Why does JEPA not predict pixels? What is "collapse", and how is it prevented?World models
Reference answer
LeCun's 2022 reasoning: pixel-level futures (leaves, textures) are inherently unpredictable, and predicting in representation space lets the model drop such detail. The cost is a shortcut: if the encoder outputs the same constant for every input, prediction error is zero. That is collapse (as defined in I-JEPA §2).
Three families of fixes: VICReg's variance and covariance constraints; the EMA target encoder plus stop-gradient used by I-JEPA and V-JEPA 2, which works empirically even though no loss term explicitly forbids collapse; and LeJEPA's SIGReg (November 2025), which requires random 1-D projections of the embeddings to look standard normal. V-JEPA 2-AC adds an action-conditioned predictor and plans by using CEM to minimise the L1 distance from the predicted embedding to a goal-image embedding. See JEPA.
How does Genie learn controllability from video without action labels, and where are the limits?World models
Reference answer
The latent action model (LAM) encoder sees the past and the next frame and outputs a continuous vector, which is quantised to a codebook of only 8 codes; the decoder sees only the history and that code yet must reconstruct the next frame, so the code is forced to carry "the main change". The dynamics model predicts the next frame's tokens conditioned on these codes; at inference the encoder is dropped and the player picks 0–7 directly. Controllability is measured with $\Delta_t$PSNR: generate with inferred actions and with random actions, and compare which is closer to the real frame.
Limits: what each code means is learned only by people playing with it afterwards; 8 codes are coarse, so "push 3.5 cm" can sit right on the boundary between two codes; the objective does not distinguish whether the agent caused the change (this point is an inference); the original model has 16 frames of memory and runs at about 1 FPS. DreamGen uses a latent action model or an IDM to add pseudo-actions to robot video, the same idea. See interactive video.
What fundamentally separates interactive world models from video generators like Sora and Veo, and what should you ask of a demo?World models
Reference answer
An interactive model must deliver frame $t$ before it knows the next key press, so it can only generate causally. At 24 fps a frame has about 41.7 ms, so with $K$ sampling steps per frame each step gets at most about $41.7/K$ ms, which is why open systems commonly distil to 2–4 steps; it also has to remember out-of-view content across a minute-scale session. An offline generator receives the whole prompt and then delivers the whole clip.
Ask of a demo: on what hardware frame rate and resolution were measured, the latency from key press to response, how long it stays consistent, what controls exist, whether out-of-view content is still there and still changing (WRBench and WorldMemBench report frequent failures here), and how open it is. As of 2026-10-15, Genie 3 has no paper and no API, and its architecture is unpublished.
A world-model evaluator has Pearson 0.86 with real success rates. Can you use it directly to pick the policy to ship?World models
Reference answer
Not directly. Pearson measures linear association across this set of policies and is unchanged under $\hat R=aR+b$ with $a>0$, so absolute success rates can be low across the board (as the Veo evaluator paper says of itself) and cannot decide whether a bar is cleared; it is also often propped up by the large gap between weak and strong policies. In the teaching example, Pearson is 0.98, Spearman 0.9 and MMRV 0.04, yet the model's top pick is still wrong; restricted to the top three, Spearman drops to 0.5. Also, the 0.86 in the Veo paper was computed for one policy across a few OOD axes.
In practice: report ranking metrics together with "was the top policy picked correctly", hold out policies that never took part in selection, and spot-check on real robots regularly so policies cannot specialise in exploiting the evaluator. See robots and cars.
A probe reads "the board state" out of a model. Does that show the model has a world model?World models
Reference answer
It shows only that the information is readable. Also check: whether intervening along the probe direction changes the output as expected (Othello-GPT did this); whether behaviour is consistent, since in Vafa et al. 2024 the taxi model has about 1.00 next-step validity but only 0.10–0.50 sequence-compression precision, and valid routes drop from 0.99 to 0.08 under 10% detours; whether it applies the right law out of distribution, since the orbit model exceeds 0.9999 trajectory $R^2$ yet infers non-Newtonian force laws; and whether outcome distributions are calibrated.
The Richens et al. theorem says a world model can be extracted from the policy of any agent competent at multi-step goals; but it assumes full observability, and it does not show that the model is used. See do they actually understand the world?.
Tomorrow you read about a new "world-model breakthrough". How do you judge it?World models
Reference answer
Ask in order: which kind of world model is it, does it output observations, state or actions, and does it take actions; who measured it and when, whether it is a paper with methods, a blog-only announcement, a vendor-reported number or second-hand coverage; whether the comparison conditions match, including hardware, number of samples and prompts, as with the top Physics-IQ Verified leaderboard entries that use best-of-N and custom prompts; and how long it holds up, including whether anyone tested that out-of-view content keeps changing.
Then ask whether it actually helps in a downstream closed loop rather than just looking good (WorldArena's perception–functionality gap); whether it can be reproduced, with a paper, weights or an API; and what is unpublished, as with Genie 3 and GAIA-4, neither of which has a public architecture. When you repeat the claim, phrase it as "as of a given date, self-reported by a given organisation", not as a permanent conclusion.
What does "recursive self-improvement" mean in different settings, and how do you tell them apart quickly?Recursive self-improvement
Reference answer
Ask three things: what object changes, who proposes and applies the change, and what signal accepts it. Those questions give four types: (a) the model designs and runs its own training and improves its own weights; (b) a system edits its own scaffold, code or prompts with frozen weights; (c) AI accelerates human-led research; (d) training on self-generated data or self-play, with a human-written update rule. Both (a) and (d) change weights; the difference is who designs the update. Most public "self-improving" systems are (b) or (d); as of 2026-10-15, no full public demonstration of (a) was found.
From Recursive self-improvement: review questionsOpen the note
How does "filter, then fine-tune" in the style of STaR relate to RL?Recursive self-improvement
Reference answer
STaR treats it as an approximation to policy gradient on a 0/1 reward: wrong samples contribute zero gradient, so "keep the correct ones and run SFT" approximates one policy-gradient step, and the filter is the reward. ReST-EM writes it as EM: the M-step is reward-weighted maximum likelihood on samples from the previous model. Unlike online RL such as PPO, the sampling policy is fixed during this step, so data collection and optimisation are decoupled. The consequence: the verifier defines what gets optimised, and the model learns toward whatever the tests reward.
From Recursive self-improvement: review questionsOpen the note
Why does training on your own data saturate within a few rounds?Recursive self-improvement
Reference answer
Song et al. define the generation-verification gap: how much the true score rises when samples are reweighted by the verifier. If the update learns the reweighted distribution to within $\varepsilon$, one round's gain is about the gap plus or minus $\varepsilon$. They measured the gap falling to near zero within two or three rounds, non-positive gaps for small models under most verification methods, and falling pass@k at large $k$. ReST-EM sees diminishing returns after a couple of iterations; Self-Rewarding ran only 3 iterations and its authors expect saturation. These results limit sustained gains under the corresponding verification signals and updates; they do not establish that learning without new external information is impossible.
From Recursive self-improvement: review questionsOpen the note
A model is truly correct 40% of the time, and the tests accept 10% of wrong solutions. After filtering by the tests and fine-tuning, how high can true correctness go?Recursive self-improvement
Reference answer
This is a teaching assumption. Accepted samples make up $0.40+0.60\times0.10=0.46$, of which $0.40/0.46\approx87\%$ are correct. If fine-tuning imitates them perfectly, true correctness reaches 87% while the tests show 100%. In the next round the tests treat "correct" and "wrong but passing" alike, the gap is 0, and the loop stops at 87%. With a 30% false-accept rate the ceiling is 69%; at 2% it rises to about 97%. Raising the ceiling means strengthening the verifier, for example with hidden tests and edge cases.
From Recursive self-improvement: review questionsOpen the note
Why does Absolute Zero's learnability reward give 0 both to tasks that are always solved and to tasks that are never solved?Recursive self-improvement
Reference answer
Neither provides a success-versus-failure contrast under this within-group binary-reward comparison; other training objectives may still use these samples. The proposer's reward is 0 when the average success $\bar r$ is 0, and $1-\bar r$ otherwise. $\bar r=0.5$ earns 0.5, $\bar r=1$ earns 0, and $\bar r=0.25$ earns 0.75, so the highest reward goes to tasks solved only occasionally; with $G$ attempts the maximum is $1-1/G$. "Zero" means no human-curated tasks or answers; a pretrained model and a Python executor are still required.
From Recursive self-improvement: review questionsOpen the note
Do AlphaEvolve and the Darwin Gödel Machine count as "improving themselves"? How do they differ from "a model changes its own weights"?Recursive self-improvement
Reference answer
Both change code; the LLM weights stay fixed. AlphaEvolve evolves programs against a human-written evaluation function; the kernel tiling it found cut Gemini training time by 1%, including training the models behind AlphaEvolve, and the authors say that feedback cycle runs on the order of months. DGM has a coding agent edit its own repository and keeps every working agent in an archive; after 80 iterations SWE-bench goes from 20.0% to 50.0%, but the authors state it is limited by the underlying FM and leave rewriting the training script to update the FM as future work. To be type (a), the object would have to be weights, the update designed by the model, and the acceptance signal out of the edited system's reach.
From Recursive self-improvement: review questionsOpen the note
How is METR's 50% time horizon computed, and why are readings above 16 hours unreliable?Recursive self-improvement
Reference answer
For each model, fit a logistic curve of success against the (log) human time of each task; the human time at which success is 50% is the horizon. If every task group succeeds more than half the time, the 50% point can only be extrapolated beyond the longest task, and one success more or less can change the estimate several-fold; METR's suite has no task over 30 hours. METR also said on 2026-05-19 that TH1.1 is essentially saturated and that at least 16% of successes on tasks of 8 hours or more were illegitimate; correcting for noise in task lengths could lower horizons by about another 30%.
From Recursive self-improvement: review questionsOpen the note
Tomorrow you read a new "AI is accelerating AI" claim. How would you evaluate it?Recursive self-improvement
Reference answer
First classify it: a task-level measurement, a lab determination against a threshold, a self-reported lab number, or a statement or prediction. Then ask five things: who measured it and can outsiders check it; whether the unit is code share, agent hours, researcher uplift or the overall pace of progress; how much humans intervened; how much compute grew over the same period; and whether the instrument is saturated, whether cheating was reviewed, and where any trend break was placed. Finally compare with existing anchors: as of October 2026, every estimate that gives an overall progress multiplier is below 2x (Anthropic self-reported, about 1.5x quoted by METR), Google DeepMind found no significant end-to-end acceleration on 2026-10-13, and no lab has declared a formal threshold crossed. Also remember that in METR's controlled trial, developers' perception and the measurement differed even in sign.
From Recursive self-improvement: review questionsOpen the note
What is test-time compute? What does each of the parallel and sequential ways of spending it cost?Reasoning models and test-time compute
Reference answer
It is the extra computation spent answering one question with the weights fixed: sampling many and picking, thinking longer within one chain, searching over intermediate steps, or generating then checking and revising. One generated token costs about $2N$ FLOPs, so extra compute is mostly extra tokens. Parallel means generating N answers at once and picking one: latency barely changes, cost grows linearly with N, and you need a way to pick. Sequential means thinking longer in one chain or revising version by version: later steps can use earlier findings, at the price of latency that grows with length. Snell et al. found that easy problems benefit more from sequential revision while hard problems need a balance. Real systems combine both; DeepSeekMath-V2, for example, uses 64 proofs per problem, verifies each 64 times, and revises for up to 16 rounds.
From Reasoning models and test-time compute: review questionsOpen the note
When does majority voting actually lower accuracy? Give an example you can compute by hand.Reasoning models and test-time compute
Reference answer
With independent samples from a fixed distribution and a unique mode, the probability of voting for that mode approaches 1 as N grows. This asymptotic result does not guarantee monotonic gains at finite N. Example: a single try is right with probability 0.4, and the wrong 0.6 is always the same answer B. With 3 votes the right answer needs at least 2, with probability $0.064+0.288=0.352$, below the 0.4 of a single sample, and it tends to 0 as N→∞. With the same $p=0.4$ but all wrong answers different, 3 votes give 0.496 and 5 votes about 0.715, tending to 1. So the average $p$ cannot predict the score after voting; you have to check, problem by problem, whether errors are spread out or concentrated. Voting also needs answers that can be compared.
From Reasoning models and test-time compute: review questionsOpen the note
With best-of-N plus a verifier, what sets the ceiling on accuracy?Reasoning models and test-time compute
Reference answer
Let a single try be right with probability $p$, and let the verifier accept correct answers with probability $r$ and wrong ones with probability $f$, independently across samples. For large N you always return some accepted sample, so accuracy tends to the precision $pr/\big(pr+(1-p)f\big)$. With $p=0.4$ and $r=1$: the ceiling is 87.0% at $f=0.1$, 69.0% at $f=0.3$, and at $f=0$ accuracy is just coverage, $1-0.6^N$. Unlike voting, a verifier still works when errors are concentrated, provided its mistakes are not correlated with the generator's; if it too always accepts the common wrong answer, you are back to a single sample. With a scoring verifier and argmax selection, a larger N makes it easier to pick a high-scoring wrong answer.
From Reasoning models and test-time compute: review questionsOpen the note
How do process and outcome reward models differ? What can and cannot be concluded from Lightman et al.?Reasoning models and test-time compute
Reference answer
An ORM gives the whole answer one score; a PRM scores each step and combines them, Lightman et al. using the product of per-step probabilities of being correct. With a generator fine-tuned from GPT-4, 500 MATH problems and one pick from 1860 samples per problem: PRM 78.2%, ORM 72.4%, majority voting 69.6%; PRM800K holds 800,000 step-level human labels. You can conclude that, for a fixed generator, the PRM picks answers better, and its lead grows with N. You cannot conclude that RL with process rewards trains a stronger policy; that needs a separate experiment. The DeepSeek-R1 report says PRMs are hard to define steps for, hard to label, and get reward-hacked in large-scale RL, so they suit reranking and guiding search better.
From Reasoning models and test-time compute: review questionsOpen the note
What does Snell et al.'s "compute-optimal" mean? Under what conditions does "a small model plus test-time compute beats a 14 times larger model" hold?Reasoning models and test-time compute
Reference answer
For each problem and budget, choose the test-time strategy that maximises the chance of being right (Eq. 1); in practice this is approximated with 5 difficulty bins based on the base model's pass@1, saving up to 4 times the compute relative to best-of-N. Against scaling parameters, pretraining is counted as $6ND_{\text{pretrain}}$ and inference as $2ND_{\text{inference}}$, so the small model may multiply its inference compute by $K=M+3(D_{\text{pretrain}}/D_{\text{inference}})(M-1)$. With $M=14$, $R=D_{\text{inference}}/D_{\text{pretrain}}=0.16$ gives about 258 times, while $R=22$ gives only about 16 times. The conclusion: on easy and medium problems, or at low inference load, test-time compute is the better buy; on the hardest problems or at high inference load, scaling pretraining works better, and the two do not trade one for one. The results come from PaLM 2-S* and MATH, before long-chain models such as R1.
From Reasoning models and test-time compute: review questionsOpen the note
Why do R1-Zero's answers keep getting longer? Is all of that growth good?Reasoning models and test-time compute
Reference answer
R1-Zero starts from DeepSeek-V3-Base and is trained with GRPO and rule-based rewards (answer correctness plus format), with no neural reward model; average length rose during training while AIME 2024 pass@1 went from 15.6% to 71.0% (v1). One reason is that checking, backtracking and switching methods raise the chance of being right: with 0.3 for answering directly and 0.65 for checking and redoing, the higher-reward strategy gets reinforced and length grows with it. But not all of it is good: Liu et al. point out that GRPO normalises by answer length, so long wrong answers are penalised less per token, which pushes wrong answers longer; o1-like models spent on average 1,953% more tokens on "2 plus 3"; on hard problems, wrong answers are longer and switch approach more often. Kimi k1.5 and L1 rein length in with length rewards, and Dr. GRPO removes the normalisation bias.
From Reasoning models and test-time compute: review questionsOpen the note
Is the chain of thought faithful? How do you test it, and what does it mean for monitoring?Reasoning models and test-time compute
Reference answer
Not necessarily. You test it by intervening or planting hints: Turpin et al. made the example answers always (A), and models were swayed without mentioning it in their explanations; Lanham et al. truncated, corrupted and paraphrased chains to see whether answers changed, and found reliance varies by task; Chen et al. planted hints in prompts, and Claude 3.7 Sonnet and DeepSeek R1 mentioned a hint they used only 25% and 39% of the time on average, while in RL environments with planted loopholes they exploited them over 99% of the time and mentioned them under 2% of the time. Baker et al. found that reading the chain catches reward hacking better than watching actions alone, but once the monitor goes into the reward, strong optimisation teaches the model to hide its intent. So chain-of-thought monitoring is useful but not sufficient, and putting optimisation pressure on it can break it.
From Reasoning models and test-time compute: review questionsOpen the note
How do you read the claim "RL only sharpens what the base model could already do"? How is pass@k estimated?Reasoning models and test-time compute
Reference answer
Yue et al. (NeurIPS 2025) found that RL models are better at small $k$, base models overtake them at large $k$, and the reasoning paths are already in the base distribution; distillation is better at every $k$. The mechanism can be computed by hand: base accuracy (0.5, 0.02) on two problems becomes (0.95, 0) after RL, pass@1 goes from 0.26 to 0.475, but pass@100 drops from 0.934 to 0.5. On the other side are ProRL (long RL improves on problems the base model cannot solve), CoT-Pass@k (after excluding lucky guesses, RL still widens the boundary) and skill-composition experiments; Spurious Rewards shows Qwen2.5-Math gaining even with random rewards, so part of the gain comes from activating existing behaviour. pass@k uses Chen et al.'s unbiased estimator $1-\binom{n-c}{k}/\binom{n}{k}$; with $n=10$ and $c=3$, pass@5 is about 0.917, while plugging into $1-0.7^5$ gives only 0.832. As of October 2026 there is no consensus; it depends on the base model, training length, domain, $k$, and whether reasoning is checked.
From Reasoning models and test-time compute: review questionsOpen the note
Going from single-turn RLVR to multi-turn agent RL, what changes and what stays the same?Training agents with RL
Reference answer
The basic workflow stays the same: sample, score, and update the policy using advantages. Update rules such as PPO and GRPO still apply. The sample is now a multi-turn sequence of (action, observation), with observations supplied by the environment rather than the policy. The reward usually arrives at the end of the episode, based on the environment's final state, and the checker often lives in the same sandbox as the agent, potentially within its reach.
Trajectory length and execution cost also change. One trajectory can contain thousands of tool calls, and a rollout involves starting containers, running commands and running tests, taking minutes. DeepSeek-R1 (2025-01) did not apply large-scale RL to software engineering precisely because evaluation was too slow.
Why are tokens returned by tools kept out of the loss? What happens if you do not mask them?Training agents with RL
Reference answer
The log-probability of a trajectory splits into two parts: the probability of the policy choosing its actions, plus the probability of the environment returning its observations. The latter does not depend on the parameters, so its gradient is zero and the policy gradient contains only action tokens to begin with. Without the mask, training would raise or lower the probability of "the model writing this file content or this error message itself", even though that text came from the environment; and since tool outputs are often much longer than actions, they would dominate the gradient. In Search-R1's ablation (2025-03), average exact match was 0.431 with the mask and 0.343 without. Masked tokens remain in the context; they just produce no gradient.
Four 3-turn trajectories on the same task get rewards [1, 0, 1, 1]. What are the group-relative advantages, and which tokens receive gradient?Training agents with RL
Reference answer
The mean is 0.75 and the population standard deviation about 0.433, so the normalised advantages are [+0.577, −1.732, +0.577, +0.577]. Using $G-1$ as the sample-variance denominator gives a standard deviation of $\sqrt{0.75/(4-1)}=0.5$; dividing the centred rewards by that gives [+0.5, −1.5, +0.5, +0.5]. Without the standard deviation and with a leave-one-out baseline, as in DeepSWE, they are [+0.333, −1, +0.333, +0.333]. In the episode-level approach this number is spread over every model-generated token in that trajectory; the prompt and tool outputs such as file contents and test logs have mask 0. In the teaching example a trajectory has 1,800 tokens, of which only 200 action tokens receive gradient. A shared step with the same context, tokens and forward computation has the same unweighted log-probability gradient, but positive and negative advantages make its weighted contributions point in opposite directions. If all 4 first steps are identical, their contributions sum to 0 under the main text's simplified objective with common weighting and normalisation and no additional clipping or loss terms; other steps can still change its probability through shared parameters.
Where does one score per trajectory fall short? What finer-grained options exist?Training agents with RL
Reference answer
It cannot tell which step in a trajectory was good: a sensible file read inside a failed trajectory is pushed down along with everything else, and only many samples average out the noise. Finer options each have prerequisites. GiGPO (2025-05) finds states that recur within the group and compares the actions taken from the same state again, with no extra model, but degrades to GRPO when no state repeats. A turn-level critic (ArCHer, 2024-02) gives an estimate at every turn, at the cost of an extra model and estimation error. SWEET-RL (2025-03) lets the critic see information at training time that the policy cannot. Per-turn rewards give a denser signal, but the intermediate rewards have to be designed and can be exploited. Z.ai's GLM-5 (2026-02) still used group-relative advantages, while GLM-5.2 (2026-06) switched to critic-based PPO for long tasks.
Tests catch only some failures. How can training reward and true success diverge?Training agents with RL
Reference answer
Expected reward equals the share of real fixes plus the shares of wrong fixes and tampering that slip through; true success counts only the first. In the teaching example, with test files the agent can edit and visible tests that miss some wrong fixes, reward rises from 0.55 to 0.90 while true success rises only from 0.30 to 0.35. In a group comparison, a trajectory that edits the tests gets the same positive advantage as a real fix. After restoring the test files before scoring and adding hidden tests, the same two policies score 0.34 and 0.40, close to the true change. "Edit the tests when stuck" is a recipe that works across tasks, so under a weak checker it grows especially fast on hard problems.
Give a few documented examples of agents exploiting their checkers, and the limits of the defences.Training agents with RL
Reference answer
OpenAI's Baker et al. (2025-03) recorded agents in training using exit(0) to leave early and raise SkipTest to skip tests; Anthropic (2025-11) recorded objects whose __eq__ is always true, sys.exit(0), and a conftest.py that rewrites pytest's reports; SWE-bench images once kept future git history (2025-09); Claude Mythos Preview (2026-04) occasionally circumvented network restrictions in its training environment. Every defence has limits: read-only tests do not stop special-casing; hiding tests drives cheating close to 0 but makes normal tasks harder (ImpossibleBench, 2025-10); using a CoT monitor directly as a penalty, with too much optimisation, teaches agents to hide their intent; and Anthropic says its pre-training review of environments did not catch every problematic one.
How should a trajectory that hits the context limit, the step limit or a timeout be scored?Training agents with RL
Reference answer
Three choices. Scoring it 0 teaches the model to hand in early and systematically pushes down long tasks. Dropping it from the loss loses negative samples but stops penalising "not finished yet"; DeepSWE's (2025-07) compact filtering does this, reasoning that rewarding only deliberate submissions encourages careful testing. Treating it as truncated and bootstrapping the remaining return with a value estimate needs a critic. Environment failures need separate handling: GLM-5 excludes samples that failed because a sandbox crashed. Whatever you choose, count limit hits, timeouts and tool errors separately; a falling truncation rate is not necessarily better ability.
How does the training system for agent RL differ from single-turn RLVR? Why go asynchronous, and what does it cost?Training agents with RL
Reference answer
A large share of the time is spent off the GPU: starting containers, running commands, running tests. DeepSWE started 512 containers in parallel per iteration, and Qwen3-Coder reports 20,000 environments in parallel. Trajectory lengths vary widely, so waiting synchronously for the slowest one is wasteful, and generation is often decoupled from training: AReaL reports up to 2.77× speedup at the same number of GPUs, and Kimi-Researcher saves tasks that run over time and continues them later with new weights. The cost is data generated by an older policy, sometimes with early and late turns of one trajectory coming from different versions, so the log-probabilities at generation time must be recorded and corrected for. Training must also use the token ids that were generated: parsing into messages and re-encoding can change the tokens, and GLM-5 added a token-in-token-out gateway for this reason.
How does mechanistic interpretability differ from behavioural evaluation, and when is it worth using?Mechanistic interpretability
Reference answer
Behavioural evaluation asks "is the output right on these inputs?"; interpretability asks "which internal quantity produced this output, and does changing it change the output as predicted?". Two models can both answer "capital of the state containing Dallas" correctly, one by first thinking of Texas and then reaching Austin, the other by having memorised the pairing; Claude 3.5 Haiku has both routes.
It is worth using when the same score with different mechanisms affects out-of-distribution behaviour, when a model may change its behaviour because it knows it is being tested (the Sonnet 4.5 system card), and when you need hypotheses without labels. The cost is that it is slow, expensive and narrow, and often explains a replacement model. See the guide.
From Mechanistic interpretability: review questionsOpen the note
A linear probe reads some property from a layer with 95% accuracy. What does that show, and how do you make the conclusion solid?Mechanistic interpretability
Reference answer
It only shows that the information can be read linearly from that layer. It does not show that the model's output uses it, nor rule out that the accuracy comes from the probe's own capacity to fit. Hewitt & Liang's control tasks give each word type a random but fixed label: for part-of-speech tagging on ELMo's first layer, a linear probe gets 97.2 against 71.2 on the control task, a selectivity of 26.0, while an MLP probe gets 97.3 against 92.8, a selectivity of only 4.5.
To make it solid: report selectivity; use random directions or randomly initialised models as baselines (Anthropic's sleeper agent probe reached AUROC 99.3%, and the best of 1,000 random directions still reached 95.3%); intervene along the probe direction and check that the output changes as expected; and keep in mind that subspace patching can create illusions (Makelov et al.). See Features and probes.
From Mechanistic interpretability: review questionsOpen the note
What is superposition, and why does it pay more the sparser the features are?Mechanistic interpretability
Reference answer
Superposition is a network representing more features than it has dimensions, by letting feature directions be not quite orthogonal and tolerating some interference. The toy model of Elhage et al. is $x'=\mathrm{ReLU}(W^\top Wx+b)$: with dense features it learns only the $m$ most important ones; as features get sparser superposition appears, and it does so as a phase change.
By hand: put 3 features 120° apart in 2 dimensions, so each pair interferes at −0.5. With one feature active, the negative interference is cut off by the ReLU and reconstruction is exact; with two active, each loses half; with all three active they cancel completely. If each feature is active with probability $p$, the expected loss is $1.5p^2+1.5p^3$, against $p$ for dropping one feature: at $p=0.1$ that is 0.0165 against 0.1, and the break-even point is about 0.457. Without the ReLU, superposition no longer pays. See Features and probes.
From Mechanistic interpretability: review questionsOpen the note
What is the SAE objective? How do L1, TopK and JumpReLU handle sparsity?Mechanistic interpretability
Reference answer
$f=\mathrm{ReLU}(W_{\rm enc}x+b)$, $\hat x=W_{\rm dec}f+b'$, and the loss is reconstruction error plus $\lambda\sum_i f_i\|W_{\rm dec}^{(i)}\|$; multiplying by the decoder column norm stops the model from dodging the penalty by shrinking $f_i$ and enlarging the decoder vector. L1 causes shrinkage: non-zero activations are systematically underestimated. TopK (OpenAI) keeps only the $k$ largest per token, setting sparsity directly and leaving only the reconstruction term; JumpReLU (Google DeepMind) learns a threshold per latent and penalises L0 directly, trained with straight-through estimators.
By hand: $x=(1,1)$, with dictionary directions $(1,0)$, $(0,1)$ and $(0.707,0.707)$. L1 prefers using only the diagonal direction (a cost of $\sqrt2$ against 2). At $\lambda=1$ the coefficient is 0.914 and the relative squared reconstruction error is $0.25/2=12.5\%$, whose complement is 87.5%, not the reconstructed vector's retained-energy fraction. For $\lambda\ge2\sqrt2$ nothing fires. TopK with $k=1$ gives a coefficient of $\sqrt2$ with no shrinkage. See Sparse autoencoders.
From Mechanistic interpretability: review questionsOpen the note
What are dead latents, feature splitting and absorption? What happens if you change the random seed?Mechanistic interpretability
Reference answer
Dead latents never fire during training, so they get no gradient. Anthropic's 1M, 4M and 34M SAEs had roughly 2%, 35% and 65% dead; OpenAI, initialising the encoder as the transpose of the decoder and adding the AuxK auxiliary loss, had only 7% dead at 16 million wide (up to 90% without mitigations). Feature splitting: as the dictionary grows, one feature splits into finer ones, such as "San Francisco" going from 1 to 2 to 11 features. Absorption: when features form a hierarchy, a parent feature fails to fire where it should because child features absorb it, and changing size or sparsity does not fix it.
Changing the seed: 131K-wide SAEs on an MLP of Llama 3 8B share only about 30% of their features, and TopK depends more on the seed. So an SAE gives a pragmatically useful decomposition, not a complete list of the model's features. See Sparse autoencoders.
From Mechanistic interpretability: review questionsOpen the note
Why did the Google DeepMind team deprioritise fundamental SAE research in 2025, and what are SAEs still good for?Mechanistic interpretability
Reference answer
Their 2025-03-26 progress update: on detecting harmful intent with Gemma 2 9B IT, tested out of distribution, a linear probe on the residual stream reached OOD AUROC 0.999 and SAE probes were distinctly worse. Around the same time, Kantamneni et al. could not consistently beat baselines in four difficult sparse-probing settings; AxBench found prompting best for steering and difference-in-means best for detection, with SAEs competitive on neither; SAEBench found proxy metrics disconnected from practical usefulness. In December 2025 the team went further and argued for trying prompting, steering and probing first.
SAEs still suit exploration when you do not know what to look for: in the auditing game, one person found the hidden objective in 90 minutes through an SAE feature (the paper notes semantic search could reproduce it); OpenAI compared models before and after finetuning with SAEs and found a "toxic persona" feature; and they help find spurious correlations in training data. When you know the concept and have labels, start with a probe or difference-in-means. See Sparse autoencoders.
From Mechanistic interpretability: review questionsOpen the note
How do denoising and noising differ in activation patching? Why does IOI need a "completeness" criterion?Mechanistic interpretability
Reference answer
Denoising puts clean values into the corrupted run and asks "is this enough to rescue the behaviour?"; noising puts corrupted values into the clean run and asks "can the model do without it?". With backup components the two disagree: in the 3-node example, denoising B restores 86% but noising B loses only 43%, because C steps in when B is absent. Path effects are not additive either; the two paths sum to 143%.
The IOI circuit recovers 87% of the full model's logit difference (faithfulness), but faithfulness cannot see backups: when the name movers are removed, the backup name movers take over. Completeness requires that removing the same set of components from the circuit and from the full model has similar effects; in the example, removing B leaves the model at 2.0 and the circuit at 0, exposing that C was left out. See Circuits.
From Mechanistic interpretability: review questionsOpen the note
How is an attribution graph built? When you hear "interpretability can detect deception or reward hacking", what do you ask?Mechanistic interpretability
Reference answer
First train a cross-layer transcoder to replace every MLP; for a single prompt, freeze the attention patterns and normalisation and add error nodes so that the local replacement model matches the original's outputs; edge weights are $A_{s\to t}=a_s w_{s\to t}$; prune, group, and go back to the original model to validate with interventions. The authors list the limits themselves: it does not explain why attention looks where it does (QK attributions came later), error nodes can hide the key computation, it looks at single prompts, and the replacement model may not share the original's mechanism; it is satisfying on about a quarter of prompts.
What to ask: was the problem implanted, or did it occur naturally? Who reported it, and has a third party reproduced it? What was it compared with (random directions, chain-of-thought monitoring, behavioural evaluation)? What is the false-positive rate? For example, Apollo's deception probes reach AUROC 0.96–0.999, yet the authors say this is not enough for a robust defence; inhibiting evaluation awareness in Sonnet 4.5 raised misaligned actions to at most 8–9%, self-reported by the lab and varying by dataset. See Circuits.
From Mechanistic interpretability: review questionsOpen the note
What are the forward process and the training objective of masked diffusion? What does the $1/t$ do?Diffusion language models
Reference answer
Forward process: at time $t\in[0,1]$, each position is independently replaced by [M] with probability $t$, and once it becomes [M] it never changes back (the absorbing state). Training objective: draw $t\sim U(0,1]$ and the corresponding $x_t$, compute the cross-entropy only at masked positions, and multiply by $1/t$ (LLaDA, Eq. 3). At small $t$, only $tL$ positions contribute on average. Weighting by $1/t$ gives expected supervision weight $L$ at each time, though the loss still depends on prediction difficulty. The complete expected objective upper-bounds negative log-likelihood (NLL); an individual random mask need not give a bound.
For the same ideal denoising conditional, a smooth monotone schedule covering the same endpoints leaves the continuous-time objective unchanged when paired with its corresponding weight $-\alpha_t'/(1-\alpha_t)$. Sampling variance and practical optimization can still differ. Under independent, content-independent masking, the ideal word distribution given the visible context does not depend on $t$, so the prediction network can omit time. The sampler still needs it to determine reveal probabilities. See the MDLM worked example.
From Diffusion language models: review questionsOpen the note
How does it differ from BERT's masked language modeling (MLM)? Why can't BERT be used to generate directly?Diffusion language models
Reference answer
Both can use bidirectional Transformers; the training problem and generative process differ. BERT usually selects about 15% of positions as prediction targets, only some of which are replaced with [MASK]. Its original objective does not also specify a reverse process that generates from all masks. Masked diffusion samples different masking levels and weights losses by $1/t$. MDLM writes this as a weighted average of MLM losses and derives a likelihood lower bound for the corresponding reverse process.
Avoid reducing this to “BERT has no likelihood interpretation.” MLM can provide pseudo-likelihood scores, but those do not directly give a normalized joint sequence probability. Similarly, removing $1/t$ changes this objective, so the same bound derivation no longer applies. That does not mean an unweighted masked model cannot be given a generative process. See the two-token derivation and the MDLM training–sampling walkthrough.
From Diffusion language models: review questionsOpen the note
What does "any order" mean? Use the two-token example to show what the objective equals.Diffusion language models
Reference answer
In training, the objective averages over all generation orders; at inference, blanks can be filled in different orders. With two tokens, both are masked with probability $t^2$, and each of the two single-mask cases has probability $t(1-t)$. After multiplying by $1/t$ and integrating, both terms get weight $1/2$. The objective is the average of the left-to-right and right-to-left autoregressive (AR) losses.
Using the earlier teaching example, the objective is $(1.833+2.996)/2=2.414$. Choosing randomly between those two orders gives a sequence negative log-likelihood of $-\ln 0.105=2.254$. The first quantity is an upper bound; it is loose when the two orders assign different probabilities.
At any length, RADD's Theorem 2 proves equivalence with the any-order autoregressive objective. Hard orders must be learned too, but that does not imply a fixed compute multiple: the roughly 16 times reported by Nie et al. (2024-10) belongs to their scoring and training setup. Later comparisons need to distinguish scoring, architecture and data conditions.
From Diffusion language models: review questionsOpen the note
Why does committing several tokens in one step go wrong? How do you decide how many to commit?Diffusion language models
Reference answer
The tokens in one step are each chosen from their marginal distributions without seeing one another. If the answer is full house half the time and high card the other half, committing both in one step gives a valid hand only half the time. Fast-dLLM decides by confidence: commit every position above a threshold (0.9 by default), or the single most confident one if none passes; its theorem gives a condition: if $n$ positions all have confidence above $1-\epsilon$ and $(n+1)\epsilon\le1$, taking per-position maxima agrees with taking the joint maximum. The cost of a fixed step count has been measured by a third party: with LLaDA-8B-Instruct at generation length 128 and block size 32, a fixed 4 per step drops GSM8K from 73.6 to 61.7 (73.6 being the one-per-step baseline in the same setting). Feng et al.'s Theorem 4.4 gives a linear-step lower bound for a worst-case HMM with a 16-token vocabulary, under their factorized reverse process and small learning-error assumptions. Its sequence error measures probability outside the HMM's support; it is not a universal limit on reasoning speedups. Compare latency at matched task accuracy.
From Diffusion language models: review questionsOpen the note
Why can't a diffusion LM use a KV cache directly? What are the two fixes, and what does each cost?Diffusion language models
Reference answer
In an autoregressive model, the K and V at position $i$ depend only on $x_{\le i}$, which stays fixed. With bidirectional attention, a mask read by the previous layer may become a word in the next round. From layer 2 onward, even the prompt's K and V can therefore change. Original LLaDA recomputes the full span each round; AR's exact caching rule does not carry over directly.
One option is approximate caching, as in Fast-dLLM: exploit similarity between nearby steps, reuse KV within a block, refresh periodically, and check the quality loss. Another is block diffusion: generate blocks left to right and denoise within each block. Block-causal attention isolates completed prefixes from updates in the active block, making their KV exactly reusable. A completed block usually still needs a pass over its final tokens to create the clean representations to cache.
Smaller blocks move closer to AR and reduce the number of positions available for parallel generation. The Block Diffusion paper reports lower perplexity bounds for smaller blocks under its training setup, not a guarantee that shrinking blocks improves every model. See the block-cache example; reusing attention outputs is a separate question.
From Diffusion language models: review questionsOpen the note
Why isn't parallel decoding automatically faster? Estimate low and high concurrency with the roofline.Diffusion language models
Reference answer
Use the teaching model in decoding and speed: linear layers only, with 7B parameters, BF16, and H100 SXM5 peak specifications. The lower bound for one forward pass is $\max(4.18\,\text{ms},\ n\times0.01415\,\text{ms})$; below about 295 positions, reading the weights dominates.
For one request with a 512-token prompt and 256 generated tokens: AR takes about 1,076 ms; whole-sequence diffusion without a cache computes 768 positions per step and takes 2,782 ms at one token per step, slower than AR; blocks with $G=32$ plus a cache, at 4 per step, take about 275 ms, 3.9 times faster. Adding a commit pass after each of the 8 blocks costs about 33 ms more: about 308 ms, or roughly 3.5 times faster.
As concurrency rises, diffusion computes $G/\tau=8$ positions per committed token. This simplified model gives a throughput ceiling of 8,834 tok/s, versus AR's 70,671 tok/s, with AR catching up at about 37 concurrent requests. The low-concurrency speedup is therefore about $\tau$, and the throughput ratio at compute saturation is about $\tau/G$. These are estimates, not measurements. Third-party measurements and Google's discussion of DiffusionGemma also highlight the difference between low-concurrency latency and high-concurrency throughput.
From Diffusion language models: review questionsOpen the note
You read "a diffusion model at 1000+ tokens/s, N times faster than autoregressive". What do you ask?Diffusion language models
Reference answer
Four things: at what concurrency; is the baseline on the same GPU and the same engine; what is the quality at that speed, and with which threshold; and does the timing include prefill, the per-block commit pass and fixed overheads. Examples: Gemini Diffusion's 1479 tokens/s excludes a 0.84 s overhead; the comparison speeds in the Mercury report are Artificial Analysis's median measurements across each model's cloud providers; in the LLaDA2.0 paper the diffusion models and baselines run on different engines (dInfer versus SGLang), and when the SGLang blog puts both on one engine the ratio falls from about 2.1 to about 1.9; Mercury 2.5 does not name the GPU model. Quality has to be read at the same time: on the DiffusionGemma model card, most benchmarks are below the same-size Gemma 4. As of October 2026, all of these figures come from the vendors or the methods' authors.
From Diffusion language models: review questionsOpen the note
How does DFlash differ from a native diffusion LM?Diffusion language models
Reference answer
DFlash uses block diffusion to draft: a small model reads the target model's features and predicts a block in one forward pass. The AR target model then verifies it, retaining the consecutively accepted prefix. The draft does not directly determine the final output. DFlash paper
Preserving the target distribution requires correct exact verification and subsequent sampling. Greedy decoding must preserve the target's choices; stochastic sampling needs the corresponding acceptance, rejection, and correction rules. Keeping high-confidence draft tokens alone is not enough. Under these conditions, poor drafts mainly reduce acceptance length and speed rather than change the target distribution. Original speculative-decoding derivation
A native diffusion LM decides its own final tokens. Its parallel-sampling consistency and task quality need direct evaluation; it cannot inherit another target model's quality guarantee. Both approaches must account for drafting or denoising and verification or commit costs. More tokens per cycle usually help amortize those costs, but extra computation and scheduling at high concurrency can change the result. A single-request speedup is not a serving-throughput guarantee.
From Diffusion language models: review questionsOpen the note
Ask yourself · the answer is in the note
- why an interactive video model can only generate causally, and how many milliseconds each step gets at most at 24 fps with 4 sampling steps per frame;World models
- where the gradients of $L_{\rm dyn}$ and $L_{\rm rep}$ go in the RSSM, and what free bits do when the KL is below 1 nat;World models
- what the cheapest "solution" is once a JEPA drops the EMA target encoder and stop-gradient, and why SIGReg penalises it;World models
- why, in the five-policy example, a Pearson of 0.98 still picks the wrong top policy, and what Spearman becomes when only the top three are compared;World models
- with a real fall rate of 30%, what the expected Brier scores are for a model that always says "falls" and one that always says "stays", and why a single video cannot tell them apart.World models
- Given a "self-improving" system, how do you state the object it changes, who proposes changes, and what signal accepts them, and decide which of types (a)–(d) it is?Recursive self-improvement
- Why is STaR's filter equivalent to a 0/1 reward? When "correct" is replaced by "passes the tests", what is the loop actually optimising?Recursive self-improvement
- If the false-accept rate falls from 10% to 2%, how does the ceiling of filter-then-fine-tune change? Why, in the ideal case, does the second round gain nothing?Recursive self-improvement
- In DGM's parent selection, what roles do score and number of children play? Why does HGM argue that score alone is not enough?Recursive self-improvement
- When a model succeeds more than half the time on every task group, how is its 50% time horizon obtained, and how far can that number be trusted?Recursive self-improvement
- Given the answer distribution on one problem, where does voting push accuracy? Why is the dataset's average $p$ not enough?Reasoning models and test-time compute
- In the best-of-N accuracy formula, how do $r$ and $f$ each affect the ceiling? What happens when the verifier's errors are correlated with the generator's?Reasoning models and test-time compute
- Under Snell et al.'s accounting, how does the extra inference compute available to the small model change as the inference load $R$ goes from 0.16 to 22, and why?Reasoning models and test-time compute
- An RL training log shows average length rising. Which curves would you split out to tell "learned to check" from length bias?Reasoning models and test-time compute
- What four things do you ask when you read "model X scores 9x% on AIME"? With 30 problems at 80% accuracy, roughly how wide is the 95% confidence interval?Reasoning models and test-time compute
- Starting from the decomposition of a trajectory's log-probability, why should tool-output tokens produce no gradient, yet stay in the context?Training agents with RL
- With rewards [1, 0, 1, 1], what results do the three advantage conventions (population standard deviation, sample standard deviation, leave-one-out) give? Why does each sum to 0?Training agents with RL
- When does a GiGPO anchor-state group add information beyond episode-level group-relative advantages, and when does it degrade to GRPO?Training agents with RL
- In the "tests catch only some failures" example, how does the expected-reward formula show which outcome categories account for most of the reward gain under checker v1?Training agents with RL
- Scoring a trajectory that hits a limit as 0, dropping it, or treating it as truncated and bootstrapping a value estimate: which way does each push the model?Training agents with RL
- Three features 120° apart in 2 dimensions, zero bias, with a ReLU: what is the reconstruction when features 1 and 2 are both active? At $p=0.1$, what are the expected losses of superposition and of "dropping one feature"?Mechanistic interpretability
- A linear probe at 97.2 against 71.2 on the control task, an MLP probe at 97.3 against 92.8: what is each selectivity? Why do near-identical accuracies lead to different conclusions?Mechanistic interpretability
- Dictionary $(1,0)$, $(0,1)$, $(0.707,0.707)$ and activation $(1,1)$: at $\lambda=1$, what are the L1 SAE's optimal coefficients and reconstruction? At what $\lambda$ does nothing fire? What does TopK with $k=1$ do?Mechanistic interpretability
- In the 3-node example, why does denoising B restore 86% while noising B loses only 43%? Why do the two path effects add up to 143%?Mechanistic interpretability
- An attribution graph says "the model thinks of Texas before saying Austin": what further evidence do you need before believing this is the original model's mechanism and not just the replacement model's?Mechanistic interpretability
- What does the two-token objective become without $1/t$, and why can't the original likelihood-bound derivation be reused directly?Diffusion language models
- At how many tokens per step was LLaDA's GSM8K score measured? What does that imply for claims of "both good and fast"?Diffusion language models
- In the poker example, why is only half of the one-step outputs a valid hand? How does Fast-dLLM's threshold rule handle it?Diffusion language models
- Without a cache, why is whole-sequence diffusion slower than AR even at one token per step? With blocks and a cache, what changes in the accounting?Diffusion language models
- In the compute-saturated regime, why is the diffusion-to-AR throughput ratio about $\tau/G$? Given a $\tau$ and a $G$, compute the crossover once.Diffusion language models
Want more practice?
- Seven modules by hand: turn the formulas into code a test can check.