Interview question bank
Explain the mechanism and why it is useful before naming an equation. Answer aloud, then check the response.
What does pretraining teach?
It adjusts the decoder to predict the next token from text prefixes. This develops reusable statistical structure, but does not by itself specify an assistant’s protocol or guarantee truthful answers.
Why does teacher forcing help training?
The recorded sequence provides every prefix, so many next-token predictions can run together under a causal mask. During generation, the chosen token must exist before the next prefix can be formed.
Why shift targets?
The output at the current position predicts the following token. Comparing it with the current input instead teaches copying and can produce a deceptively low loss.
What does cross-entropy reward?
It rewards assigning probability to the recorded next token. It measures prediction under known prefixes, so generated behavior and task success need separate evaluation.
What does backpropagation do?
It follows the computation backward to determine how each parameter affected the loss. Shared parameters collect contributions from every use before the optimizer applies an update.
Why use Adam rather than one fixed step size for all coordinates?
Adam smooths gradient direction and scales each coordinate using its squared-gradient history. Its state makes updates depend on past training, which is why weights alone cannot resume a run.
How does AdamW differ from an L2 penalty?
AdamW shrinks weights separately from the adaptive gradient update. Passing an L2 term through Adam would subject that term to the optimizer’s coordinate-dependent scaling.
Why warm up and clip gradients?
Warmup limits early updates while optimizer state and representations settle. Clipping limits an unusually large combined gradient. Neither repairs invalid data or a nonfinite computation.
Why use mixed precision?
Different operations need different numerical range and detail. Lower precision can reduce storage and accelerate supported kernels, while sensitive reductions and optimizer state can remain in higher precision.
What distinguishes a training checkpoint from an inference artifact?
A resumable checkpoint also stores optimizer, schedule, data position, and relevant random state. An inference artifact needs the predictor and its input contract, but not the update history.
Why is lower validation loss not the whole evaluation?
It measures held-out prediction under one scoring protocol. It does not directly test instruction following, retrieval, or useful generated behavior, and comparisons can be misleading when tokenization or context changes.
Why repeat architecture comparisons?
Initialization, data order, and execution can change the result. Repeated controlled runs reveal whether the observed gain is stable enough to support the claim. Undertraining can also reverse a ranking.
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. ●○○ Explain how the same embedding parameter can learn from input lookup and output prediction.
E2. ●○○ Why can greedy decoding miss the most likely complete sentence?
E3. ●●○ Training loss falls while validation loss rises. Give a diagnosis and a next check.
E4. ●●○ A resumed run diverges immediately despite identical loaded weights. What state might be missing?
E5. ●●● Describe a safe gradient-accumulation update.
E6. ●●● Plan an experiment to distinguish an architectural gain from extra training.
Worked solutions
Follow the reasoning, including the assumption that makes each answer valid.
E1. Weight tying reuses one tensor in both places. Backpropagation adds the gradient from each use to that tensor; there are not two independent tables to update.
E2. It selects the best next token at each local prefix. A locally preferred token can lead to weaker later choices, so local argmax decisions do not optimize the probability of a whole sequence.
E3. The model may be fitting training-specific patterns. First verify a stable held-out split and consistent scoring. Compare checkpoints on held-out prediction and generated behavior; do not choose a stopping point from training loss alone.
E4. Optimizer moments, schedule position, scaler state where used, data order, or random-generator state may differ. A snapshot taken during accumulation also needs partial gradients. Exact replay further depends on deterministic execution and the same environment.
E5. Compute each microbatch’s contribution to the intended supervised-token mean, then accumulate gradients without stepping. Unscale if required, inspect for nonfinite values, and clip the combined gradient once. Apply one optimizer update, advance the declared schedule counter, and clear gradients.
E6. Freeze the dataset, tokenizer, scoring protocol, and baseline. Declare whether training exposure, compute, or elapsed time is the primary equal budget, and report the others. Repeat runs and inspect learning curves. If a variant remains undertrained, report that limitation instead of treating its current rank as permanent.