RLOO
Back to Basics: REINFORCE Leave-One-Out (RLOO) Ahmadian et al. (Cohere) arXiv
RLOO measures how much each answer beats or trails the average of the other answers to the same question.
Why it mattered
In GRPO, subtracting the group mean that includes sample shrinks the advantage by , and dividing by a 4-sample standard deviation injects huge variance. Cohere showed that classic REINFORCE with a leave-one-out baseline beats PPO while needing only completions per prompt and zero critic network.
Core insightFor each completion in a -sample group, compute its baseline from the other samples: Pair this unbiased advantage with importance-sampling policy gradients and KL-to-reference shaping.
GRPORecipe(advantage='rloo', validator='math', group_size=4, kl_coef=0.02) runs leave-one-out RL server-side in one CLI or SDK command with single-GPU initial-weight Schulman k3 KL. Need unclipped losses.ImportanceSampling() or custom Python environments? Drop down to interactive Trainer with advantages.RLOO().
When to use
Use RLOO when rollout generation is expensive (long contexts, slow sandboxes, or tool calls) and you want an unbiased critic-free baseline with just samples per prompt. For larger groups () with multiple PPO epochs per batch, GRPO or Dr. GRPO is a better fit.
Step-by-step walkthrough
- 01
Import verifiable prompts into a versioned dataset
Pull GSM8K server-side with
client.datasets.from_hf()so prompts and reference answers live together in a versioned dataset.client.datasets.from_hf("openai/gsm8k", config="main", split="train", prompt="question", answer="answer", limit=2560, name="gsm8k-grpo") - 02
Configure compact K=4 groups with advantage='rloo'
GRPORecipe(advantage='rloo', group_size=4, kl_coef=0.02)excludes from its own baseline, halving rollout generation cost relative to while keeping the gradient estimator unbiased and anchored to frozen initial weights on the same GPU.GRPORecipe(model="qwen/qwen3-8b", validator="math", advantage="rloo", group_size=4, max_tokens=1024, kl_coef=0.02, max_steps=80) - 03
Launch on 1× GPU and monitor in grad runs watch
Preview token cost with
--dry-run, run with--max-cost-usd 8 --wait, and stream live rewards andkl_refviagrad runs watch rloo-gsm8k.grad runs watch rloo-gsm8k
Implementation
from grad import Grad, adapters
from grad.recipes import GRPORecipe
client = Grad()
ds = client.datasets.from_hf(
"openai/gsm8k", config="main", split="train", prompt="question", answer="answer", limit=2560, name="gsm8k-grpo"
)
recipe = GRPORecipe(
model="qwen/qwen3-8b",
validator="math",
advantage="rloo",
group_size=4,
max_tokens=1024,
kl_coef=0.02,
max_steps=80,
system_prompt="Solve step by step and end with \\boxed{...}.",
adapter=adapters.LoRA(rank=32),
)
run = client.runs.create(dataset=ds, name="rloo-gsm8k", recipe=recipe, max_cost_usd=8.0).wait()
print(run.artifact.ref, run.eval_report)Benchmarks
Reported results from the original paper compared against its baseline.
Models & datasets
| Model | Duration | Est. cost |
|---|---|---|
Qwen3 8Brecommendedqwen/qwen3-8b | ~18 min | ~$1.45 |
Qwen3 4Bfast smoke runqwen/qwen3-4b | ~9 min | ~$0.70 |
Gemma 4 12B ITgoogle/gemma-4-12b-it | ~24 min | ~$2.10 |
| Dataset | Source | Size |
|---|---|---|
| GSM8K Math | Hugging Face | 7,473 train / 1,319 test |
Practical gotchas
- RLOO requires
group_size >= 2; is the sweet spot between sampling cost and baseline variance. - Managed
GRPORecipetakes 1 optimizer step per rollout batch with clippedGRPOKL; if you run a custom interactiveTrainerloop with unclippedlosses.ImportanceSampling(), keep it to 1 step per batch or switch tolosses.PPO(). - Keep
kl_coefaround0.01–0.04on verifiable reasoning tasks so the policy stays coherent without choking exploration.