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

The paper introduces OpenCoder, a top-tier open-source code Large Language Model (LLM) that aims to democratize research in code intelligence. Unlike previous efforts that often only release model weights, OpenCoder provides a comprehensive "cookbook" including reproducible training data, detailed processing pipelines, and rigorous experimental results, enabling researchers to build and advance code LLMs with unprecedented transparency.

What Problem Does This Paper Address?

The field of code LLMs has seen rapid advancements, with models like ChatGPT and Copilot revolutionizing software development. However, a significant gap exists in the open-source community: while some models offer open weights, they often lack the crucial elements needed for deep scientific investigation. This includes reproducible data processing pipelines, transparent training protocols, and detailed ablation studies. This lack of transparency hinders researchers from establishing strong baselines, gaining deeper insights into model behavior, and fostering reproducible advancements. The authors aim to bridge this gap by providing a fully open, high-quality code LLM and its complete development ecosystem.

Methods

OpenCoder's development involved a meticulous, multi-stage process focused on data quality and reproducibility:

  • RefineCode Dataset: A novel, high-quality, and reproducible dataset of 960 billion tokens was created. This involved:
  • Raw Code Processing: Extensive preprocessing, including filtering out non-text files, selecting specific programming language file types, and aggressive file-level and repository-level deduplication using exact and fuzzy matching.
  • Code-Related Web Data: Leveraging Common Crawl and other web corpora, with a focus on identifying and annotating code-related content.
  • Heuristic Filtering: Developing a sophisticated framework of filtering rules tailored to code characteristics, including natural language, general code, and language-specific rules, to remove low-quality data.
  • Annealing Data: A phase bridging pre-training and fine-tuning, using high-quality data like the Algorithmic Corpus and synthetic data to further enhance model capabilities.
  • Two-Stage Instruction-Tuning: A novel fine-tuning strategy comprising:
  • Stage 1 (Broad Capabilities): Synthesizing diverse instruction data covering theoretical computer science concepts.
  • Stage 2 (Code-Specific Enhancement): Fine-tuning on high-quality code from GitHub to improve code generation and understanding.
  • Model Architecture: OpenCoder is based on the Llama-3.1 architecture, with available sizes of 1.5B and 8B parameters, featuring standard components like SwiGLU activation and RoPE positional embeddings.

Datasets

  • RefineCode: A newly curated dataset of 960 billion tokens, comprising raw code (from GitHub and The Stack v2) and code-related web data.
  • Annealing Data: Includes RefineCode, Algorithmic Corpus, and Synthetic Data (High Quality Code Snippet, Code Textbooks).
  • Instruction-Tuning Data: A mix of open-source instruction corpora like Evol-Instruct, Infinity-Instruct, McEval, and RealUser-Instruct, along with synthesized data for educational and package-related instruction.
  • Evaluation Benchmarks: HumanEval, MBPP, BigCodeBench, LiveCodeBench, MultiPL-E, McEval, and MdEval.

Key Insights and Ideas

  • Data Quality Over Quantity: The paper strongly emphasizes that for top-tier code LLMs, the quality and careful curation of data are paramount, especially in later training stages like annealing.
  • Aggressive Deduplication is Key: File-level deduplication, followed by fuzzy deduplication, proved to be the most effective strategy for cleaning GitHub data, significantly reducing redundancy while preserving performance. Repository-level deduplication, while retaining more tokens, was less effective for downstream tasks.
  • Star-Based Filtering is Suboptimal: Filtering code data based on GitHub stars (e.g., stars >= 5) was found to reduce data diversity without a clear performance benefit, suggesting that other criteria are more important for selecting high-quality, diverse code.
  • Two-Stage Instruction Tuning Works: A staged approach to instruction tuning, first building broad capabilities and then refining with code-specific tasks, leads to more versatile and performant models.
  • The "Open Cookbook" Philosophy: The core idea is to provide not just a model, but a complete, transparent, and reproducible framework for building code LLMs, empowering the community.

Key Results

  • State-of-the-Art Performance: OpenCoder-8B-Base achieves a HumanEval Pass@1 score of 66.5, surpassing previous fully open models and competitive with many proprietary ones. OpenCoder-8B-Instruct also demonstrates strong performance across various benchmarks.
  • Efficient Pre-training: The RefineCode dataset significantly improves training efficiency compared to The Stack v2.
  • Deduplication Impact: File-level deduplication led to higher performance on HumanEval and MBPP compared to repository-level deduplication.
  • Annealing Data Importance: Removing high-quality annealing data (Algorithmic Corpus and Synthetic Data) resulted in a significant performance drop, highlighting its crucial role.
  • Two-Stage Tuning Benefits: The two-stage instruction tuning strategy consistently improved performance across benchmarks compared to single-stage or mixed training approaches.

Limitations and Future Work

  • Computational Budget: The authors acknowledge that the data mixture ratio for annealing might not be ideal due to limited computing budget.
  • Model Updates: The team plans to continue updating the model and data to improve performance and expand its influence.
  • Community Contribution: The overarching goal is to foster reproducible advancements and encourage broad use of code intelligence models by providing this open resource.

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 J. H. 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