TL;DR
DecompRL is a reinforcement learning framework that trains Large Language Models (LLMs) to solve complex coding problems by breaking them down into modular, independently implementable sub-functions. By recombining $k$ implementations of $n$ sub-functions, it generates up to $k^n$ candidate solutions, shifting the computational bottleneck from expensive GPU inference to cheap CPU evaluation. This approach cuts GPU token costs by $\sim50\times$ and successfully tackles hard programming tasks that monolithic generation methods cannot reach.
What Problem Does This Paper Address?
When using LLMs for complex tasks like competitive programming, the dominant strategy to boost performance is scaling test-time compute via repeated sampling (the pass@k regime). However, generating full, monolithic code solutions scales GPU costs linearly with the number of attempts.
Furthermore, if a problem is sufficiently difficult, the base model's probability of generating a completely correct monolithic solution drops to near zero. In this regime, no amount of brute-force sampling or standard reinforcement learning (RL) can find a valid solution because the search space is simply too large.
Methods
The authors introduce DecompRL, a cooperative multi-agent RL framework that splits code generation into two distinct policies:
- Decomposition Policy ($\pi_\theta(D)$): Breaks down a natural language problem description into a plan $D$ containing sub-function signatures and docstrings.
- Implementation Policy ($\pi_\theta(I|D)$): Independently writes code implementations for each sub-function in parallel.
Instead of evaluating linear rollouts, DecompRL exploits the conditional independence of these sub-functions. If the model generates $k$ implementations for each of the $n$ modules, these partial blocks can be combinatorially recombined into up to $k^n$ unique full programs. This shifts the scaling bottleneck to cheap CPU-bound unit testing.
To train this system effectively without reward collapse, DecompRL introduces:
- Logmeanexp Objective: A soft reward aggregation function that smoothly interpolates between average reward (standard RL) and maximum reward (pass@k), optimizing for sample diversity.
- Leave-One-Out Baseline: A counterfactual baseline that accurately estimates the advantage of individual actions within a massive pool of correlated rewards.
- Sequential Training: Training alternates between the two policies (first freezing implementation to train decomposition, then vice versa) to prevent multi-agent instability and reward hacking.
Datasets
- Training: A dataset of 15,000 competitive programming problems, combining the training sets of CodeContests and TACO.
- Evaluation: Evaluated on the DeepMind CodeContests validation set (117 problems) and LiveCodeBench (279 problems spanning 2024/08/01 to 2025/02/01).
Key Insights and Ideas
- GPU-to-CPU Bottleneck Shift: Generating modular code creates a combinatorial explosion of candidate solutions ($k^n$) from a small number of generated tokens ($k \times n$). This allows researchers to scale search using cheap CPU clusters rather than expensive GPU clusters.
- The "Format Tax" on Easy Problems: For simple tasks, modular decomposition acts as a penalty. Monolithic generation is more precise and sample-efficient when the base policy is already strong. DecompRL shines specifically as an exploration tool for high-budget, hard-problem regimes.
- Decomposition is the Bottleneck: Ablation studies revealed that training the decomposition policy is significantly harder than training the implementation policy. Without careful tuning and sequential training, models suffer from "size collapse," where the decomposition policy shrinks the number of sub-functions down to one to avoid risk.
Key Results
- Token Efficiency: At 512 evaluations, DecompRL reduces GPU token generation by $\sim50\times$ (generating $\sim4k$ tokens compared to $\sim198k$ tokens for standard monolithic sampling).
- Hard Problem Performance: On the LiveCodeBench hard subset, DecompRL solved up to 35% of problems under high token budgets, significantly outperforming standard and diversity-optimized RL baselines (like GRPO and SPO).
- Continuous Scaling: Unlike standard RL methods whose performance saturates early when scaling test-time compute, DecompRL's success rate continues to scale past $10^5$ tokens per problem.
Limitations and Future Work
- Format Tax: DecompRL underperforms standard monolithic generation on easy problems and low token budgets due to the overhead of modular formatting. For instance, pass@1 accuracy drops by 3 percentage points for Qwen 2.5 7B on LiveCodeBench Easy.
- Size Collapse / Reward Hacking: The decomposition policy naturally tends to reduce the number of functions over time to minimize the risk of a single module failing. Future work is needed to better incentivize optimal modularity without triggering reward hacking.
- Pipeline Integration: The authors suggest DecompRL is best used as the "explorer" stage in an explorer/distiller pipeline, where diverse solutions discovered at high compute budgets are later distilled back into a standard monolithic model for efficient deployment.
Summary updated