OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models

Siming Huang, Tianhao Cheng, J. K. Liu, Jiaran Hao, Liuyihan Song, Yang Xu, J. Yang, Chenchen Zhang, Linzheng Chai, Ruifeng Yuan, Zhaoxiang Zhang, Jie Fu, Qian Liu, Ge Zhang, Zili Wang, Yuan Qi, Yinghui Xu, Wei Chu

TL;DR

OpenCoder is a top-tier, fully open-source code Large Language Model (LLM) available in 1.5B and 8B parameter sizes that matches or exceeds the performance of leading models like StarCoder2. Crucially, the authors release the complete "cookbook" for the model: the weights, the 960-billion-token RefineCode dataset, the full data processing pipeline, and the training protocols, establishing a new baseline for open scientific research in AI code generation.

What Problem Does This Paper Address?

While open-access code LLMs have rapidly advanced, truly open science models remain scarce. State-of-the-art models typically keep their data curation pipelines, exact data mixtures, and training recipes proprietary. This lack of transparency prevents the broader research community from investigating data distributions, exploring mechanical interpretability, or reliably reproducing training advancements.

OpenCoder addresses this gap by providing a high-performing model alongside a completely transparent, reproducible blueprint of how it was built from scratch.

Methods

The authors outline a meticulous data curation and training strategy divided into three main phases:

  1. The RefineCode Pipeline: The raw code data undergoes strict preprocessing (filtering files >8MB and selecting 607 programming languages), aggressive file-level deduplication (exact SHA256 hashing and fuzzy MinHash/LSH), and transformation (removing repetitive copyright blocks and redacting PII). Finally, they apply extensive heuristic filtering rules categorized into natural language, general code, and language-specific rules for eight major languages.
  2. Code-Related Web Data Recall: To ensure the model understands the natural language context around code, the authors use FastText models and Autonomous Data Selection to extract high-quality code-like text from massive web corpora like Common Crawl, FineWeb, and SkyPile.
  3. Pretraining & Annealing: The models are trained using a Warmup-Stable-Decay (WSD) learning rate schedule. During the final annealing (decay) phase, they inject a high-quality algorithmic corpus and synthetic data (Verified Code Snippets and Code Textbooks) generated via Qwen2-72B-Instruct.
  4. Two-Stage Instruction Tuning (SFT): Instead of mixing all instruction data together, OpenCoder uses a two-stage approach. Stage 1 utilizes large-scale diverse instruction data to build broad capabilities and theoretical computer science knowledge. Stage 2 refines the model on practical coding tasks, educational instructions, and up-to-date API usage via package-related instruction synthesis.

Datasets

  • RefineCode: A newly curated, high-quality pretraining dataset containing 960 billion tokens across 607 programming languages, which includes 75 billion code-related web tokens.
  • SFT Corpus: Over 4.5 million high-quality instruction examples across both SFT stages.
  • Evaluation Benchmarks: The models were rigorously evaluated on standard benchmarks including HumanEval/HumanEval+, MBPP/MBPP+, BigCodeBench, LiveCodeBench, MultiPL-E, McEval, MdEval, and a human-curated user prompt set called CodeArena.

Key Insights and Ideas

  • File-Level > Repo-Level Deduplication: Extensive ablation testing revealed that deduplicating data at the individual file level is significantly more effective for downstream performance than repository-level deduplication. File-level filtering removes massive amounts of redundant code while preserving crucial data diversity.
  • The Pitfall of GitHub Stars: Filtering pretraining data strictly by GitHub star counts (e.g., keeping only files with $\ge 5$ stars) actually degrades downstream model performance. While it lowers pretraining loss, it severely compromises data diversity.
  • Quality Trumps Quantity in Annealing: Introducing a small fraction of highly curated synthetic data and algorithmic problems during the final learning rate decay phase yields massive performance spikes, acting as a bridge to instruction tuning.
  • The Power of Two-Stage SFT: Separating instruction tuning into a theoretical phase followed by a practical coding phase outperforms standard joint training (shuffling all data together), allowing the model to acquire broad reasoning skills before specializing.

Key Results

OpenCoder sets a new frontier for fully open models, delivering top-tier performance at both the 1.5B and 8B scales:

  • OpenCoder-8B-Base achieves a 66.5% zero-shot Pass@1 on HumanEval, outperforming StarCoder2-15B (46.3%) and closely trailing massive, data-heavy models like Qwen2.5-Coder-7B.
  • OpenCoder-1.5B-Base scores 54.3% on HumanEval, significantly outperforming DeepSeek-Coder-1.3B (34.8%) and Qwen2.5-Coder-1.5B (43.9%).
  • Pretraining Efficiency: Thanks to the refined data quality of RefineCode, OpenCoder achieves equivalent performance on benchmarks like MBPP up to 3× faster than models trained on alternative open datasets like The Stack V2.
Figure 1: OpenCoder surpasses all previous fully open models (i.e., with open model weights and reproducible datasets) and other open-access models (i.e., with open model weights only) at the 6B+ parameter scale, pushing the frontier of fully open models to new heights.

Limitations and Future Work

The authors acknowledge that due to limited computing budgets, the exact data mixture ratios during the annealing phase might not be fully optimized. In the future, the team plans to consistently update the model and dataset, further refine the data mixtures, and expand OpenCoder’s ecosystem based on community feedback and open scientific collaboration.

Summary updated

BibTeX
@inproceedings{huang2025opencoder,
  author = {Siming Huang and Tianhao Cheng and J. K. Liu and Jiaran Hao and Liuyihan Song and Yang Xu and J. Yang and Jiaheng Liu and Chenchen Zhang and Linzheng Chai and Ruifeng Yuan and Zhaoxiang Zhang and Jie Fu and Qian Liu and Ge Zhang and Zili Wang and Yuan Qi and Yinghui Xu and Wei Chu},
  title = {{OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure