Abstract
While Large Language Models (LLMs) have demonstrated proficiency in general coding tasks, competitive programming remains a significant challenge due to the requirement for deep algorithmic reasoning and rigorous edge-case handling. This paper introduces rStar-Coder, a massive, verified dataset comprising 418,000 competition-level coding problems and 580,000 long-reasoning solutions. By employing a novel "mutual verification" pipeline and controlled test-case synthesis, we demonstrate that smaller models (7B and 14B) can outperform significantly larger frontier models. Notably, rStar-Coder-14B surpasses OpenAI’s o3-mini (low) on LiveCodeBench, while the 7B variant outperforms QWQ-32B on the prestigious USACO 2025 benchmark.
1. Introduction
The primary bottleneck in advancing code reasoning for LLMs is not necessarily model architecture, but the scarcity of high-difficulty, verifiable training data. Unlike mathematical reasoning, where answers can often be verified via regular expressions, code correctness requires execution against a diverse and rigorous suite of test cases. Existing synthetic datasets often suffer from "hallucinated" problems—logically impossible tasks—or lack the necessary test cases to ensure solution robustness. To address this, we present a scalable framework for generating thousands of difficult, solvable, and rigorously verified programming problems.
2. The rStar-Coder Pipeline
To build the rStar-Coder dataset, we developed a three-pillar synthesis and verification approach:
2.1 Solvable Problem Synthesis
Rather than requesting an LLM to generate problems from scratch, we provide the model with "seed" problems from expert sources (e.g., Codeforces) along with their "oracle" (correct) solutions. This grounding ensures that the synthesized problems remain logically sound and solvable, focusing the model's creative capacity on transforming existing algorithmic concepts into new contexts.
2.2 Three-Step Test Case Generation
To ensure rigorous verification, we decoupled the test-case generation process into three distinct stages:
- Utility Function Synthesis: GPT-4o is prompted to write Python utility functions using the
CYaRonlibrary to generate inputs and validate them against problem constraints. - Scale Parameterization: We define explicit scale ranges (from $10^0$ to $10^5$) to ensure the test suite includes both edge cases and high-volume stress tests.
- Execution: These functions are executed to produce a diverse suite of valid inputs, avoiding the common pitfall of LLMs generating overly simplistic or invalid manual test cases.
2.3 Mutual Verification for Labeling
In the absence of ground-truth solutions for synthetic problems, we utilize a "Mutual Verification" mechanism. We sample 16 independent solutions from a strong model (QWQ-32B). If a significant majority of these independent reasoning paths produce identical outputs across 50+ diverse test cases, the problem and its solutions are deemed verified. This method relies on the principle that while there are many ways to be wrong, there is typically only one way to be right in a competitive programming context.
3. Dataset and Evaluation
The resulting rStar-Coder dataset contains 418K verified problems and 580K Chain-of-Thought (CoT) solutions. The dataset was seeded from 37.7K expert problems across platforms like AIZU, AtCoder, CodeChef, Codeforces, and USACO.
We evaluated the models on several high-difficulty benchmarks:
- LiveCodeBench (v5): Recent, unseen competitive programming problems.
- USACO 2025: The USA Computing Olympiad, featuring tiers from Bronze to Platinum.
- Standard Benchmarks: HumanEval and MBPP for general coding proficiency.
4. Key Results
Our findings suggest that high-quality, verified data can effectively compensate for smaller model parameters:
- LiveCodeBench: rStar-Coder-7B improved from a base performance of 17.4% to 57.3%. The 14B version reached 62.5%, surpassing OpenAI’s o3-mini (low) by 3.1%.
- USACO 2025: On this notoriously difficult benchmark, rStar-Coder-7B achieved a 16.15% pass rate, outperforming the much larger QWQ-32B (15.62%).
- Efficiency: The 7B model trained on this dataset frequently doubled the accuracy of other 7B models (such as OpenThinker or DeepSeek-R1-Distill) on reasoning-heavy tasks.
5. Discussion and Insights
- Solvability Over Diversity: Our results indicate that for reasoning tasks, ensuring a problem is solvable is more critical than maximizing prompt diversity. Providing the oracle solution during synthesis allows the model to maintain the "algorithmic core" of the problem.
- Scale Control: Explicitly parameterizing input generation is crucial. By forcing models to handle large inputs (e.g., $N=10^5$), we compel them to learn algorithmic efficiency (e.g., $O(N \log N)$) rather than relying on brute-force solutions.
6. Conclusion and Future Work
rStar-Coder demonstrates that scaling verified, high-difficulty data is a viable path toward frontier-level code reasoning in smaller models. Future work will focus on reducing dependency on frontier models like GPT-4o for initial synthesis and exploring "self-evolving" pipelines where rStar-Coder models generate and verify their own training data.
Summary updated