TL;DR
RACES (Recursive Automated Composition for Environment Scaling) is a novel framework that scales reinforcement learning training data for LLMs by snapping together verifiable environments like LEGO bricks. By matching the output type of one task to the input type of another, RACES generates an unbounded space of complex, multi-step reasoning problems from a small base pool, significantly boosting downstream generalization on unseen benchmarks.
What Problem Does This Paper Address?
Reinforcement Learning with Verifiable Rewards (RLVR)—popularized by models like DeepSeek-R1—relies on environments that can programmatically and deterministically verify answers (e.g., code execution, math problems, logic puzzles). While scaling up the number and diversity of these environments directly translates to better LLM reasoning, creating them is a bottleneck.
Currently, environments are engineered manually or synthesized individually by LLMs. This results in a linear scaling limit: doubling your environment pool doubles your construction cost. Consequently, models risk overfitting to a narrow, structurally simplistic set of training tasks, hindering their ability to generalize to truly novel reasoning problems.
Methods
RACES bypasses linear scaling by leveraging the compositional closure property of verifiable environments. If Environment A outputs an integer, and Environment B takes an integer as input, RACES automatically fuses them into a new, more complex environment ($B \circ A$).
The framework operationalizes this via a three-stage pipeline:
- Composition Path Discovery: A randomized breadth-first search explores a tree of type-compatible environment sequences.
- Quality Assurance: An online executable filtering step discards paths that trigger runtime exceptions, timeouts, or degenerate states (e.g., loops or empty outputs).
- Operator Instantiation: To turn these composite paths into diverse training prompts, RACES applies four distinct composition operators:
SEQUENTIAL: Chains tasks together; the model must track and output all intermediate and final states.PARALLEL: Packs independent tasks into a single context, forcing the model to manage multiple computational threads.SORT: Presents a shuffled set of tasks and a target output; the model must deduce the correct execution order.SELECT: Introduces "distractor" tasks; the model must identify the correct subset and arrange them in order.
Datasets
The authors seeded RACES with an initial pool of 300 base environments sourced from algorithmic datasets, manual curation, and LLM-assisted synthesis.
Crucially, to test true reasoning generalization, the models were evaluated on six challenging benchmarks completely unseen during training:
- LiveCodeBench (LCBench): Code generation.
- AIME 2024/2025: High-school competition mathematics.
- Enigmata: Synthetic logical puzzles.
- IFEval: Verifiable instruction following.
- LongBench-v2 (LBench-V2): Long-context understanding.
Key Insights and Ideas
- The Training Reward Paradox: During training, models trained on individual, uncompounded environments achieve much higher rewards much faster than RACES models. However, this rapid optimization represents overfitting. RACES models face a harder optimization challenge (slower reward growth) but acquire transferable reasoning behaviors that excel on downstream tasks.
- Massive Data Efficiency: RACES turns a small environment pool into a combinatorial goldmine. Training on just 50 base environments composed via RACES achieved downstream performance comparable to or better than training on 300 individual, uncompounded environments.
- The Difficulty Sweet Spot: Task difficulty can be precisely modulated by changing the composition size (the number of blocks chained together). However, more isn't always better: performance improves steadily from size 2 to 5, but drops at size 6 because the optimization landscape becomes too difficult, leaving a less informative learning signal for RL.
Key Results
RACES was evaluated using two 14B parameter backbones: DeepSeek-R1-Distill-Qwen-14B and Qwen3-14B.
- DeepSeek-R1-Distill-Qwen-14B: RACES improved the average score across all benchmarks by 3.1 points (from 48.2 to 51.3), significantly outperforming the individual-environment baseline, which only crawled up to 48.8. Notable jumps occurred on IFEval (+4.0) and LongBench-v2 (+3.5).
- Qwen3-14B: RACES boosted the base model's average performance from 58.8 to 61.1.
- Qualitative Shift: Qualitative analysis showed that RACES-trained models naturally develop superior strategies, such as defining reusable functional abstractions, maintaining explicit index-value tracking, and executing self-consistency checks, rather than relying on error-prone, ad-hoc enumeration.
Limitations and Future Work
While powerful, the authors note a few constraints of the current framework:
- Design Space Coverage: The four chosen operators represent a subset of programming logic. Complex control flows like conditional branching (
IF-ELSE) and bounded loops (FOR/WHILE) remain unexplored. - Cold-Start Problem: RACES relies on the base model having a baseline level of reasoning competence. If a model is too weak, it will consistently fail composite tasks, leading to sparse rewards that stall RL training.
- Context Window Demands: Multi-step composite reasoning generates long thought traces, requiring large context windows (32K tokens in these experiments), which increases computational overhead.
Summary updated