GitHub - deepseek-ai/DeepSeek-Coder: DeepSeek Coder: Let the Code Write Itself
Key Points
- 1DeepSeek-Coder is a series of code language models trained from scratch on 2 trillion tokens, comprising 87% code and 13% linguistic data to support advanced project-level code completion and infilling.
- 2These models demonstrate state-of-the-art performance across various coding benchmarks, with the 33B version significantly outperforming existing open-source alternatives and the 7B model achieving comparable results to larger competitors.
- 3The repository provides comprehensive tools for model usage, instruction fine-tuning, and high-throughput inference using frameworks like Hugging Face, vLLM, and GGUF quantization.
DeepSeek-Coder represents a sophisticated suite of open-source code language models designed to bridge the gap between large language models and software engineering. Trained from scratch on a massive corpus of 2 trillion tokens, the model architecture is optimized for code-centric tasks, with a data composition of 87% source code and 13% natural language (English and Chinese). Available in parameter scales ranging from 1B to 33B, the models leverage a 16K window size and specialized infilling capabilities to excel at project-level code completion and generation.
Core Methodology and Training Procedure
The model development follows a structured three-phase training pipeline:- Data Creation: The pipeline begins with high-quality data curation from GitHub, applying filtering rules similar to the StarCoder dataset. To facilitate repository-level understanding, the authors parse file dependencies to rearrange code fragments, concatenate dependent files into unified training examples, and employ a minhash-based deduplication strategy to ensure data diversity. A final quality filtering step removes instances with syntax errors or poor readability.
- Pre-training: The pre-training phase occurs in two stages. Initially, models are trained on 1.8T tokens with a 4K window size using a mixture of code, technical documentation (GitHub Markdown, StackExchange), and Chinese linguistic data. Subsequently, the models undergo further pre-training on 200B tokens with an extended 16K context window, resulting in the foundational
DeepSeek-Coder-Basevariants. - Instruction Fine-tuning: The foundational models are then fine-tuned on 2 billion tokens of high-quality instruction data to produce
DeepSeek-Coder-Instructvariants, enabling conversational coding assistance and complex task reasoning.
Technical Capabilities and Features
- Fill-in-the-Blank Task: The models support advanced code infilling, which allows for the insertion of missing code segments by processing both preceding and succeeding context.
- Project-Level Context: By concatenating dependent files and utilizing a large 16K context window, the model can perform cross-file reasoning, allowing it to navigate multiple files (e.g.,
utils.py,model.py, andmain.py) to generate contextually aware code completion. - Instruction Adherence: The instruct-tuned variants utilize a specific prompt template, ensuring the model acts as an AI programming assistant that prioritizes computer science topics and adheres to strict safety protocols regarding non-coding or sensitive queries.
- Model Quantization & Deployment: The authors provide paths for deployment via
vLLMfor high-throughput inference and support forGGUF(viallama.cpp) andGPTQ(viaexllamav2) to facilitate local execution.