OpenCodeReasoning: Advancing Data Distillation for Competitive Coding

Wasi Uddin Ahmad, Sean Narenthiran, Somshubra Majumdar, Aleksander Ficek, Siddhartha Jain, Jocelyn Huang, Vahid Noroozi, Boris Ginsburg

TL;DR

NVIDIA researchers have released OpenCodeReasoning, a massive synthetic dataset of 736k reasoning-infused coding samples designed to distill "thinking" capabilities into smaller models. By fine-tuning Qwen2.5 models on this data, they achieved state-of-the-art results in competitive coding, proving that large-scale supervised fine-tuning (SFT) can match or even beat complex reinforcement learning (RL) pipelines.

What Problem Does This Paper Address?

Reasoning-based Large Language Models (LLMs) like DeepSeek-R1 and OpenAI’s o1 have set a new bar for coding, but their "secret sauce"—the specific data and training recipes used to induce reasoning—remains largely proprietary.

While researchers have successfully distilled these reasoning capabilities into smaller "student" models, most existing open-source datasets are relatively small (17k to 114k samples) and focused primarily on mathematics. There is a significant performance gap between these SFT-only distilled models and their RL-trained counterparts. The authors set out to bridge this gap by creating the largest reasoning-based synthetic dataset for coding to date and investigating how scaling and data quality impact a model's ability to solve complex competitive programming tasks.

Methods

The authors developed a three-step pipeline to construct the OpenCodeReasoning dataset:

  1. Question Collection: They gathered 28,904 unique competitive programming questions from diverse sources (CodeForces, AtCoder, LeetCode, etc.) and performed strict deduplication to avoid benchmark contamination.
  2. Reasoning Generation: Using DeepSeek-R1 as a "teacher," they generated multiple solutions per question. Crucially, they forced the model to output its internal reasoning process (Chain-of-Thought) using <think> tags.
  3. Refinement: They filtered the responses to ensure they contained both reasoning traces and syntactically valid code (verified via Tree-Sitter).

Finally, they fine-tuned Qwen2.5 models (7B, 14B, and 32B) using standard Supervised Fine-Tuning (SFT) on this data. Unlike many recent high-performing models, these were not trained with Reinforcement Learning, allowing the researchers to isolate the impact of the data itself.

Datasets

  • Training: The primary dataset, OpenCodeReasoning, contains 736,712 Python samples and 355,792 C++ samples across nearly 29k unique problems.
  • Evaluation: The models were tested on LiveCodeBench (a benchmark of recent coding problems to prevent data leakage) and CodeContests. They also used the IOI (International Olympiad in Informatics) benchmark to test C++ capabilities.
Breakdown of question sources and sample counts

Key Insights and Ideas

  • Scaling Still Matters: While some research suggests that reasoning can be "induced" with a tiny amount of high-quality data, this paper finds that for competitive coding, more is better. Performance on LiveCodeBench continued to climb steadily as they scaled from 25k to 736k samples.

    Figure 3: Impact of scaling up data from 25k to 736k samples in OPENCODEREASONING.
  • The "Correctness" Paradox: In a surprising finding, the authors observed that filtering out incorrect solutions actually hurt performance. As shown in Figure 4, incorrect solutions are heavily concentrated in the "Hard" problem category. By removing them, you inadvertently remove the most complex reasoning patterns from the training set. The model benefits more from seeing the process of tackling a hard problem, even if the final code has a bug, than from only seeing perfect solutions to easy problems.

    Figure 4: Distribution of correct vs. incorrect samples in the CodeContest subset of OPEN- CODEREASONING across four difficulty levels, as determined by unit tests.
  • Token Efficiency: The distilled models (OCR-Qwen) were found to be more "efficient thinkers" than some RL-based models. For example, the OCR-32B model achieved similar or better scores than QwQ-32B while using 20-30% fewer reasoning tokens across all difficulty levels.

Key Results

The resulting OCR-Qwen models achieved state-of-the-art performance for their size:

  • OCR-Qwen-32B reached a 61.8% pass@1 on LiveCodeBench, surpassing proprietary models like OpenAI’s o1-preview and o3-mini (low/medium settings).
  • The 7B and 14B models significantly outperformed the standard DeepSeek-R1-Distill-Qwen models of the same size, with the 7B model showing a massive 13.7 point lead.
  • The models showed strong competitive coding skills, hitting 24.6% on CodeContests, outperforming several models trained with reinforcement learning.
Figure 1: Accuracy (pass@1) comparison between our SFT-only models with proprietary, open-weight SFT-only and SFT+RL models on LiveCodeBench (2408-2502).

Limitations and Future Work

  • The Scaling Ceiling: The scaling curves in the paper haven't plateaued yet, suggesting that even larger datasets (millions of samples) could push performance further.
  • Multilingual Strategy: While adding C++ data helped with C++ benchmarks (IOI), it didn't provide a "cross-pollination" boost to Python performance. Finding the right mix for multilingual reasoning remains an open question.
  • Reasoning Loops: On extremely difficult problems, models still occasionally fall into "unrecoverable reasoning loops," repeating the same logic without reaching a solution. Improving the model's ability to "break out" of these loops is a key area for future research.

Summary updated

BibTeX
@inproceedings{ahmad2025opencodereasoning,
  author = {Wasi Uddin Ahmad and Sean Narenthiran and Somshubra Majumdar and Aleksander Ficek and Siddhartha Jain and Jocelyn Huang and Vahid Noroozi and Boris Ginsburg},
  title = {{OpenCodeReasoning: Advancing Data Distillation for Competitive Coding}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=aykM7KUVJZ},
}
Figure