[论文解读] DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence
DeepSeek-Coder-V2 是一个开源的 Mixture-of-Experts 代码模型(16B 和 236B),在代码和数学任务上接近或超越闭源模型,扩展语言支持至 338 种语言,将上下文长度提高到 128K tokens。
We present DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that achieves performance comparable to GPT4-Turbo in code-specific tasks. Specifically, DeepSeek-Coder-V2 is further pre-trained from an intermediate checkpoint of DeepSeek-V2 with additional 6 trillion tokens. Through this continued pre-training, DeepSeek-Coder-V2 substantially enhances the coding and mathematical reasoning capabilities of DeepSeek-V2, while maintaining comparable performance in general language tasks. Compared to DeepSeek-Coder-33B, DeepSeek-Coder-V2 demonstrates significant advancements in various aspects of code-related tasks, as well as reasoning and general capabilities. Additionally, DeepSeek-Coder-V2 expands its support for programming languages from 86 to 338, while extending the context length from 16K to 128K. In standard benchmark evaluations, DeepSeek-Coder-V2 achieves superior performance compared to closed-source models such as GPT4-Turbo, Claude 3 Opus, and Gemini 1.5 Pro in coding and math benchmarks.
研究动机与目标
- 在代码与数学任务中缩小开源代码模型与领先的闭源模型(如 GPT-4-Turbo)之间的差距。
- 扩大语言和上下文覆盖范围,以支持多样的编程语言和对长程代码的理解。
- 通过多源预训练、长上下文训练和基于 RL 的对齐来改进代码和数学推理能力。
- 以宽松许可发布开源模型,促成研究和不限商业用途的使用。
提出的方法
- 在 DeepSeek-V2 中间检查点的基础上继续进行额外 6 万亿条令牌的预训练,总训练数据量达到 10.2 万亿条,覆盖代码、数学和自然语言领域。
- 代码语料库从 86 种语言扩展到 338 种编程语言,代码令牌增至 1,170B,混合比例为 60% 代码、10% 数学、30% 自然语言。
- 通过 Yarn 框架将上下文长度从 16K 增长到 128K tokens,并进行阶段性的长上下文训练。
- 两阶段对齐:在一个结合代码、数学和通用数据的指令数据集上进行有监督微调;随后使用 Group Relative Policy Optimization (GRPO) 的强化学习,使用针对编译器/测试用例反馈调优的奖励模型进行对齐。
- 对于 16B,采用 Fill-In-Middle (FIM) 训练(Prefix-Suffix-Middle 结构)以提升代码补全能力;对于 236B,依赖 Next-Token-Prediction 目标。
- 与在代码、数学和自然语言任务上的开源与闭源基线进行比较,以验证性能提升。

实验结果
研究问题
- RQ1一个开源 Mixture-of-Experts 代码模型 是否能在编程和数学基准上达到与闭源领导者同等水平或超过它们?
- RQ2扩展编程语言覆盖与上下文长度对编码准确性与推理能力有何影响?
- RQ3数据组成、长上下文训练和 RL 对齐策略对开源代码模型的性能有何影响?
- RQ4开源模型在保持一般语言能力的同时,在代码与数学任务上能在多大程度上实现专业化?
主要发现
- DeepSeek-Coder-V2 (236B) 在代码和数学基准上达到与 GPT-4-Turbo、Claude 3 Opus、Gemini 1.5 Pro 相当或更优的性能。
- 代码基准在 236B 模型(EvalPlus 流程)上显示 HumanEval 90.2%、MBPP 76.2%、LiveCodeBench 43.4%。
- 在数学任务上,DeepSeek-Coder-V2 在 MATH 上达到 75.7%,几乎匹配 GPT-4o,并在 AIME 2024 及相关数据集上优于若干闭源模型。
- 该模型支持 338 种编程语言,最大上下文长度为 128K tokens,较先前工作的 86 种语言和 16K 上下文有所提升。
- 开源的 DeepSeek-Coder-V2-Instruct 在 Language 组合的 HumanEval/MBPP 上取得 75.3% 的平均分,仅次于 benchmark 集合中的 GPT-4o。
- 支持长上下文和启用 FIM 的变体(16B)在代码补全和修复能力方面表现强劲,在 FIM 任务和修复基准测试中取得显著结果。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。