tinker-nomics

RL Systems for LLMs

Three phases, one surprising bottleneck.

Every RLVR training iteration decomposes into three phases with starkly different compute profiles. Understanding this breakdown is the foundation of any cost model.

1Rollout Generation

Wall-clock: 80–90%

FLOPs: 2N per token

Bound by: Memory bandwidth

Autoregressive decoding. The policy generates G completions per prompt, each averaging L tokens. Despite fewer FLOPs per token than training, this dominates because of low hardware utilization during sequential generation.

2Reward Scoring

Wall-clock: 5–30%

FLOPs: 0 → 2N per token

Bound by: Varies (see below)

Ranges from free (verifiable rewards like math/code) to a full neural forward pass (learned reward model) or multiple LLM grading calls (rubric-based). Most real deployments aren't pure RLVR.

3Policy Update

Wall-clock: 10–15%

FLOPs: 6N per token

Bound by: Compute

Backward pass through the policy. 3x the per-token FLOPs of rollout, but runs at 30–50% MFU vs single-digit MFU during decoding. Higher utilization means less wall-clock time.

The inversion

A useful rule of thumb: at production scale, you typically need ~6 sampler workers to saturate 1 trainer — the generation bottleneck is that severe.

This is the core insight: the phase with fewer FLOPs per token dominates the cost. Rollout generation costs 2N FLOPs/token versus 6N for training — yet it consumes 80-90% of wall-clock time. The reason is utilization: autoregressive decoding reads all model weights for each token but only performs a single matrix-vector multiply, achieving single-digit percent of peak TFLOPS. Training parallelizes across tokens and achieves 30-50% of peak.

The Laminar framework paper confirms this empirically: up to 83.1% of total execution time is spent on generation for reasoning tasks.

The reward signal spectrum

The cost breakdown above assumes Phase 2 is cheap. That's true for textbook RLVR on math — checkers are essentially free. But even “verifiable” rewards can be expensive. Code generation and SWE tasks require spinning up Docker containers, running test suites, and waiting for execution — far more costly than an LLM-as-judge rubric call. A SWE-bench evaluation averages ~3.5 minutes per instance. The term “verifiable” says nothing about cost.

More fundamentally, the reward function is part of an environment integration — like an OpenAI Gym environment. The right abstraction isn't “reward function as a component of the RL framework” — it's the environment that encapsulates task setup, execution, observation, and reward. Frameworks that treat reward functions as a first-class internal concern are conflating levels of abstraction. In practice, the reward comes from one of three places:

Verifiable rewards

Cost: ~0Latency: < 1 sec

Math correctness, unit tests, format checks

Deterministic functions that check a ground truth answer or execute code in a sandbox. The ProblemEnv base class in tinker-cookbook's math_rl and code_rl recipes implements this: check_answer() returns a binary 0/1 reward, combined with a format penalty. Cost is essentially zero — but the domain is limited to tasks with objectively correct answers.

Rubric-based / LLM-as-judge

Cost: External API costLatency: 2–30 sec per rubric

Instruction quality, helpfulness, safety, style

A separate LLM grades the policy's response against structured rubric criteria. This is the approach in tinker-cookbook's rubric recipe: each response is graded by a grader LLM (e.g. Qwen3-30B-A3B) against multiple rubric items in parallel, scores are extracted via regex, and averaged into a 0–1 reward. Crucially, the grader is hosted externally (an inference API or separate cluster) — it doesn't consume your training VRAM. But the grading calls take real wall-clock time: for G=16 completions with 3 rubric items, that's 48 grading calls per prompt, and the latency can bottleneck iteration speed.

Learned reward model

Cost: 2N FLOPs/tok + VRAMLatency: Tied to batch

RLHF preference alignment, human-feedback proxy

A neural model trained on human preference data scores each completion. The classical RLHF pipeline (tinker-cookbook's preference/rlhf recipe) has three stages: SFT the policy, train a reward model on preference comparisons, then RL against the RM. Unlike LLM-as-judge, the RM lives in your training infrastructure — either colocated (eating VRAM via time-multiplexing) or on GPUs you provision yourself. A full forward pass per completion at 2N FLOPs/token, plus with PPO this means 4 model copies in VRAM simultaneously. And you pay the upfront cost of collecting and labeling preference data to train the RM in the first place.

The trend is clear: as you move from verifiable to learned rewards, Phase 2 goes from negligible to a dominant cost center. And there's a hidden cost that none of these categories capture: data and environment creation. Building the rubrics, curating preference pairs, setting up sandboxed execution environments, writing unit tests — this is engineering and domain-expert time that doesn't show up in GPU-hours but can easily dominate the total project cost for non-math/code tasks.

The hidden cost: data and environment

For math and code, environments are open-source datasets with built-in verifiers (GSM8K, MATH, LiveCodeBench). For everything else, you need to build them. A rubric-based setup requires: (1) curating prompts that cover your task distribution, (2) writing rubrics specific enough for a grader LLM to score consistently, (3) calibrating grader prompts to avoid reward hacking. An RLHF setup requires: (1) collecting diverse completions, (2) paying human annotators for pairwise preferences, (3) training and validating the reward model before you even start RL. This is why the RL research literature skews heavily toward math and code — not because those are the most valuable tasks, but because they have free, high-quality reward signals.

How frameworks handle reward model deployment

In practice, most RLVR tasks use verifiable rewards (math checkers, unit tests, format validators) — so the reward model placement question rarely dominates system design. When you do need a learned RM or LLM-as-judge, the question becomes: where does it live?

At scale, the dominant approach is disaggregated deployment — separate GPU pools for generation, training, and reward scoring. Colocated setups that time-multiplex GPU memory (only one of {generation, RM, training} occupies VRAM at a time) are mainly used for small-scale runs where provisioning separate pools isn't worth the overhead. Note that colocated time-multiplexing is inherently synchronous — you can't overlap phases on the same GPUs.

FrameworkRM deploymentMemory strategyLLM-as-judge
veRLColocated or separate poolvLLM sleep_replicas() offloads rollout weights, freeing VRAM for RMGenRM path: async HTTP to a grading endpoint; streaming mode scores as rollouts finish
OpenRLHFSeparate GPUs via Ray (default)Fully disaggregated: actor, critic, RM, reference each get their own GPU group--remote_rm_url points to any HTTP reward server
TRLColocated onlyDeepSpeed ZeRO + PEFT adapter sharing (policy & RM share base weights)Custom reward_funcs in GRPOTrainer; no built-in GenRM
SLiMEColocated or disaggregatedoffload_train / offload_rollout swap phases on same GPUs--async-rm flag; GLM-5 uses multi-source feedback (rules + RLHF + RLAIF)
NeMo-AlignerCritic+RM job colocated, actor separateCPU weight swapping between critic and RM within the same GPU groupNeMo Gym environments include “Math With Judge” and equivalence-judge envs

At large scale, disaggregated deployment (separate GPU pools per component) is the default — it's simpler to scale and enables fully async pipelines where generation, scoring, and training overlap. OpenRLHF exemplifies this. Colocated approaches like veRL's sleep/wake, SLiME's offload, and NeMo's CPU swap share a common idea — only one phase occupies GPU memory at a time — but these are primarily useful for small-scale runs (≤8B models on a few GPUs) where the overhead of managing separate pools isn't justified.

For LLM-as-judge (when it's needed — most RLVR tasks don't require it), the dominant pattern is an external inference endpoint. veRL's GenRM and OpenRLHF's --remote_rm_url both decouple the grader from training GPUs entirely — you call an inference API behind an HTTP endpoint, and the training loop sends async requests. This is architecturally identical to how tinker-cookbook's rubric recipe works: the grader LLM runs on Tinker's inference service, not on the training GPUs.

This matters for cost modeling. LLM-as-judge is an external inference cost — the grader model is hosted elsewhere (an API, a separate inference cluster), so it doesn't appear in your training GPU budget at all. You pay per-token to the inference provider, and that cost scales with group size and rubric count, but it's a line item on a different bill. A learned reward model is a training infrastructure cost — it sits in your VRAM (colocated) or on GPUs you provision (disaggregated). Either way, it's GPU-hours you're paying for directly and must account for in capacity planning.

There's also a latency consideration that affects throughput. With verifiable rewards, scoring takes milliseconds — it never bottlenecks the pipeline. With a colocated RM, the forward pass adds wall-clock time to each step but runs at GPU speed. But with LLM-as-judge, the grading calls can take 2–30 seconds per rubric item, and even with async parallelism, this can become the pacing bottleneck for rollout evaluation. If your GRPO group size is 16 and you have 3 rubric items, you're waiting on 48 inference calls to complete before the policy update can start. At scale, the reward evaluation latency — not the reward compute cost — becomes the binding constraint on iteration speed.

The long-tail problem

During rollout, all GPUs generate completions in parallel. But completion lengths follow a long-tail distribution — the 99th percentile can exceed the median by an order of magnitude. Every GPU must wait for the longest completion to finish before the batch can proceed. This synchronization penalty is invisible in FLOP accounting but very real in wall-clock time.

Worse, response length grows during training — typically 1.5-3x over the course of a run as the model learns to produce longer reasoning chains. This makes rollout cost the single most volatile variable in the entire cost model.

Algorithm memory comparison

The choice of RL algorithm has a first-order effect on VRAM. The table below shows which model copies each algorithm requires in memory simultaneously. Source: RLHF Book (Lambert, 2026), Chapter 6.

AlgorithmPolicyReward modelValue fnReferenceCopies in VRAM
PPO4
GRPO3
RLOO2
DPO2

The “reward model” column is where the reward signal spectrum matters most. With verifiable rewards (math, code), the RM is a deterministic verifier — GRPO needs only 2 model copies (policy + reference). With rubric-based grading, the grader LLM runs separately (via inference API, not in training VRAM) — still 2 copies for GRPO, but inference cost for the grader. With a learned reward model, you're back to 3+ copies. With LoRA, adapters add only ~100–500 MB per model on top of frozen weights, plus Adam optimizer states (~2× adapter size in FP32). This is why GRPO + LoRA + verifiable rewards fits on far fewer GPUs than PPO + full fine-tune + learned RM.

Multi-turn: the prefill multiplier

For single-turn tasks (math, code generation), the token accounting is straightforward: total inference tokens ≈ total training tokens. You generate B × G completions per step, each averaging L tokens, and then train on those same tokens. The prefill-decode ratio is fixed by your prompt length.

Multi-turn changes this significantly. Each turn requires a new prefill that includes the full conversation history — all prior turns' prompts and responses become the next turn's prompt. For a 10-turn trajectory:

Turn 1: prefill prompt (512 tok) + decode response (~2K tok)

Turn 2: prefill prompt+resp1 (~2.5K tok) + decode (~2K tok)

Turn 3: prefill all prior (~4.5K tok) + decode (~2K tok)

...

Turn 10: prefill all prior (~18K tok) + decode (~2K tok)

The prefill tokens grow quadratically with turns — you're re-encoding the entire history at each step. For the harbor_rl workload (10 turns, ~20K trajectory), prefill accounts for ~60% of total inference tokens, compared to <5% in single-turn math. This is why multi-turn agentic tasks are disproportionately expensive: the model is “yappy” — generating many short responses that each require re-reading a growing context.

For cost estimation, the multiplier is roughly: total_inference_tokens ≈ decode_tokens × (1 + turns/2) for a uniform-length trajectory. As an API consumer paying per-token, this is the key number — you don't care about MFU or packing, you care about how many tokens flow through the system.

How much compute do I actually need?

Here are the three tinker-cookbook recipes sized across H100 and B200. These are the minimum GPU counts to fit the model (policy + reference + overhead) and the estimated wall-clock for a full run. Numbers from the cost model — plug in your own parameters in the calculator.

RecipeModelH100 SXM (80 GB)B200 SXM (192 GB)
Min GPUsWall-clockGPU-hrsMin GPUsWall-clockGPU-hrs
math_rlMath reasoningQwen3-8B2×1.8h14.32×29m3.9
code_rlCode generation (SWE)Qwen3-4B2×140.1h11212×56.2h449.4
harbor_rlAgent / tool useKimi-K2-Thinking90×182.0h16381.938×120.0h4562

Min GPUs = minimum to hold policy + reference in VRAM (GRPO + LoRA, BF16, 1.4× overhead). Wall-clock uses 8 GPUs for math_rl/code_rl, min required for harbor_rl (Kimi-K2 at 1T params). B200 gains come from 2.4× higher bandwidth (faster rollout) and 4.5× higher TFLOPs (faster training).

A reference data point

Epoch AI estimates DeepSeek R1's RL phase at ~6.1 x 10²³ FLOPs — roughly 20% of V3's pretraining cost, or approximately $1M on H800 hardware. This gives a sense of RLVR costs at frontier scale: significant, but an order of magnitude cheaper than pretraining.

Further reading

  • RL for LLMs (Aweers, 2026) — comprehensive walkthrough of GRPO, PPO, and modern RL algorithms for language models.
  • RLHF Book (Lambert, 2026) — in-depth treatment of alignment algorithms and their compute requirements.
  • Laminar framework — empirical analysis confirming rollout dominates RL training time (up to 83% for reasoning tasks).