Unit 9 of 13 · about 4 hours · explain, measure
Colocated versus disaggregated generation, batching, backpressure and starvation
Batching and placement decide throughput. A fast generator with a full queue still starves the learner.
You'll be able to
- Contrast colocated and disaggregated generation by memory sharing, weight sync and failure scope.
- Measure batched versus single-example generation in wall time and memory on a tiny workload.
- Explain backpressure and starvation with queue evidence from a rollout-update loop.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Batched versus single-example executionBuild a Reasoning Model (From Scratch) - Chapters 3, 6 and 8
Appendix E, Sections E.1 to E.8, printed pp.365-376: latency versus throughput, left padding with attention masks, batched MATH-500 evaluation, batched GRPO rollouts with
rlvr_grpo_original_no_kl_batched.py, Table E.1 wall-time and memory rows - Colocated versus disaggregated rolloutveRL
One-step-off design at commit 8718ca3: colocated hybrid engine sharing GPUs with NCCL reshard versus disaggregated rollout with explicit rollout resources and tensor-by-tensor broadcast; overlapped generation with
GenerationBatchFuture - Generation throughput and queue signalsHands-on Modern RL - Reasoning, Agentic RL and Safety
Generation versus memory: PagedAttention with continuous batching and prefix caching, ZeRO stages with checkpointing cost, bottleneck thresholds for rollout share, sync share and communication share (page read 2026-10-14)
Read the thresholds as diagnosis signals. Do not run multi-GPU systems here.
Focus on
- Colocated shares GPUs and syncs fast with NCCL. Disaggregated separates resources and pays explicit transfer.
- Batching is a throughput optimization, not a universal speedup. Small CPU models can gain little after padding overhead.
- Backpressure means the rollout queue is full and the generator must wait. Starvation means the learner queue is empty.
- Table E.1 shows the pattern on H100 total time: batched MATH-500 cuts 90 to 16 minutes (DGX Spark 174 to 108 minutes) while distillation batching moves only 10 to 9 minutes.
Common mistakes · 3
- Expecting batching to speed up every device. Padding and mask bookkeeping can erase the gain on small setups.
- Sizing queues by generator speed alone. Verifier throughput and update time set the sustainable rate.
- Treating disaggregation as pure win. Separate resources add transfer, scheduling and failure scope.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.When does colocated beat disaggregated?Answer
Small jobs with fast NCCL reshard and one failure scope. Large or tool-heavy rollouts favor separation.
2.The rollout queue is full while the learner is busy. What is that?Answer
Backpressure on the generator. Slow or drop intake; do not grow the queue without bound.
3.The learner queue stays empty while rollouts trickle in. What is that?Answer
Learner starvation. Generation or verification is the bottleneck, not the update.
4.On the author's H100, batched evaluation cut 90 to 16 minutes but batched distillation barely moved. Why might that pattern appear, and what profile would confirm it?Answer
Evaluation parallelizes independent prompts well. Distillation may already be bound elsewhere, so batching adds padding without removing the bottleneck. A per-stage time and memory profile on your machine would confirm which.
Practice
- Build a Reasoning Model: batched generation and GRPO rollouts
Appendix E, Sections E.4 and E.6 with
rlvr_grpo_original_no_kl_batched.pyanddistill_batched.py(check the repository README for the exact flags); compare single-example versus batched wall time and peak memory on your machineStart with 2 prompts on CPU or your GPU. Batching targets throughput; record both time and memory.
You're done when
Your batched-versus-single table shows time and memory on the same workload, and you can name the bottleneck from queue evidence.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 10 more in the section
- Build a Reasoning Model (From Scratch) - Chapters 3, 6 and 8Sebastian Raschka (Manning) · support
Use Chapter 3 (a math verifier: boxed-answer extraction, normalization and equivalence checks), Chapter 6 (RLVR with GRPO on a MATH subset) and Chapter 8 (distillation from filtered rollouts) as the smallest verifier-to-distillation path on Qwen3 0.6B.
- Hands-on Modern RL - Reasoning, Agentic RL and SafetyWalking Labs · support
Use the build-an-agentic-training-system page (a from-scratch trainer exercise), one reasoning or search control and the reward-hacking evaluation chapter selectively. Skip the pages that need API keys or several GPUs and the frontier surveys. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers. - veRLByteDance · support
Inspect the hybrid-controller architecture, worker roles, supported algorithms and examples at commit 8718ca3 after single-device losses pass. Trace one rollout from generation through reward and update, record policy lag and run only hardware-compatible examples.
Also in this section
- RLHF Book - Reasoning, Synthetic Data, Tools and EvaluationNathan Lambert · primary
Study Chapter 7 (reasoning and inference-time scaling), Chapter 12 (synthetic data and on-policy distillation), Chapter 13 (tool use), Chapter 14 (over-optimization) and Chapter 16 (evaluation). Build a claim map separating RLVR learning, inference-time search, on-policy distillation, tool trajectories, reward overoptimization and independent evaluation.
- RLHF Book Course - Lectures 5, 7, 11 and 12Nathan Lambert · required
Use Lecture 5 (the rise of reasoning models), Lecture 7 (synthetic data and modern post-training), Lecture 11 (tool use and the road to agents) and Lecture 12 (frontier model evaluation). Tie every mechanism to a distinct data and compute budget.
- DeepSeek-R1 Technical ReportDeepSeek AI · required
Read version 2 of the report (January 2026; the Nature 2025 paper is the peer-reviewed version): the R1-Zero and R1 training pipeline, reward design, observed behaviors and limitations. Reproduce only a reduced verifier-driven question and test whether longer sampling or selection explains the observed gain.
- Tulu 3: Pushing Frontiers in Open Language Model Post-TrainingLambert et al. (Ai2, 2024) · support
Read the RLVR section: verifiable rewards for math, instruction following and constraints, and how the RLVR stage sits after SFT and DPO. Compare its recipe with R1-Zero on what is rewarded and what is held out.
- STaR: Bootstrapping Reasoning With ReasoningZelikman et al. (NeurIPS 2022) · support
Read the generate, filter by correctness and fine-tune loop and the rationalization step. Use it as the rejection fine-tuning control that an RL method must beat at matched samples.
- RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement LearningWang et al. (2025) · support
Read the multi-turn trajectory formulation and the training instabilities it reports for agent RL (collapse into repetitive reasoning). Use it to design the diagnostics for a small multi-turn environment.
- Stanford CS224R 2026 LLM RL Default Project - ExtensionStanford University · required
Use the specification sections on SFT, IPO, RLOO, evaluation and one extension such as off-policy sampling, test-time inference, exploration, self-play or tool reasoning. Build independent code on a distinct task and respect all course restrictions.
- Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - LLM RL Default Final ProjectUC Berkeley · support
Read the default project for open-ended instruction following: offline DPO, IPO and AOT, online GRPO, Dr. GRPO and GSPO, and judge-based win rates against a frozen base. Use it as a second extension menu; its compute assumes cloud GPUs and a paid judge model.
- LLM Post-Training Laboratory - Final IntegrationRoadmap-Final · required
Finish the bounded rollout and verification queue, reasoning or tool extension, independent clean and adversarial evaluation, reward-hacking postmortem, policy-lag and throughput records, clean reproduction and one prespecified negative or positive result.
- Reinforcement Learning CheckpointRoadmap-Final · support
Take the checkpoint closed-note after the integrated project. Pass the estimator and state reconstruction, unseen failure diagnosis, matched-budget comparison, external evaluation and research-readiness clauses.