TL;DR
The BigCode project introduces StarCoder2, a new generation of code-focused Large Language Models (LLMs), trained on The Stack v2, a massive, responsibly curated dataset of code and code-related text. StarCoder2 models, particularly the 15B parameter version, demonstrate state-of-the-art performance across various code completion, reasoning, and editing benchmarks, often outperforming larger models and setting new benchmarks for open-access code LLMs.
What Problem Does This Paper Address?
The paper addresses the need for more capable, open, and responsibly developed Large Language Models for Code (Code LLMs). While existing Code LLMs have shown promise, there's a continuous demand for models that are not only more performant across a wider range of programming languages and tasks but also trained on larger, cleaner, and more transparent datasets. The authors also highlight the importance of responsible development, including data curation, PII redaction, and making models and data transparently available. This work aims to advance the state-of-the-art in Code LLMs by introducing a new generation of models and a significantly expanded training dataset.
Methods
The core of this work involves:
- The Stack v2 Dataset: Building upon the Software Heritage archive, The Stack v2 is a massive dataset (4x larger than its predecessor) encompassing 619 programming languages. It includes not only source code but also GitHub pull requests, Kaggle notebooks, and code documentation, all subjected to extensive cleaning, filtering, and deduplication.
- StarCoder2 Models: Training three models with 3B, 7B, and 15B parameters. These models utilize architectural improvements like Rotary Positional Encodings (ROPE) and Grouped Query Attention (GQA).
- Two-Stage Training: Models are initially trained with a 4k context window and then fine-tuned with a 16k context window for long-context capabilities.
- Comprehensive Evaluation: Rigorous evaluation across a wide array of benchmarks covering code completion, code reasoning, code editing, and security.
- Responsible AI Practices: Emphasis on transparency, PII redaction, malware removal, and providing open access to model weights under an OpenRAIL license.
Datasets
Training Datasets:
- The Stack v2: A new, massive dataset derived from the Software Heritage archive, expanded with GitHub pull requests, Kaggle notebooks, and code documentation. It spans 619 programming languages and contains approximately 3.3-4.3 trillion tokens.
- Supplementary Datasets: Various natural language datasets, documentation, intermediate representations, and small math/coding datasets were also incorporated.
Evaluation Benchmarks:
- Code Completion: HumanEval, MBPP, EvalPlus, MultiPL-E, DS-1000.
- Code Fixing/Editing: HumanEvalFix, CanItEdit.
- Reasoning: GSM8K.
- Code Understanding/Execution: CRUXEval.
- Fill-in-the-Middle (FIM): A benchmark for code infilling tasks.
- Repository-Level Code Completion: RepoBench, CrossCodeEval.
- Security: "Asleep at the Keyboard" benchmark.
- Harmful Generations: BOLD, WinoBias, HONEST, RealToxicityPrompts.
Key Insights and Ideas
- Dataset Scale and Quality Matter: The significant increase in dataset size and the meticulous cleaning and curation process for The Stack v2 directly translate to improved model performance, highlighting the critical role of data in LLM development.
- Openness Drives Progress: The BigCode project's commitment to open science, open access models, and transparent data practices accelerates research and fosters community collaboration, benefiting the entire field.
- Responsible Development is Crucial: Proactive measures like PII redaction, malware scanning, and license filtering are essential for building trustworthy and safe AI systems, especially for code generation.
- Model Size vs. Performance Trade-offs: While larger models generally perform better, StarCoder2-15B demonstrates that optimized training and data can lead to competitive or superior performance compared to much larger models, especially in reasoning and math tasks.
- Specialized Data for Specialized Tasks: Incorporating diverse data sources like pull requests, notebooks, and documentation enriches the models' understanding of real-world coding practices and improves their utility.
Key Results
- StarCoder2-3B: Outperforms other Code LLMs of similar size and matches or surpasses StarCoderBase-15B.
- StarCoder2-7B: Competes well in its size class, outperforming StarCoderBase-7B and CodeLlama-7B.
- StarCoder2-15B: Significantly outperforms comparable models and matches or surpasses CodeLlama-34B and DeepSeekCoder-33B on several benchmarks, including math and code reasoning. It achieves state-of-the-art performance for its size.
- The Stack v2: Is 4x larger than the first StarCoder dataset, containing 3.3-4.3 trillion tokens.
- Responsible AI: Over 1,500 repositories were removed due to opt-out requests, and PII redaction was applied across various data sources.
Limitations and Future Work
- FIM Performance: StarCoder2-15B underperforms on the Fill-in-the-Middle (FIM) benchmark due to an implementation bug during training. Future work may address this.
- C++ Performance: StarCoder2-15B underperforms on C++ in the "Issue" prompt format for code editing, potentially due to incomplete code generation. Further prompt engineering or instruction tuning might be needed.
- Low-Resource Languages: While StarCoder2-15B shows improvements on some low-resource languages, further research is needed to achieve uniformly high performance across all programming languages.
- Instruction Tuning: The authors suggest that instruction tuning StarCoder2 could further improve its usability and performance, especially for tasks requiring more direct interaction or alignment with human preferences.
- Bias and Harmful Generations: While models produce comparable amounts of harmful content, ongoing research is needed to mitigate societal biases and ensure responsible downstream use.
Summary updated