Exercises — Reading and reproducing ML papers
These problems build from recognizing the parts of a paper up to synthesizing a full reproduction plan. Each has a full worked solution hidden inside a collapsible callout — try the problem first, then reveal.
This page is the graded workbook for the parent topic. Prerequisites you may want open in another tab: Statistical Significance Testing, Experiment Tracking and Versioning, Attention Mechanisms.
Level 1 — Recognition
Can you name the parts and recall the definitions?
Exercise 1.1 (L1)
A colleague hands you a paper and says "just skim it, decide in ten minutes." List, in reading order, the six things you read during a Pass-1 survey, and state the single decision this pass produces.
Recall Solution 1.1
Reading order (this order matters — you go from cheapest to costliest signal):
- Title + Abstract → the main claim.
- Introduction, first 2 paragraphs → problem & motivation.
- Section headings → shape of the solution.
- Conclusion → what was actually achieved.
- Figures & captions → the visual story.
- References → do you recognize the key citations?
The one decision Pass 1 produces: should I invest more time in this paper — yes or no? Nothing else. You are not trying to understand the method yet.
Exercise 1.2 (L1)
Match each term to its meaning: (a) Replication (b) Reproduction (c) Ablation reproduction — (i) rebuild from the paper's description, implementation may differ; (ii) exact recreation with the same data and code; (iii) rebuild just enough to test whether a claimed component actually matters.
Recall Solution 1.2
- (a) Replication → (ii) exact recreation with same data/code.
- (b) Reproduction → (i) rebuild from description, may differ in details.
- (c) Ablation reproduction → (iii) test one claimed component (e.g. "remove skip connections — does it really hurt?").
Mnemonic: Replicate = re-run, Reproduce = rebuild, Ablate = remove-and-measure.
Exercise 1.3 (L1)
In the residual-learning equation , name each of the three symbols in plain words.
Recall Solution 1.3
- = the input to the block (a vector of numbers — the "signal coming in").
- = the desired output of the block — the full transformation we wish the block computed.
- = the residual — literally "what is left over", , the change the block must add on top of the input.
The whole trick of ResNet is: don't learn the whole output , learn only the leftover .
Level 2 — Application
Apply the definitions to concrete numbers and situations.
Exercise 2.1 (L2)
The Transformer paper uses key/query dimension . Assume every entry of and is drawn independently from (mean , variance ). A single entry of is the dot product . Compute its variance, then state what the paper divides by and why.
Recall Solution 2.1
Step 1 — what one term contributes. Each summand is , a product of two independent variables. For independent zero-mean unit-variance : Step 2 — add up independent terms. Variance of a sum of independent things is the sum of variances: Step 3 — the fix. The paper divides the scores by . Dividing a random variable by a constant divides its variance by , so: Variance is pushed back to , so the softmax input stays in a sensible range and does not saturate.
Exercise 2.2 (L2)
Look at the two curves in the figure below. Without the scaling, the softmax receives inputs with standard deviation ; with scaling it receives standard deviation . Explain in one sentence what "saturation" means here and why it kills learning.

Recall Solution 2.2
Saturation = the softmax output becomes almost a one-hot spike: one entry ≈ , the rest ≈ . Look at the red curve — when the inputs spread out to std , the largest score dominates so hard that softmax rounds it to "all attention on one token".
Why that kills learning: the gradient of softmax is proportional to (each output times one-minus-itself). When or , that product — the gradient vanishes, so backprop sends almost no learning signal through. The black (scaled) curve keeps outputs spread out, so stays healthily away from zero.
Exercise 2.3 (L2)
You reproduce a model and, as a first checkpoint, train it on only 10 samples. After many epochs it reaches 100 % training accuracy. What does this tell you — and what does it not tell you?
Recall Solution 2.3
What it tells you (the sanity/overfit check): your forward pass, loss function, and backprop are wired correctly. A model with enough capacity must be able to memorize 10 examples; if it can't, you have a bug (wrong loss sign, detached gradient, frozen weights, label/feature mismatch).
What it does NOT tell you: anything about generalization. Memorizing 10 points says nothing about test accuracy, nothing about matching the paper's reported number. That is a different checkpoint (the "baseline check").
Order of the three reproduction checkpoints: overfit-10 → baseline match → ablation. This exercise is only the first.
Level 3 — Analysis
Reason about why things break and when claims are trustworthy.
Exercise 3.1 (L3)
A paper reports its method scores 91.2 vs a baseline 90.7 on a benchmark, from a single run each. The abstract calls this "a significant improvement." As a critical reader, list three questions you must ask before believing it, and name the vault concept that governs each.
Recall Solution 3.1
- What is the run-to-run variance? A single seed tells you nothing about spread. If restarting the same method gives , then is inside the noise. → Statistical Significance Testing.
- Was a significance test actually run? "Significant" in prose ≠ statistically significant. Ask for a paired test (e.g. across seeds) and a p-value or confidence interval. → Statistical Significance Testing.
- Was everything else held fixed? Different hyperparameters/tuning budget for the two methods invalidates the comparison — the gain may just be better Hyperparameter Tuning on their method, not a better method.
Verdict: a -point gap from single runs with no error bars is not yet evidence. Suspend belief.
Exercise 3.2 (L3)
The parent note's ResNet gradient derivation ends with Explain, using this equation, why a residual connection fights vanishing gradients. Then say what happens in a plain (non-residual) block for comparison.
Recall Solution 3.2
Read the equation as "the gradient that reaches the input equals the incoming gradient times (the block's own Jacobian the identity )".
Residual case: even if the learned part becomes tiny (weights shrink, activations saturate), the guarantees the incoming gradient passes through undamped. There is always a clean "highway" straight back to .
Plain block: there is no — you'd get . Stack many such layers and you multiply many Jacobians together; if each has magnitude , the product shrinks geometrically toward zero — the vanishing-gradient problem. The identity term breaks that multiplicative decay into an additive path.
Exercise 3.3 (L3)
During reproduction your model trains fine but scores 4 points below the paper. You suspect the data pipeline. Give an ordered debugging plan and justify the ordering.
Recall Solution 3.3
Order by cheapest-to-check × most-likely-culprit (this is Model Debugging applied to reproduction):
- Re-verify the overfit-10 check still passes — rule out a fresh code regression.
- Print tensor shapes and value ranges at every stage — catch a normalization gone wrong (e.g. images in instead of , or wrong mean/std).
- Confirm the exact train/val/test split — a leaked or differently-sized split shifts numbers by several points.
- Match augmentation — random crop/flip settings are routinely under-specified; missing them under-fits, over-doing them under-trains.
- Only then question architecture/init/optimizer.
Why this order: the parent note flags the data pipeline as "where most bugs hide," and each earlier step is faster and more likely than the next. Log every attempt with Experiment Tracking and Versioning so you never re-run the same failed config.
Level 4 — Synthesis
Combine ideas into a plan or a derivation of your own.
Exercise 4.1 (L4)
You just finished Pass 1 on a paper claiming "self-attention replaces recurrence for sequence modelling." Write a Forecast-then-Verify note: three predictions you'd commit to before reading the method, each with the reason you'd bet on it.
Recall Solution 4.1
A good answer commits to falsifiable guesses, e.g.:
- "The main challenge is letting every position see every other position without a fixed order." — Reason: recurrence processes tokens one-by-one; removing it means you need an all-pairs interaction. (This is exactly what attention gives — see Attention Mechanisms.)
- "They will need to re-inject position information somehow." — Reason: an unordered all-pairs operation is permutation-invariant, so word order would be lost; the paper must add positional encodings. (Correct — it does.)
- "Some numerical stabilizer will appear on the attention scores." — Reason: summing many products blows variance up (Ex 2.1), so you'd expect a normalization — and indeed the scaling appears.
The value isn't being right — it's that a wrong forecast pinpoints exactly which paragraph to read slowly.
Exercise 4.2 (L4)
Derive the scaling yourself for a general (don't just plug in 64). Show that with the divisor , the score variance is , and solve for the that makes it exactly .
Recall Solution 4.2
Setup. Score before scaling: , with i.i.d. . From Ex 2.1, .
Introduce a general divisor . Scaled score . Dividing by a constant divides variance by its square: Impose the design goal : So the scaling factor is forced — it is the unique constant that restores unit variance regardless of . That's why the paper writes and not any other divisor.
Level 5 — Mastery
Full end-to-end judgement under realistic constraints.
Exercise 5.1 (L5)
You must reproduce a Transformer result and confirm the scaling actually matters. Design the minimal experiment: state the two model variants, the three verification checkpoints in order, and — given the parent note reports "remove scaling → BLEU drops 3.2 points (paper claims 2.8)" — state the criterion under which you'd call the ablation a successful reproduction.
Recall Solution 5.1
Two variants (change exactly one thing — that is what makes it an ablation):
- A (full): attention with the divisor.
- B (ablated): identical code, divisor removed. Everything else — data, seed protocol, epochs, optimizer, init — held fixed via Experiment Tracking and Versioning.
Three checkpoints, in order:
- Overfit-10: variant A memorizes 10 sentence pairs → 100 % train accuracy. Confirms the plumbing.
- Baseline match: variant A's WMT'14 En–De BLEU lands within ~0.5 of the reported number.
- Ablation: run B; measure the BLEU drop A → B.
Success criterion for the ablation: you observe a drop of the same sign and rough magnitude as claimed. Paper claims ; you see ; the difference is points — well within run-to-run noise and far smaller than the effect itself. The direction (removing scaling hurts) and scale (≈3 points, not 0.1 and not 30) both match, so you accept the claim as reproduced. Do not demand an exact number match — different seeds/hardware guarantee small differences (this is reproduction, not replication; see Ex 1.2).
Exercise 5.2 (L5)
Rank these four sections of a paper by value-per-minute for a reader who wants to reproduce the result, using the 80/20 principle, and justify the top and bottom of your ranking.
Sections: (a) Related Work, (b) Core equation / method, (c) Main results table, (d) Ablation study.
Recall Solution 5.2
Ranking (highest value-per-minute first): (b) core equation ≈ (d) ablation > (c) results table > (a) related work.
- Top — (b) core method: you literally cannot reproduce without it; it's usually one equation but it's the equation. (d) ablation is tied at the top for a reproducer because it tells you which components you must implement carefully versus which you can approximate — it directs your effort.
- (c) results table matters (it's your baseline-match target) but it's a number to hit, not something you build from, so slightly lower.
- Bottom — (a) related work: valuable for context and citing, but contributes almost nothing to rebuilding the method. Skim or skip unless you're missing prerequisite background (then follow the cite — e.g. into Transfer Learning or Attention Mechanisms).
This is the 80/20 rule in action: ~20 % of the page (b+d, plus the target in c) delivers ~80 % of the reproduction value.
Recall Self-test cloze
The unique divisor that restores unit variance to attention scores of dimension is ::: The three reproduction checkpoints in order are ::: overfit-10, baseline match, ablation Pass 1 produces exactly one decision, namely ::: whether to keep reading (yes/no) A reproduction is judged a success by ::: matching the sign and rough magnitude of the effect, not exact numbers
Related writing-up guidance lives in Paper Writing and Publication.