TL;DR
DeepSeek-Coder is a new family of open-source large language models for code, trained on 2 trillion tokens across 87 programming languages. These models achieve state-of-the-art performance among open-source code models and even surpass some closed-source models like GPT-3.5 on various coding benchmarks, all while being available under a permissive license.
What Problem Does This Paper Address?
The field of code intelligence has seen rapid advancements thanks to large language models (LLMs). However, a significant portion of these powerful models are closed-source, limiting research and development accessibility. This creates a performance gap between proprietary models and publicly available ones. DeepSeek-Coder aims to bridge this gap by providing a suite of high-performing, open-source code LLMs that are accessible for both research and commercial use.
Methods
The DeepSeek-Coder series employs several key techniques:
- Massive Pre-training: Models are trained from scratch on a colossal dataset of 2 trillion tokens, covering 87 programming languages.
- Project-Level Corpus: The training data is organized at the repository level, aiming to improve the model's understanding of cross-file dependencies, a crucial aspect of real-world software development.
- Fill-in-the-Middle (FIM) Objective: Beyond standard next-token prediction, the models are trained using an FIM task. This involves randomly masking parts of the code and training the model to fill them in, enhancing code completion and infilling capabilities.
- Extended Context Window: The models feature a 16K token context window, allowing them to process and understand longer code sequences, beneficial for complex projects.
- Instruction Tuning: Base models are further fine-tuned with high-quality instructional data to create "Instruct" versions, improving their ability to follow human commands and engage in multi-turn conversations.
Datasets
- Training Data:
- 87% Source Code
- 10% English code-related natural language corpus
- 3% Code-unrelated Chinese natural language corpus
- Trained on 2 trillion tokens.
- Evaluation Benchmarks:
- HumanEval: A benchmark for evaluating code generation capabilities in Python.
- MBPP: Another benchmark for code generation, with a few-shot setting.
- DS-1000: A newly constructed benchmark focusing on practical data science workflows across seven libraries (Matplotlib, NumPy, Pandas, SciPy, Scikit-learn, TensorFlow, PyTorch). It evaluates code generation by executing code against specific test cases.
- LeetCode Contest Benchmark: A custom benchmark created from recent LeetCode contest problems to assess performance on real-world programming challenges.
- CrossCodeEval: A benchmark for cross-file code completion tasks, requiring models to understand repositories spanning multiple files.
- Program-based Math Reasoning: Evaluated using benchmarks like GSM8K, MATH, and others, assessing the model's ability to solve math problems by generating code.
Key Insights and Ideas
- Open-Source Powerhouse: DeepSeek-Coder demonstrates that high-performance code LLMs can be achieved and shared openly, democratizing access to advanced code intelligence tools.
- Repository-Level Training Matters: Organizing training data at the repository level significantly boosts cross-file code completion capabilities, highlighting the importance of understanding project structure.
- FIM is Crucial for Completion: The Fill-in-the-Middle objective is instrumental in enhancing code completion performance, offering a more robust approach than just next-token prediction.
- Smaller Models Can Compete: The DeepSeek-Coder-Base 6.7B model shows competitive performance against much larger models like CodeLlama-34B, indicating the efficiency and quality of their training data and methodology.
- Instruction Tuning Bridges the Gap: Instruction-tuned DeepSeek-Coder models significantly narrow the performance gap with closed-source models like GPT-3.5, making them highly capable for interactive coding tasks.
Key Results
- State-of-the-Art Open-Source: DeepSeek-Coder-Base 33B achieves state-of-the-art performance among open-source code models on HumanEval and MBPP benchmarks, with an average accuracy of 50.3% and 66.0% respectively.
- Surpassing Closed-Source: DeepSeek-Coder-Instruct 33B outperforms GPT-3.5 Turbo on the LeetCode Contest benchmark and significantly reduces the gap with GPT-4.
- DS-1000 Performance: DeepSeek-Coder-Base 33B achieves a 40.2% average score on the DS-1000 benchmark, demonstrating strong performance in real-world data science workflows.
- Cross-File Completion: DeepSeek-Coder models consistently outperform other models in cross-file completion tasks across multiple languages, especially when trained with repository-level data.
- Program-based Math Reasoning: The 33B variant shows remarkable performance on program-based math reasoning tasks, indicating its potential for complex computational problem-solving.
Limitations and Future Work
- Data Contamination: The authors acknowledge that despite efforts to gather recent data, the possibility of data contamination in benchmarks like LeetCode cannot be entirely ruled out. They encourage the community to consider this when evaluating models.
- Long Context Empirical Limits: While the models are designed for 16K context, empirical observations suggest the most reliable outputs are within this range, with potential for further research into optimizing longer contexts (up to 64K theoretically).
- Future LLM Development: The authors express a commitment to developing and sharing even more powerful code-focused LLMs based on larger-scale general LLMs, emphasizing the synergy between robust general LLMs and specialized code models.
Summary updated