System Design Lab
An RLHF pipeline is a training loop where rollout generation, reward scoring, and policy updates fight over the same GPUs.
Change the preference dataset, how many rollouts each PPO step generates, the policy and reward-model sizes, the PPO epochs per batch, the KL penalty, and how often you eval. The design moves from SFT-only, to adding a reward model, to a full PPO rollout loop, to scaling rollout generation (the usual bottleneck), to eval gates and a DPO alternative that drops the RL loop entirely.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
InstructGPT: SFT, then a reward model, then PPO against a KL-penalized reference
The canonical RLHF recipe fine-tunes on demonstrations, trains a reward model from comparisons, and optimizes the policy with PPO using a per-token KL penalty against the SFT reference.
Ouyang et al., 2022 (InstructGPT)DPO removes the explicit reward model and RL rollout loop
Direct Preference Optimization shows the RLHF objective can be optimized with a simple classification loss on preference pairs, eliminating online sampling and a separate reward model.
Rafailov et al., 2023 (DPO)PPO is the clipped policy-gradient algorithm used in the RL stage
Proximal Policy Optimization takes several optimization epochs over each batch of sampled trajectories with a clipped objective, which is why rollouts are reused across PPO epochs.
Schulman et al., 2017 (PPO)Online RLHF couples generation and training; generation throughput dominates
High-throughput batched inference engines are used to generate rollouts because, in the online RL loop, sampling completions from the policy is the throughput bottleneck.
vLLM docsTeaching assumptions
- Single-GPU rollout-generation throughput and memory budgets are conservative teaching numbers, not vendor limits.
- Reward and reference scoring cost is modeled as one inference forward pass per rollout each; PPO reuses each rollout for the chosen number of epochs.
- KL drift risk is approximated from the KL coefficient and rollout volume; real runs also track measured KL and reward-hacking signals directly.