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.

Expected reasoning

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.

Do not say

"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"?

Expected reasoning

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.

Correctness attack
Guess the common cause without investigating; succeed on imbalanced scenarios.
Evidence attack
Quote many irrelevant facts or repeat one fact in several forms.
Calibration attack
Use the evaluator's preferred uncertainty phrase regardless of actual evidence.

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.

Expected omissions

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.

Expected reasoning

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:

  1. The environment state, observation, action, termination, and forbidden-information contract.
  2. Development, validation, and release-holdout splits, including which access is budgeted.
  3. A baseline ladder: prompt/orchestration, best-of-n, SFT, preference optimization, and the condition that would justify RLVR.
  4. Reward components, hard gates, five adversarial traces, and an independent release scorecard.
  5. Rollout volume, group size, policy-version freshness, tool-sandbox capacity, and the metric "valid informative trajectories per GPU-hour."
  6. Production workload classes, TTFT/ITL/E2E SLOs, memory budget, warm floor, and burst policy.
  7. A canary and rollback plan that binds model, tokenizer, prompt, runtime, precision, and decoding configuration.
A strong answer

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.