Skip to main content
QUICK REVIEW

[论文解读] DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligence

Daya Guo, Qihao Zhu|arXiv (Cornell University)|Jan 25, 2024
Software Engineering Research被引用 104
一句话总结

DeepSeek-Coder 提供开源代码大模型(1.3B–33B),在 2T 令牌、仓库级数据和 Fill-In-Middle 训练下训练,达到开源领域的最先进水平,并在代码任务上与闭源模型具有竞争力。

ABSTRACT

The rapid development of large language models has revolutionized code intelligence in software development. However, the predominance of closed-source models has restricted extensive research and development. To address this, we introduce the DeepSeek-Coder series, a range of open-source code models with sizes from 1.3B to 33B, trained from scratch on 2 trillion tokens. These models are pre-trained on a high-quality project-level code corpus and employ a fill-in-the-blank task with a 16K window to enhance code generation and infilling. Our extensive evaluations demonstrate that DeepSeek-Coder not only achieves state-of-the-art performance among open-source code models across multiple benchmarks but also surpasses existing closed-source models like Codex and GPT-3.5. Furthermore, DeepSeek-Coder models are under a permissive license that allows for both research and unrestricted commercial use.

研究动机与目标

  • 解决因闭源主导而在代码智能领域造成的研究缺口,通过开发开源代码模型。
  • 从头开始在一个大型、高质量语料库上训练一套具备仓库感知与长上下文能力的代码大模型。
  • 评估仓库级数据构建与 Fill-In-Middle 训练对跨文件代码生成和整体代码能力的影响。
  • 提供指令微调变体与全面基准测试,以评估多语言编码能力与实际应用性。

提出的方法

  • 构建一个规模化的开源代码语料库(87 种语言,2T 令牌),按仓库级组织。
  • 对依赖关系进行拓扑排序,以按照文件依赖关系排列训练数据。
  • 进行仓库级近重复数据消除,保持仓库结构同时减少重复。
  • 以解码器为主体的 Transformer(1.3B、6.7B、33B)进行下一令牌预测和 Fill-In-Middle(FIM)目标(PSM/ MSP 变体)以及 16K 的上下文窗口预训练。
  • 扩展 RoPE 的上下文并使用基于 RoPE 的长上下文扩展,支持高达 64K 的令牌(实证最佳点在约 16K)。
  • 通过 Alpaca 风格数据进行指令微调,训练 DeepSeek-Coder-Instruct,并使用单独的评估协议。

实验结果

研究问题

  • RQ1仓库级数据构建是否比文件级数据在跨文件代码生成方面有更大提升?
  • RQ2Fill-In-the-Middle 训练配置(PSM vs MSP)对代码生成与完成性能的影响如何?
  • RQ3开源的 DeepSeek-Coder 模型在标准代码基准和真实世界任务上与闭源模型(Codex、GPT-3.5、GPT-4)的对比如何?
  • RQ4指令微调(DeepSeek-Coder-Instruct)是否在多语言代码任务上缩小与闭源模型的差距?
  • RQ5在仓库规模的编码情景中,长上下文自适应对性能有何影响?

主要发现

  • DeepSeek-Coder-Base 33B 在多个基准测试中实现了开源代码模型的最先进性能。
  • DeepSeek-Coder-Instruct 33B 在多数基准测试上胜过 GPT-3.5 Turbo,在开源模型中缩小与 GPT-4 的差距。
  • DeepSeek-Coder-Base 7B 在某些设定下与更大模型(如 CodeLlama-33B)具有竞争力。
  • 仓库级数据构建显著提升跨文件代码生成能力。
  • 50% PSM 率的 Fill-In-Middle 训练在代码补全与 FIM 效果之间提供了平衡。
  • DeepSeek-Coder-Instruct 模型在 LeetCode Contest 任务中表现强劲,33B 超过若干开源基线,在某些任务中接近 GPT-4 级别。
  • 在 DS-1000 数据科学基准上,DeepSeek-Coder-33B 在 Matplotlib、NumPy、Pandas、PyTorch、SciKit-Learn、TensorFlow 等库上实现显著的特定库准确性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。