TL;DR
Training Large Language Models (LLMs) to reason through tough coding and math problems often stalls out when every guess the model makes fails equally, leaving nothing to learn from. ReST-RL solves this by restarting training midway through rare, successful attempts to spark fresh exploration, and then uses the newly sharpened model to train a lightweight "compass" (a Value Model) that guides tree search at test time. Together, these two stages dramatically boost reasoning accuracy while actually saving overall compute hours.
What Problem Does This Paper Address?
Right now, a popular way to teach LLMs complex reasoning is Group Relative Policy Optimization (GRPO)—an online reinforcement learning method where a model generates a batch of answers to a prompt, compares their scores, and nudges itself toward the better ones.
There’s a catch, though: if a coding problem is super hard and all sampled answers score zero (or if it's too easy and they all score 100%), the variance in rewards is zero. When there’s no contrast in the group, GRPO gets a flatline signal and learns nothing.
On the flip side, we can boost reasoning at test time by pairing LLMs with verifiers—like Process Reward Models (PRMs)—that check intermediate steps during tree search. However, building PRMs usually requires expensive human step-by-step annotations, or brittle automated heuristics that don't translate well to code generation (where a single line isn't strictly "right" or "wrong" until the whole program runs). How do we get rich, step-level learning and search guidance without massive annotation budgets or the instability of heavy actor-critic RL?
Methods
The authors propose ReST-RL, a two-stage pipeline that sequentially connects policy training and value-guided decoding rather than trying to juggle both simultaneously. Throughout the framework, a single "action" is defined simply as one line of text.
- ReST-GRPO (Policy Optimization): Building on Reinforced Self-Training (ReST), the model first samples multiple solutions offline and filters out prompts with low reward variance or universally terrible scores. Here is the clever twist: instead of training the model to blindly imitate the full winning solutions, ReST-GRPO chops winning solutions into partial prefixes (favoring earlier lines via an exponential distribution) and uses them as new starting contexts for online GRPO. Starting partway down a promising path guarantees fresh, high-variance suffixes to learn from while keeping exploration alive.
- VM-MCTS (Value-Guided Search): Once the policy is trained and frozen, the authors run Monte-Carlo Tree Search (MCTS) to collect self-generated trajectories scored by unit tests. They train a Value Model (VM) to predict the expected final reward from any partial state—sidestepping the need to label individual lines of code as "correct." At inference time, this single VM both guides MCTS exploration and picks the best final output.
Datasets
- Training: A combined set of 6,945 coding prompts (
Q_train) filtered to ensure executable test cases, sourced from BigCodeBench (BCB), DS-1000, and APPS. - In-Domain Evaluation (Coding): HumanEval, HumanEval+, MBPP, MBPP+, BigCodeBench, and APPS-500 (an immutable 500-problem random subset of APPS).
- Out-of-Domain Evaluation (Math & Science): MATH, Omni-MATH, and GPQA-Diamond (used purely to test zero-shot transfer without any target-domain tuning). No new benchmarks are introduced.
Key Insights and Ideas
- Don't imitate good prefixes—explore from them: Standard self-training memorizes complete winning trajectories, while curriculum learning only changes which questions you ask. Restarting online RL from inside a good trajectory acts like a save-point in a video game, letting the model explore tricky mid-problem junctures without getting lost at the start.
- Better policies make better teachers for Value Models: Because the Value Model learns by watching the frozen policy play out trajectories, feeding it a ReST-GRPO policy (which reaches high-reward regions much more reliably than base or standard GRPO models) yields vastly cleaner value estimates.
- Code-trained Value Models transfer to math and science: Because the VM estimates the general probability of eventual success $V^\pi(s) = \mathbb{E}_\pi[R \mid s]$ rather than syntax-specific rules, a VM trained exclusively on Python coding trajectories still meaningfully improves search performance on Olympiad math and PhD-level science questions.
Key Results
- Policy Gains: Across models like Qwen3-8B and Qwen2.5-Coder-7B, two iterations of ReST-GRPO outperform ReST-DPO, naive GRPO, and dynamic-sampling baselines (DAPO). On Qwen3-8B, average coding accuracy jumps from a 50.3% base to 65.5% (beating GRPO's 59.0% and DAPO's 59.7%), with massive leaps on hard benchmarks like APPS-500 (11.8% $\rightarrow$ 56.5%).
- Full Pipeline & Search: Adding VM-MCTS pushes Qwen3-8B's average coding score to 68.9% (and APPS-500 to 64.2%). Even when strictly matching wall-clock latency (~41.5 seconds per prompt), VM-MCTS beats Best-of-N reranking (64.2% vs. 61.9% on APPS-500), proving that using the VM to allocate search beats just scoring finished answers.
- Compute Efficiency: Offline sampling pays for itself. Training Llama-3-8B for 10k steps with ReST-GRPO took 1,752 total GPU-hours (including offline sampling) compared to naive GRPO's 2,080 GPU-hours, hitting a 9% accuracy boost in 71 hours vs. 207 hours.
- Zero-Shot Transfer: Without a single math or science training example, Qwen3-8B + ReST-RL improves over the base model on MATH (78.0% $\rightarrow$ 87.2%), Omni-MATH (23.4% $\rightarrow$ 25.6%), and GPQA-Diamond (44.9% $\rightarrow$ 49.0%).
Limitations and Future Work
- Domain Scope: The authors explicitly note that code reasoning—where automated unit tests provide crisp, hack-resistant rule-based rewards—remains their primary empirical domain. Their math and science experiments are presented as preliminary transfer evidence rather than proof of a universal verifier.
- Policy-Dependent Values & Noise: Because $V^\pi$ estimates expected returns for a specific policy, shifting the policy technically makes an older VM slightly stale (though experiments show moderate robustness before retraining is needed), and Monte-Carlo value targets inherently carry estimation noise.
- Extensions: While the current data assembly only extracts prefixes from the single highest-reward trajectory per prompt, the authors note this could naturally be extended to top-$k$ trajectory selection.
Summary updated