Practice / interactive lab
Build the intuition yourself
The exercises move from arithmetic to architecture. Change the inputs, predict the result before revealing it, and write down the assumption that makes each answer true.
Lab 1: delayed reward
Use rewards [0, 0, 0, 10]. First predict every return at gamma 1.0. Then set gamma to 0.5. Which earlier decision loses the most credit? Change the final reward to -10 and explain why every earlier return changes sign.
At gamma one, every step sees the final ten. At gamma one-half, each extra step of delay halves the final contribution. The earliest action is most discounted. This is an objective choice, not a discovery that early actions mattered less in reality.
Lab 2: PPO's asymmetric clip
Set advantage to +2 and sweep the probability ratio from 0.5 to 1.5. Then set advantage to -2 and repeat. Notice which side of one becomes flat. Explain why the minimum of clipped and unclipped objectives is pessimistic in both cases.
"PPO prevents the policy from changing more than 20 percent." The clip changes the sample objective outside a ratio interval; the aggregate policy can still move, so implementations monitor KL and update statistics.
Lab 3: when GRPO has no lesson
Try reward groups [0,0,0,1], [1,1,1,1], and [0.49,0.50,0.51,0.50]. Which group has the strongest ranking signal? Which has none? What could a zero-variance group mean besides "the policy is perfect"?
Equal rewards normalize to zero. The checker may be saturated, too coarse, broken, or the samples may lack diversity. Group normalization cannot create information absent from reward variation.
Lab 4: design an attack on the reward
The reasoning reward is 60 percent correctness, 25 percent evidence discipline, and 15 percent calibration, with a hard non-fabrication gate. Invent one trace that games each soft component. Then fail the hard gate and observe why the weighted score no longer matters.
Lab 5: memory budget before benchmark
Set parameters to 70B, weights to 4 bits, 80 layers, 32,000 active tokens, eight KV heads, and head dimension 128. Record nominal weight and KV memory. Multiply KV by 32 concurrent sequences. List four memory consumers the toy omits.
Quantization scales and metadata, allocator fragmentation, temporary activations, runtime workspace, graph captures, tokenizer/host buffers, adapters, and safety headroom are all plausible.
Lab 6: identify the roof
Hold peak compute and bandwidth fixed. Increase work without increasing bytes, then increase bytes without increasing work. Predict when the bottleneck flips. Explain why batching often raises decode arithmetic intensity.
Lab 7: speculation must repay itself
Start with target 12 ms, draft 4 ms, verify 14 ms, and four accepted tokens. Reduce acceptance until speedup falls below one. Then halve draft time. Explain why the answer could change at high concurrency even with identical acceptance.
At high concurrency, ordinary decode may already be compute-efficient. Verification adds target work to a saturated resource, so the low-concurrency toy can overstate fleet throughput benefit.
Lab 8: raw throughput versus goodput
Increase late and failed tokens. Raw tokens rise while good tokens stay fixed. Design a benchmark result that looks impressive under throughput and poor under SLO goodput. Decide whether task quality should be another gate.
Capstone: design one learning release
Your incident-reasoning policy checks the correct alternate path in 25 percent of attempts. Best-of-eight succeeds in 80 percent of scenarios. Final-cause checking is deterministic, but evidence quality needs a rubric. User-facing service must deliver the first token within one second and the full answer within 25 seconds.
Write a one-page proposal containing:
- The environment state, observation, action, termination, and forbidden-information contract.
- Development, validation, and release-holdout splits, including which access is budgeted.
- A baseline ladder: prompt/orchestration, best-of-n, SFT, preference optimization, and the condition that would justify RLVR.
- Reward components, hard gates, five adversarial traces, and an independent release scorecard.
- Rollout volume, group size, policy-version freshness, tool-sandbox capacity, and the metric "valid informative trajectories per GPU-hour."
- Production workload classes, TTFT/ITL/E2E SLOs, memory budget, warm floor, and burst policy.
- A canary and rollback plan that binds model, tokenizer, prompt, runtime, precision, and decoding configuration.
Chooses SFT as the first training baseline because strong behavior already exists, preserves RLVR as a later experiment, protects the holdout, keeps reward components visible, and plans serving capacity from the changed trajectory shape rather than assuming the model update is operationally free.
References
Sources and further reading collects the primary literature. The glossary defines the terms used in the exercises.