Skip to main content
QUICK REVIEW

[论文解读] OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models

Siming Huang, Tsung‐Chieh Cheng|arXiv (Cornell University)|Nov 7, 2024
Natural Language Processing TechniquesComputer Science被引用 5
一句话总结

OpenCoder 提供一个完全开源的代码大语言模型,具备可复现的预训练数据、训练管线和两阶段指令微调,在6B+参数规模的完全开源模型中达到顶尖性能。它为可复现的代码 AI 研究提供开放的基础。

ABSTRACT

Large language models (LLMs) for code have become indispensable in various domains, including code generation, reasoning tasks and agent systems. While open-access code LLMs are increasingly approaching the performance levels of proprietary models, high-quality code LLMs suitable for rigorous scientific investigation, particularly those with reproducible data processing pipelines and transparent training protocols, remain limited. The scarcity is due to various challenges, including resource constraints, ethical considerations, and the competitive advantages of keeping models advanced. To address the gap, we introduce OpenCoder, a top-tier code LLM that not only achieves performance comparable to leading models but also serves as an "open cookbook" for the research community. Unlike most prior efforts, we release not only model weights and inference code, but also the reproducible training data, complete data processing pipeline, rigorous experimental ablation results, and detailed training protocols for open scientific research. Through this comprehensive release, we identify the key ingredients for building a top-tier code LLM: (1) code optimized heuristic rules for data cleaning and methods for data deduplication, (2) recall of text corpus related to code and (3) high-quality synthetic data in both annealing and supervised fine-tuning stages. By offering this level of openness, we aim to broaden access to all aspects of a top-tier code LLM, with OpenCoder serving as both a powerful model and an open foundation to accelerate research, and enable reproducible advancements in code AI.

研究动机与目标

  • 提供一个经过精心策划、完全透明的强基线代码 LLM,用于研究代码 LLM 中的机械可解释性和数据分布。
  • 研究预训练和指令数据的筛选管线,以理解实现更强代码 LLM 的设计选择。
  • 提供一个开放、可复现的数据处理流程、数据集和训练协议,以加速代码 AI 的开放科学研究。

提出的方法

  • 引入 RefineCode,一个高质量的960B令牌预训练数据集,覆盖607种语言,含130条语言特定规则与权重。
  • 设计并应用一个面向代码的数据处理管线,包括预处理、去重(精确与模糊)、转换(版权移除、PII 减少)以及语言和代码特定筛选规则。
  • 通过对 Common Crawl 的迭代回忆管线,结合基于域的编码分类和URL注释,汇集与代码相关的网页数据。
  • 提出两阶段指令微调策略,使用 RealUser-Instruct、Large-scale Diverse-Instruct,以及过滤后的指令集,第二阶段再结合来自 GitHub 的高质量代码。
  • 在两个模型尺寸(1.5B 和 8B)上使用 Megatron-LM 进行 OpenCoder 的训练,采用 WSD 学习计划、特定优化器和大令牌预算;在预训练与 SFT 之间通过高质量合成数据的仔细退火阶段搭桥。

实验结果

研究问题

  • RQ1开源代码 LLM 如何在保持完全开放和可复现的同时达到顶级性能?
  • RQ2哪些数据筛选、去重和质量策略最能有效提升代码 LLM 的预训练与下游编码任务?
  • RQ3将理论 CS 内容与高质量 GitHub 代码相结合的两阶段指令微调方法是否能提升通用编码能力与可解释性?

主要发现

  • OpenCoder 在6B+参数规模的代码相关基准上超过以往的完全开源模型(如图1所示)。
  • RefineCode 提供一个高质量、可复现的预训练数据集(960B令牌,覆盖607种语言),相较 The Stack v2 提高训练效率。
  • 两阶段指令微调策略(先理论 CS 问答,再高质量 GitHub 代码)在代码生成与理解任务上都表现更强。
  • 该发布不仅包含模型权重,还包含可复现的数据处理管线、消融实验和训练协议,以促进可复现的代码 LLM 研究。
  • 与表1中的开源模型相比,OpenCoder-8B 在 HumanEval Pass@1 上取得具有竞争力的分数,同时提供数据与工作流的完全开放性。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。