Interview question bank
Explain the mechanism and why it is useful before naming an equation. Answer aloud, then check the response.
What changes between the older and modern decoder recipes?
The modern recipe uses rotary positions, RMSNorm, a gated feed-forward network, and shared KV heads. Efficient attention kernels change execution. These choices solve different problems and should be tested separately.
Where does RoPE belong?
After query and key projection, before their comparison, in each attention layer. It does not rotate values or add a vector to the residual stream.
Why must a port match the pairing convention?
Adjacent-coordinate and split-half rotations organize the same operation differently. A checkpoint expects its trained organization; using another convention without transforming the weights changes the function.
Why is a longer computable context not automatically useful?
The positional function can be evaluated beyond training, but the model has not learned all of those conditions. Scaling positions changes the task and usually needs adaptation and evaluation.
Why does RMSNorm omit mean subtraction?
It keeps scale control while simplifying normalization. Its empirical motivation is that re-centering was not necessary in the tested settings, not a guarantee that offsets never matter.
Why compute normalization in higher precision?
Squaring, summing, and dividing can lose information or overflow in a narrow format. A higher-precision intermediate protects those operations before conversion back.
What does the SwiGLU gate add?
One projection proposes content; another produces an input-dependent gate. Multiplying them allows the network to control which features pass through before projecting back.
Why does SwiGLU need a different hidden width?
It has an additional projection compared with the older MLP. Keeping the same hidden width would increase the budget, so comparisons often resize it to isolate the architectural change.
Why use grouped-query attention?
Several query heads share keys and values, reducing retained history and cache reads while keeping distinct queries. The cost is less independent KV capacity than full multi-head attention.
Why do cached causal masks need special care?
The query sequence may contain only new positions while the key sequence contains the whole prefix. A triangle aligned to the start can hide valid history. The mask must use the actual position relationship.
What is the difference between SDPA and FlashAttention?
SDPA is an interface for the attention operation. FlashAttention is an implementation that tiles the work and keeps intermediate state near the processor. Calling an interface does not guarantee a particular backend.
Why can FlashAttention be exact without storing every score?
Softmax can maintain a running maximum, normalizer, and weighted-value sum across tiles. Rescaling old totals when the maximum changes preserves the same result up to floating-point rounding.
Exercises
One filled dot is a short explanation, two require diagnosis, and three require a system design. Draw the relevant mechanism before checking the solution.
E1. ●○○ Draw a modern decoder block and identify what each upgrade changes.
E2. ●○○ Explain why GQA still has distinct attention patterns.
E3. ●●○ A model loads successfully but produces poor output after a RoPE port. What would you inspect?
E4. ●●○ A FlashAttention version saves memory but barely changes latency. Explain why that can happen.
E5. ●●● Plan a comparison of LayerNorm and RMSNorm that isolates the change.
E6. ●●● Design a correctness check for a cached modern attention block.
Worked solutions
Follow the reasoning, including the assumption that makes each answer valid.
E1. RoPE changes positional comparison; RMSNorm controls input scale; SwiGLU changes feature transformation; GQA changes KV sharing. Residual additions preserve the stream. FlashAttention changes how attention executes rather than its dense mathematical result.
E2. Each query head has its own query even when its keys and values are shared. Different queries produce different scores over the same history, so shared memory does not force identical attention weights.
E3. Check coordinate pairing, frequency configuration, partial rotation, and cached positions. Successful loading proves shape compatibility only. Compare rotated queries and keys with the reference before inspecting final generated text.
E4. Avoiding the score matrix helps memory use, but other work may dominate elapsed time. Small inputs may also fail to amortize launch or dispatch overhead. Measure the actual backend and workload before claiming a general speed improvement.
E5. Keep data, model dimensions, optimizer, schedule, and evaluation fixed. Change only normalization, record its conventions, and repeat runs. Compare held-out quality and measured cost. Do not attribute a bundled modern recipe’s improvement to normalization alone.
E6. Compare full-sequence and incremental outputs at matching positions in evaluation mode. Include padding and unequal query/key lengths. Inspect projections, rotary positions, KV grouping, masks, and outputs in order. Use a stated numerical tolerance before benchmarking speed.