Implement On-Policy RL with Optimal re- ward baseline (OPO) (Microsoft Research)
Method description
What is OPO ?
This paper introduces OPO (On-Policy RL with Optimal reward baseline), a simpler and more efficient algorithm that:
-
Uses exact on-policy training for greater stability and better exploration.
-
Derives an optimal reward baseline to minimize gradient variance.
-
Eliminates the need for value/reference models and regularization.
Key Benefits of OPO:
-
Theoretical Soundness: Minimizes gradient variance with an optimal baseline.
-
Training Stability: Achieves stable learning without KL/entropy penalties.
-
Better Performance: Outperforms baselines in math reasoning tasks with more diverse and less repetitive outputs.
Performs almost equivalent to GRPO without need for KL penalties.
PS : I would like to implement this as this would be a learning experience for me 🤗
Open source status
- [x] The method implementation is available
- [x] The model weights are available
- [x] The training datasets are available
Provide useful links for the implementation
Paper : https://arxiv.org/pdf/2505.23585
Code : https://github.com/microsoft/LMOps/tree/main/opo
Base Model : https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
Training Data : https://huggingface.co/datasets/Skywork/Skywork-OR1-RL-Data
Evaluation Datasets: MATH-500, AIME 2024 , and AIME 2025.
Hey @Atharva-Phatak, sorry for the slow reply, we're catching up on the backlog. Nice suggestion. The good news is OPO is already mostly expressible with today's GRPO: beta=0 gives you the no-KL exact on-policy setup, and scale_rewards="none" drops the std normalization, so the genuine delta is OPO's length-weighted group baseline ($\sum \text{len}_i R_i / \sum \text{len}_i$) replacing the plain group mean here: https://github.com/huggingface/trl/blob/39fe5a6880b642e1b4940a0d571dc588ec06ec01/trl/trainer/grpo_trainer.py#L2177-L2199
That's a small, contained change (one config field + the weighted baseline in the advantage block), it's already merged in verl. The paper doesn't have yet a massive traction, but, we'd happily review a draft PR. For now I'll keep this open as a tracking thread, +1s from others who'd use OPO help us prioritize.
Hello! I would be happy to work on this. I plan to implement the length-weighted OPO reward baseline as a configurable GRPO option, add tests for the advantage calculation, and document the paper in paper_index.md, following the maintainer guidance above.
Closing this one. Most of OPO is already available today: beta=0.0 gives the no-KL exact on-policy setup and scale_rewards="none" drops the std normalization. The only genuine delta is the length-weighted group baseline, and that needs a new config option that I don't think is worth the permanent surface given there's been no further interest since this was opened.
@YAO-001 implemented it in #6620 and the code was fine, see my comment there.
Happy to revisit if the length-weighted baseline comes up again.