---
title: "StarCoder 2 and The Stack v2: The Next Generation (2024)"
description: "How StarCoder2 combines a traceable code corpus, repository context, and extensive training, and what its evaluations establish about…"
canonical: "https://research.elamur.ai/free/en/papers/lozhkov-2024-starcoder-2-stack-v2-next/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/lozhkov-2024-starcoder-2-stack-v2-next/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / StarCoder 2 and The Stack v2: The Next Generation

# StarCoder 2 and The Stack v2: The Next Generation

Paper · 2024 · Anton Lozhkov, Raymond Li, Loubna Ben Allal et al.

**Authors:** [Anton Lozhkov](https://md.research.elamur.ai/free/en/authors/anton-lozhkov/), [Raymond Li](https://md.research.elamur.ai/free/en/authors/raymond-li/), [Loubna Ben Allal](https://md.research.elamur.ai/free/en/authors/loubna-ben-allal/), [Federico Cassano](https://md.research.elamur.ai/free/en/authors/federico-cassano/), [Joel Lamy-Poirier](https://md.research.elamur.ai/free/en/authors/joel-lamy-poirier/), [Nouamane Tazi](https://md.research.elamur.ai/free/en/authors/nouamane-tazi/), Ao Tang, [Dmytro Pykhtar](https://md.research.elamur.ai/free/en/authors/dmytro-pykhtar/), [Jiawei Liu](https://md.research.elamur.ai/free/en/authors/jiawei-liu/), [Yuxiang Wei](https://md.research.elamur.ai/free/en/authors/yuxiang-wei/), [Tianyang Liu](https://md.research.elamur.ai/free/en/authors/tianyang-liu/), Max Tian, [Denis Kocetkov](https://md.research.elamur.ai/free/en/authors/denis-kocetkov/), Arthur Zucker, [Younes Belkada](https://md.research.elamur.ai/free/en/authors/younes-belkada/), [Zijian Wang](https://md.research.elamur.ai/free/en/authors/zijian-wang/), [Qian Liu](https://md.research.elamur.ai/free/en/authors/qian-liu/), [Dmitry Abulkhanov](https://md.research.elamur.ai/free/en/authors/dmitry-abulkhanov/), [Indraneil Paul](https://md.research.elamur.ai/free/en/authors/indraneil-paul/), [Zhuang Li](https://md.research.elamur.ai/free/en/authors/zhuang-li/), [Wen-Ding Li](https://md.research.elamur.ai/free/en/authors/wen-ding-li/), Megan Risdal, [Jia Li](https://md.research.elamur.ai/free/en/authors/jia-li/), [Jian Zhu](https://md.research.elamur.ai/free/en/authors/jian-zhu/), [Terry Yue Zhuo](https://md.research.elamur.ai/free/en/authors/terry-yue-zhuo/), [Evgenii Zheltonozhskii](https://md.research.elamur.ai/free/en/authors/evgenii-zheltonozhskii/), Nii Osae Osae Dade, [Wenhao Yu](https://md.research.elamur.ai/free/en/authors/wenhao-yu/), Lucas Krauß, [Naman Jain](https://md.research.elamur.ai/free/en/authors/naman-jain/), [Yixuan Su](https://md.research.elamur.ai/free/en/authors/yixuan-su/), [Xuanli He](https://md.research.elamur.ai/free/en/authors/xuanli-he/), [Manan Dey](https://md.research.elamur.ai/free/en/authors/manan-dey/), Edoardo Abati, [Yekun Chai](https://md.research.elamur.ai/free/en/authors/yekun-chai/), [Niklas Muennighoff](https://md.research.elamur.ai/free/en/authors/niklas-muennighoff/), [Xiangru Tang](https://md.research.elamur.ai/free/en/authors/xiangru-tang/), Muhtasham Oblokulov, [Christopher Akiki](https://md.research.elamur.ai/free/en/authors/christopher-akiki/), [Marc Marone](https://md.research.elamur.ai/free/en/authors/marc-marone/), [Chenghao Mou](https://md.research.elamur.ai/free/en/authors/chenghao-mou/), [Mayank Mishra](https://md.research.elamur.ai/free/en/authors/mayank-mishra/), [Alex Gu](https://md.research.elamur.ai/free/en/authors/alex-gu/), [Binyuan Hui](https://md.research.elamur.ai/free/en/authors/binyuan-hui/), [Tri Dao](https://md.research.elamur.ai/free/en/authors/tri-dao/), [Armel Zebaze](https://md.research.elamur.ai/free/en/authors/armel-zebaze/), Olivier Dehaene, [Nicolas Patry](https://md.research.elamur.ai/free/en/authors/nicolas-patry/), [Canwen Xu](https://md.research.elamur.ai/free/en/authors/canwen-xu/), [Julian McAuley](https://md.research.elamur.ai/free/en/authors/julian-mcauley/), [Han Hu](https://md.research.elamur.ai/free/en/authors/han-hu/), [Torsten Scholak](https://md.research.elamur.ai/free/en/authors/torsten-scholak/), Sebastien Paquet, Jennifer Robinson, [Carolyn Jane Anderson](https://md.research.elamur.ai/free/en/authors/carolyn-jane-anderson/), [Nicolas Chapados](https://md.research.elamur.ai/free/en/authors/nicolas-chapados/), [Mostofa Patwary](https://md.research.elamur.ai/free/en/authors/mostofa-patwary/), [Nima Tajbakhsh](https://md.research.elamur.ai/free/en/authors/nima-tajbakhsh/), [Yacine Jernite](https://md.research.elamur.ai/free/en/authors/yacine-jernite/), [Carlos Muñoz Ferrandis](https://md.research.elamur.ai/free/en/authors/carlos-munoz-ferrandis/), [Lingming Zhang](https://md.research.elamur.ai/free/en/authors/lingming-zhang/), [Sean Hughes](https://md.research.elamur.ai/free/en/authors/sean-hughes/), [Thomas Wolf](https://md.research.elamur.ai/free/en/authors/thomas-wolf/), [Arjun Guha](https://md.research.elamur.ai/free/en/authors/arjun-guha/), [Leandro von Werra](https://md.research.elamur.ai/free/en/authors/leandro-von-werra/) and [Harm de Vries](https://md.research.elamur.ai/free/en/authors/harm-de-vries/) · **Year:** 2024 · **Venue:** arXiv:2402.19173 · **Licence:** [CC BY-SA 4.0 (arXiv)](http://creativecommons.org/licenses/by-sa/4.0/)

[**74** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W6967084484) · [licence](http://creativecommons.org/licenses/by-sa/4.0/)

- [PDF](https://arxiv.org/pdf/2402.19173)
- [arXiv 2402.19173](https://arxiv.org/abs/2402.19173)
- [OpenAlex](https://openalex.org/W6967084484)

## Deep dive: StarCoder 2 and The Stack v2: The Next Generation

How StarCoder2 combines a traceable code corpus, repository context, and extensive training, and what its evaluations establish about coding ability. · about 39 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

A code assistant can produce a convincing function while leaving important questions unanswered. Does the function survive demanding tests? Can the assistant use definitions from another file? What material shaped its behavior, and can the people who created that material inspect its inclusion? StarCoder2 addresses these questions together. The paper presents a family of code-focused [language models](https://md.research.elamur.ai/free/en/concepts/language-model/) and a training corpus whose construction, filtering, and provenance are central parts of the contribution. Its argument is that useful code generation and inspectable development should advance together.

The data foundation is The Stack v2, assembled with Software Heritage, an organization that preserves source code. The authors reconstruct repositories from its archive, identify programming languages and licenses, remove duplicates, and apply quality and governance filters. They supplement repository code with discussions, pull requests, notebooks, documentation, and material involving mathematics and reasoning. The raw collection occupies 67.5 TB. Cleaning, selection, and the addition of supplementary sources produce approximately 3TB of training material, with 900B+ distinct tokens. The most comprehensive training mixture covers 619 programming languages. This is a substantial expansion over the earlier StarCoder training corpus, although the smaller StarCoder2 variants deliberately receive a narrower mixture.

StarCoder2 comes in 3B, 7B, and 15B parameter sizes. Parameters are the learned values that determine predictions; tokens are the units into which training text is divided. The authors train on 3.3 to 4.3 trillion tokens, reusing the available material for several passes instead of seeing every token only once. Training begins with a 4k context window and continues with a 16k window. Repository files are grouped together, and some examples are rearranged so that a missing code span must be predicted from material on both sides. These choices address coding settings beyond generating an isolated function from a description.

The strongest findings concern the smallest and largest variants. StarCoder2-3B leads comparable small systems on most of the evaluated tasks and often matches or exceeds the earlier StarCoderBase-15B. StarCoder2-15B is strong within its size group and is competitive with CodeLlama-34B. DeepSeekCoder-33B remains stronger on code completion in widely represented programming languages, but StarCoder2-15B is competitive on several less represented languages and performs strongly on mathematical and execution-oriented reasoning. The picture is less favorable for StarCoder2-7B: it improves over CodeLlama-7B but generally trails DeepSeekCoder-6.7B, and the authors do not establish why its relative performance is weaker.

The release also makes the development process easier to investigate. The authors publish weights under the BigCode Open RAIL-M license, disclose training-data identities through Software Heritage identifiers, and provide membership and search facilities. These measures support inspection and attribution, but they do not certify that generated code is secure, private, or correctly attributed. The paper reports weaknesses in security evaluation, uneven performance across languages, and implementation problems affecting some training settings. Its contribution is therefore both a capable code-generation family and a detailed, auditable account of how that family was built.

### Ideas worth borrowing

Make provenance part of the data structure. The Stack v2 retains links to identifiable software artifacts rather than treating training text as an anonymous collection. This makes later questions about inclusion, licensing, and origin more tractable. The reusable idea is to preserve source identity while collecting and transforming data, because reconstructing it afterward can be difficult. Smaller corpora, retrieval collections, and specialized training projects can adopt the same principle without reproducing the scale of Software Heritage.

Match diversity to capacity. The authors do not assume that every system should receive every available source. The smaller variants focus on a selected group of programming languages, while the largest receives the full language collection. Their motivation comes from earlier multilingual research suggesting that languages compete for limited capacity. This is a useful design hypothesis for specialized systems: additional coverage may introduce competition as well as useful information. The paper supports treating mixture breadth as an explicit choice, although it does not isolate the effect through a complete controlled experiment.

Preserve the context that makes examples meaningful. A source file belongs to a repository; a review comment refers to a change; a notebook explanation precedes code that may produce an output. The authors retain these relationships through grouping and structured formatting. This can apply wherever flat text loses the connection between an action and its justification. Examples include collections of revisions, technical discussions, and documents whose sections depend on shared definitions. The important borrowing is the preservation of relationships, instead of any particular sentinel token.

Adapt prompts to familiar training formats. StarCoder2 performs much better at bug fixing when a task resembles the discussions it encountered during pretraining. The authors frame buggy code as an issue and invite a response containing a correction. This offers a practical lesson for evaluating an existing system: a poorly matched interface can hide useful capability. The idea also applies to document completion and structured technical assistance, provided that prompt sensitivity is reported instead of being mistaken for a stable, interface-independent skill.

Evaluate capabilities separately. Function completion, editing, repository use, execution reasoning, and secure generation answer different questions. The paper’s broad evaluation shows why a single coding score cannot stand for all of them. An engineer can reuse this approach by choosing tests that correspond to intended behavior and keeping their metrics distinct. A system that passes short function tests may still struggle with external dependencies, incomplete edits, or unsafe implementation choices.

Offer several levels of inspection. Repository membership checking, content membership checking, and full-text search serve different users and costs. The paper combines lightweight facilities with a more demanding search index, rather than expecting everyone to download and analyze the corpus. This is a useful pattern for transparent data systems generally. A concise dataset description explains policy; an interactive membership check answers a specific inclusion question; a search facility supports deeper investigation.

Treat training mistakes as evidence to report. The authors disclose a configuration-parsing problem affecting positional settings and an implementation problem that reduced fill-in-the-middle exposure for the largest variant. These details help explain why performance does not always follow the intended recipe. The transferable practice is to distinguish a planned configuration from the process that actually ran. That distinction matters in any experiment where a result might otherwise be attributed to architecture or data selection alone.

### How Mova uses it

For Mova, the small transparent language system written in Rust, the most directly relevant contribution is the treatment of data as something that should remain inspectable after collection. The available account does not establish that Mova has incorporated StarCoder2 weights, The Stack v2, its tokenizer, or its preprocessing pipeline. The connections here are therefore possible engineering directions, not claims about completed integration.

A concrete adaptation would be a provenance record attached to every retained training or retrieval item. That record could preserve the original source, an artifact identifier when available, the detected license, and the transformations applied before use. The paper demonstrates why these fields belong together: a file’s origin, its license classification, and its final rendered form are different facts. For a transparent system, preserving their relationship would help explain why an item was admitted and how it changed.

Mova could also separate collection from admission. In the StarCoder2 pipeline, obtaining a file does not automatically make it training material. Language identification, quality checks, license decisions, duplicate removal, privacy processing, and opt-out handling intervene. A smaller Rust implementation could express comparable stages as explicit transformations with recorded outcomes. The useful property would be a readable chain of decisions, allowing a rejected example to be traced to a particular rule.

The capacity argument is relevant to a small system, but it should remain a hypothesis. StarCoder2’s authors restrict the smaller variants to a narrower source-code mixture because they expect limited capacity to make excessive diversity costly. Mova could investigate an analogous question by comparing a focused collection with a broader one under a fixed evaluation setup. This paper does not prove that less diversity is always preferable, nor does it establish the best mixture for Mova. It suggests a variable worth measuring instead of assuming that more sources must improve every task.

Structured examples offer another possible connection. If Mova handles code-related material, it could preserve file boundaries, repository membership, discussion turns, and notebook cell types. Such boundaries would make the input easier to inspect and could prevent unrelated fragments from being presented as a coherent sequence. The implementation need not reproduce every StarCoder2 marker. What matters is that a reader can distinguish code from explanation, a proposed change from an accepted change, and one speaker from another.

The paper’s evaluation approach could guide a modest but informative Mova test collection. Completion, correction, context use, and factual interpretation should be examined separately when they correspond to intended uses. Functional checks should also remain distinct from security checks. StarCoder2’s results show that producing valid, useful code and avoiding vulnerabilities can move differently. A small transparent system would benefit from making those distinctions visible in its own reports.

Finally, Mova could adopt a layered approach to membership inspection. A source list answers where material came from; a content check answers whether a passage occurs in the collection; a search interface supports investigation of related material. The paper’s tools demonstrate the value of these separate questions. They do not establish that any membership match identifies the cause of a particular generated answer. Preserving that boundary would be especially important for a system whose transparency claims depend on explanations that users can verify.

### The problem and its context

#### Useful code generation needs more than accessible weights

The paper begins from the growing practical role of [code and programming language systems](https://md.research.elamur.ai/free/en/topics/code-and-programming/). Earlier work had already demonstrated that systems trained on code could complete functions, translate descriptions into programs, and assist with editing. The authors place StarCoder2 within that progression while emphasizing a second issue: what researchers and developers can know about the training process.

The paper distinguishes several kinds of openness. A service can expose an interface while withholding its implementation and training details. A developer can publish learned weights, enabling local use and further adaptation, without identifying the training corpus. A more comprehensive release can also disclose the data, training framework, and evaluation setup. These arrangements provide different opportunities for independent research.

The authors discuss GPT-4 and Gemini as examples of access through services whose development details are not fully disclosed. They describe Code Llama, Mistral, and DeepSeekCoder as releases that make weights available without revealing their training data. This is an account of the disclosure practices relevant to the paper’s comparison, rather than an argument that accessible weights have no value. The authors explicitly recognize that weights enable local execution, inspection, and [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/).

Their objection concerns the questions that remain difficult without data access. A developer cannot readily check whether their repository contributed to training. An evaluator cannot systematically inspect benchmark overlap. A researcher studying harmful content cannot examine the collection behind observed behavior. Other teams also lose the opportunity to reuse or modify the same corpus when testing alternative methods.

The paper situates its approach alongside projects such as [OLMo](https://md.research.elamur.ai/free/en/papers/groeneveld-2024-olmo-accelerating-science-language-models/), Pythia, and BLOOM, which it presents as examples of more extensive development disclosure. The scientific motivation is straightforward: an experimental result is more useful when another group can inspect the material and procedures that produced it.

#### The path from The Stack to StarCoder2

BigCode’s earlier corpus, The Stack v1, supplied 6.4 TB of permissively licensed code across 384 programming languages. It also introduced a membership-checking service and a process through which developers could request removal. These governance mechanisms form part of the technical background to The Stack v2, rather than appearing only as release documentation.

SantaCoder was an earlier, smaller effort. Its 1.1B parameters were trained on Java, JavaScript, and Python from The Stack v1. The first StarCoder expanded the project to a 15B-parameter system. StarCoder2 continues that sequence, but its data construction changes substantially through the partnership with Software Heritage.

Software Heritage contributes more than another download source. Its archive represents relationships among file contents, directories, commits, and repository states. These relationships let the authors reconstruct repositories and retain identifiers for the artifacts they use. The archive therefore supports both training-data organization and later traceability.

The previous StarCoder training setup mostly joined files without preserving repository membership. StarCoder2 instead places files from the same repository together. This reflects a practical limitation of isolated-file training: a code completion may depend on an imported definition, a nearby configuration file, or a convention established elsewhere in the project. The repository becomes a meaningful unit of context.

The supplementary sources address another gap. Source files show finished code, but they do not always explain why a change was requested, how a bug was discussed, or what data a notebook expects. Pull requests, issues, documentation, and structured notebooks supply some of that missing information. The corpus is designed to expose relationships among descriptions, code, revisions, and outputs.

#### Smaller systems trained for longer

The authors also make a deliberate choice about training allocation. Rather than scaling parameter counts alone, they train relatively compact systems on a large amount of text. They state that the token budgets exceed the compute-optimal amounts suggested by Chinchilla, while limiting repetition to no more than 5 epochs.

An epoch is a pass through the available training material. Repetition means that total training tokens and distinct corpus tokens describe different quantities. A corpus with 900B+ distinct tokens can support a larger training-token budget because examples are revisited. The paper’s claim about extensive training therefore should not be interpreted as a claim that all the trillions of training tokens are unique.

This strategy matters to the results because the principal comparisons involve systems of similar parameter size, as well as larger alternatives. Strong performance by StarCoder2-3B or StarCoder2-15B demonstrates what the whole recipe achieves at those sizes. It does not, on its own, determine whether the gains came chiefly from longer training, different data, repository grouping, or architectural changes.

The paper’s central problem is consequently broader than improving a benchmark score. It asks how to build strong code-generation systems while exposing their data foundation, and how to evaluate them across the different activities that coding assistance requires. The resulting report combines corpus construction, training design, evaluation, and governance rather than isolating a single algorithmic innovation.

### The method, step by step

The method starts with archived software and ends with both trained systems and inspection facilities. Much of the work happens before optimization begins. The authors must decide which repository state to use, what counts as useful content, how heterogeneous sources should be represented, and which parts of the collection each system should see.

From archived software to evaluated StarCoder2 systems The steps in order.

#### Reconstruct repository snapshots

The primary archive snapshot is dated `2023-09-06`. The authors extract the most recently crawled versions of GitHub repositories and select their main branches. They use repository metadata when it identifies the default branch, while also recognizing branches named `main` or `master`.

Only the latest commit from the selected branch is retained. This means the main source-code collection is based on repository snapshots instead of every historical revision. Repositories whose contents have the same directory hash are deduplicated at this stage.

The directory hierarchy is then reconstructed by joining directory entries and assembling complete file paths. Traversal stops at level 64. File contents are downloaded when their compressed size is below 10MB. These are collection boundaries: they determine which archived material can enter the subsequent pipeline.

The persistent identifiers supplied by Software Heritage remain important throughout. They connect the selected code to archived artifacts rather than only to mutable repository names. That connection is the foundation for the release’s traceability claim.

#### Identify licenses and programming languages

Repository-level license metadata is unavailable for 96.93% of the repositories. The authors therefore supplement metadata with file-based detection. They look for likely license-bearing files, including conventional license filenames and documents that may refer to licensing terms.

ScanCode Toolkit analyzes these candidate files and returns license identifiers. Detected licenses are then propagated to files sharing the relevant base path. The pipeline classifies material as permissively licensed, non-permissively licensed, or lacking an identified license.

A consequential change from The Stack v1 is the admission of unlicensed files alongside permissively licensed ones. The authors exclude commercial and copyleft categories, giving different reasons for those exclusions. Their permissive category is assembled using classifications from the Blue Oak Council and ScanCode.

This is a data-selection policy, not a demonstration that every possible use of every retained file is legally settled. It is also important to distinguish “no license identified” from an affirmative permissive license. The paper keeps those categories conceptually separate even though both can enter the collection.

Programming-language identification also changes. Rather than relying only on extensions, the authors use `go-enry`, which builds on GitHub’s Linguist. The deduplicated collection initially contains 658 detected languages. Inspection and filtering subsequently produce the reported coverage of 619 languages.

#### Remove material that is unlikely to teach useful code

The quality filters target generated files, large data payloads, and other material that can dominate token counts without contributing useful programming examples. Some rules apply broadly; others account for language-specific conventions.

Files exceeding 100k lines are removed. For most languages, the pipeline also rejects files whose average line length exceeds 100 characters or whose longest line exceeds 1000 characters. Several document and data-oriented languages receive different treatment because long lines are more normal in those formats.

Generated-code detection combines a library function with searches near the beginning of a file for phrases indicating automatic generation. An alphabetic-content filter removes files with little letter content, with an alphanumeric variant used for particular assembly-related languages. Further checks identify long encoded payloads such as Base64 and hexadecimal sequences.

These rules are imperfect proxies for usefulness. Their purpose is to reduce obvious bulk and repetition, not to decide whether each surviving program is correct. The language-specific exceptions matter because a uniform text heuristic can reject legitimate examples in a language whose notation differs from common source code.

Human inspection complements these automatic checks. Community annotators examine extensions that have sufficient representation among newly considered languages. The authors report that 15 annotators inspected around 1000 extensions and rejected 130. This stage also removes 39 programming languages from the collection.

Smaller extensions remain without the same inspection because they contribute little volume. Thus, human review is targeted rather than exhaustive. The resulting corpus reflects both explicit inspection decisions and a decision to retain some less common material without further manual assessment.

#### Add discussions and software changes

GitHub issues introduce explanations and interaction around software problems. The authors remove email-reply boilerplate, filter bot comments, shorten lengthy comments, and use participation patterns as a rough quality signal. They preserve speaker continuity through conversation-specific pseudonyms.

Pull requests receive a more elaborate treatment because they combine code states, edits, and discussion. The collection process aggregates several event types from GHArchive and retrieves the associated base and head commits from Software Heritage. Since the required diffs are not directly available, the authors reconstruct changes by comparing files at matching paths.

The initial pull-request collection contains roughly 300M PRs and 15 TB of base code. Many are removed before training. Rejection conditions include bot-originated activity, non-permissive licensing, opt-outs, missing initial changes, and a lack of approval or merging.

Further filters address file shape and the quality of titles, descriptions, and comments. Per-repository sub-sampling prevents repositories with many pull requests from overwhelming the mixture. Large YAML and JSON components can also be reduced when they dominate the base-file volume or resemble generated dependency material.

The final length choice admits pull requests of up to 100K characters. At that limit, the authors report 3.3M PRs occupying 67.3 GB. This material can be longer than the initial training window, so the rendering strategy tries to keep the relevant code and changes close together.

The important methodological idea is that a pull request is not reduced to a final patch alone. Its representation includes the initial description, selected code context, discussion events, review states, and subsequent changes. This creates sequences in which a request and the response to it can remain connected.

#### Preserve notebook explanations, code, and outputs

Jupyter notebooks are converted into both scripts and structured sequences. Script conversion supplies ordinary code-like material. The structured representation preserves alternating explanation and code, together with outputs when available.

For script conversion, the authors use notebook metadata to determine the programming language, with Guesslang as a fallback. Parsing failures remove part of the initial collection. After near-duplicate removal, the script version contains 4 million notebooks.

The structured Jupyter collection focuses on notebooks identified as Python. Adjacent cells of the same type are merged, preserving the order of explanation and execution. Empty outputs receive an explicit marker. After processing and deduplication, this collection contains 4.6M structured notebooks.

Kaggle supplies a separate notebook source under an Apache 2.0 license. The initial 3.6M notebooks are filtered for minimum content and syntax validity, stripped of standard introductory templates, converted, and deduplicated. The resulting collection contains 580k notebooks.

The authors also try to recover context about the data being analyzed. Dataset titles and descriptions are available for 42% of the notebooks. For 8.6%, they obtain more detailed information and prepend schema-related output and sample rows.

This context can explain column names and expected types that would otherwise appear without definition in the code. The paper does not isolate the benefit of that enrichment experimentally, but the representation makes the information available during training. Kaggle’s contribution lacks notebook output cells, so its structured format differs from the Jupyter version.

#### Collect documentation and other explanatory material

Documentation comes from package ecosystems, selected websites, existing web collections, and freely available programming books. The authors seek library homepages and documentation locations, then extract readable content while reducing repeated navigation and layout elements.

For website documentation, HTML is converted through an XML representation into Markdown. Similar pages are removed before content from a site is assembled. The order follows the crawl, which uses a breadth-first traversal strategy.

This procedure tries to avoid spending training capacity on repeated menus and website scaffolding. It also keeps documentation in a relatively simple textual format. The authors separately identify programming-related documents in existing web corpora through code patterns and URL features.

The book collection includes 3,541 parsed books in several natural languages. Documentation language identification uses source-specific rules when the association is clear and Guesslang otherwise. This creates a collection organized partly around the programming language being discussed, rather than treating all prose as undifferentiated text.

The additional natural-language sources broaden the mixture further. They include StackOverflow discussions, arXiv material, English Wikipedia, and OpenWebMath. The authors do not include every one of these sources in every StarCoder2 variant.

StackOverflow requires special cleaning because the authors find mismatched questions and answers. They use ratings from a larger assistant to construct examples for a matching classifier, then apply a similarity threshold to the wider collection. The embedding component draws on work represented by [Sentence-BERT](https://md.research.elamur.ai/free/en/papers/reimers-2019-sentence-bert-sentence-embeddings-siamese/) and [MTEB](https://md.research.elamur.ai/free/en/papers/muennighoff-2022-mteb-massive-text-embedding-benchmark/).

The final StackOverflow collection is reported as 11.4 million questions and over 10B tokens. This is a filtering mechanism based on semantic compatibility; it does not establish that every retained answer is correct or safe.

#### Pair source code with compiler representations

The intermediate-representation component addresses transfer across programming languages. An intermediate representation is a compiler-oriented form between source code and lower-level execution machinery. The authors choose LLVM because it occurs in existing code collections and is supported by compiler frontends for multiple languages.

The underlying hypothesis is that different source languages can be connected through a shared representation. A construct in a less represented language might become easier to associate with familiar behavior when paired with LLVM material. The paper presents this as a motivation, instead of isolating it as a proven explanation for the multilingual results.

To obtain compilable programs, the authors use accepted solutions to programming problems. These are more self-contained than arbitrary repository files, which frequently require difficult dependency reconstruction. They compile roughly 4M sources across a range of languages.

Most pairs use size-optimized compiler output because it is more compact. Performance-optimized output is used for 20% of pairs. Platform-specific and other extraneous details are removed before the source and intermediate representation are paired.

Training examples run in both directions: source to intermediate representation and intermediate representation to source. Direction-specific markers distinguish the tasks. This makes the relationship explicit in the sequence instead of expecting it to emerge from unrelated appearances of the two forms.

#### Apply shared cleaning and governance operations

Near-duplicate removal applies to code, discussions, pull requests, notebooks, and documentation. The authors use MinHash fingerprints and locality-sensitive hashing to find similar items. The settings use 5-grams and a Jaccard threshold of 0.7.

A 5-gram is a local sequence used to characterize content. Jaccard similarity compares overlap between sets of such units. MinHash and hashing buckets make approximate similarity discovery practical without comparing every item directly with every other item.

Choosing which duplicate survives also affects context. The pipeline favors repositories with higher star and fork counts, using a more recent commit as a tie-breaker. This is intended to preserve useful repository material while removing repeated copies.

Privacy processing relies largely on StarPII. The targeted categories include names, email addresses, credentials, network addresses, and usernames, with different category choices for different sources. Conversation participants receive local identifiers so that dialogue remains understandable after author names are replaced.

Benchmark decontamination removes files matching selected test material from HumanEval, MBPP, APPS, GSM8K, and DS1000. Matching ignores whitespace to improve detection. Documentation, LHQ, arXiv, and Wikipedia are excluded from this step, which becomes important when interpreting the completeness of contamination control.

Malware screening uses ClamAV 1.2 with additional signatures. It removes 59,442 files from a collection containing 654M files. Signature screening addresses detected malicious content; it is separate from evaluating whether a generated program contains a vulnerability.

The opt-out process removes material associated with developers who submitted requests before the announced cutoff. The authors report removing 1,561 repositories linked to 91 users and organizations. The source-code deletion count is 22,066 files, with that count excluding issues and pull requests.

#### Build a mixture for each parameter size

The source-code mixture for the smaller variants concentrates on 17 programming languages, together with selected documentation and configuration formats. This source-code subset contains 525B+ distinct tokens. The full version includes all 619 languages and contains 775B+ tokens.

Adding supplementary sources yields a different final mixture for each size. StarCoder2-3B receives 622B+ distinct tokens and omits OpenWebMath, Wikipedia, and arXiv. StarCoder2-7B includes those sources, reaching 658B+. StarCoder2-15B uses the full source-code collection and all supplementary categories, reaching 913B+.

The authors also reduce some high-volume languages and formats before assembling repository examples. Java and JavaScript are each reduced to 200GB. HTML is limited to 100 GB, while substantial Markdown content is retained because the authors expect it to include useful documentation.

These are deliberate distribution changes rather than a neutral reflection of everything archived. The authors generally favor the observed distribution, but intervene where a few categories would dominate. Their choices expose the training mixture as a design decision that can be inspected and questioned.

#### Render examples according to their structure

Repository examples contain files from the same project in random order. Repository names and file paths are included with 50% probability. This gives training exposure both with and without metadata, reducing dependence on information that may be absent at use time.

Fill-in-the-middle training rearranges part of a file so that the system sees the prefix and suffix before predicting the missing span. Repository examples are selected as candidates with 50% probability, and chunks within selected examples receive the transformation with 50% probability. Repository metadata is excluded from this rearrangement.

Pull requests use markers for base code, changes, comments, reviews, and status events. The authors often show changed regions rather than entire files, adding nearby context. This compact rendering is intended to preserve local edit information within the limited training window.

Issues retain titles, speaker markers, comments, and closure information. Structured notebooks distinguish text, code, and output. StackOverflow examples preserve questions, answers, and answer-related metadata. The official formatting specification therefore treats source type as meaningful information rather than erasing all boundaries during concatenation.

#### Train the architecture, then extend its context

StarCoder2 modifies the earlier architecture by replacing learned positional embeddings with rotary position encodings. Position encodings help a [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/) represent where tokens occur. The authors report favorable preliminary experiments for this replacement.

The stated base period is:

```
θ = 1e5
```

Here, θ is the base-period setting for rotary position encoding. It controls part of the positional representation. The paper also discloses that a configuration-parsing bug caused the largest variant’s values to differ from the intended configuration.

Attention changes from multi-query attention to [grouped query attention](https://md.research.elamur.ai/free/en/papers/ainslie-2023-gqa-training-generalized-multi-query/). The key-value head counts remain small: 2 for StarCoder2-3B and 4 for the larger variants. The authors describe this as a way to avoid a substantial inference slowdown.

The byte-level byte-pair encoding tokenizer has 49,152 entries, including structural markers. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/) converts text into the units predicted during training. Preliminary experiments with a 100K vocabulary did not improve performance, so the larger vocabulary was not adopted.

Base training uses sequences of 4,096 tokens and [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/). The first optimizer coefficient is:

```
β₁ = 0.9
```

β₁ is Adam’s coefficient controlling the smoothing of its gradient estimate. The second is:

```
β₂ = 0.95
```

β₂ controls the smoothing of the squared-gradient estimate. The numerical stabilizer is:

```
ε = 10⁻⁸
```

ε is the small quantity used for numerical stability in the optimizer. Weight decay is set to 0.1, and dropout is not used.

The learning rate warms up linearly for 1,000 iterations before following a cosine decay. The largest run was planned for 1.1M iterations but stopped after 1M. Across the family, training reuses the data for roughly four to five passes.

Long-context continuation uses another 200B tokens from the same corpus. Sequence length becomes 16,384, with a sliding attention window of 4,096 and [FlashAttention-2](https://md.research.elamur.ai/free/en/papers/dao-2023-flashattention-2-faster-attention-better/) supporting the computation. The rotary-position base is increased for this stage.

The paper’s mathematical content here consists primarily of configuration quantities rather than a new derived training objective. The method’s novelty lies chiefly in the corpus, mixture, formatting, training allocation, and release practices. Its success must therefore be assessed as the outcome of that combined process.

### Experiments and results

#### Read each benchmark as a different test

The evaluation covers completion, correction, editing, mathematics, execution reasoning, infilling, repository context, security, and harmful language. These tasks overlap in their demands but are not interchangeable. The authors compare StarCoder2 primarily with base variants of StableCode, Code Llama, DeepSeekCoder, and the original StarCoder family.

Bug fixing and instruction-driven editing are exceptions. Those comparisons include instruction-tuned alternatives because such tasks are less naturally served by an ordinary completion interface. The distinction matters: pretraining and instruction adaptation can both influence a score.

Pass@1 is the main functional metric in several evaluations. It measures success when considering a single generated answer under the evaluation procedure. For execution-based tasks, success generally requires satisfying the relevant tests. Other evaluations use exact textual matching, edit similarity, or measures of identifier overlap.

Sampling conditions differ across benchmarks. Some use greedy decoding, which selects the highest-scoring next token at each step. Others sample multiple completions with specified temperature and top-p settings. Scores from these procedures should be read within their own setups.

#### Python function completion and stronger hidden tests

HumanEval presents a function signature and description, while MBPP supplies a description with example tests. Both evaluate generated Python against hidden tests. The paper adopts EvalPlus because earlier analysis found weak tests, incorrect expectations, and ambiguous descriptions in the original benchmarks.

[EvalPlus](https://md.research.elamur.ai/free/en/papers/liu-2023-your-code-generated-chatgpt-really/) expands testing substantially: HumanEval+ has 80× the original test volume, and MBPP+ has 35×. The evaluation keeps 164 HumanEval tasks and uses 399 tasks from the sanitized MBPP collection.

This matters because plausible code can pass a few examples while failing on edge cases. The paper illustrates the problem with a function whose use of a set can disrupt required ordering. It also discusses a dictionary-related task where faulty expectations can penalize a reasonable solution. More tests help, but correcting test quality is also necessary.

The authors use greedy decoding for these evaluations. StarCoder2-3B leads the small-system group across HumanEval, MBPP, and their expanded-test variants. Against its earlier same-size predecessor, the paper reports relative improvements of 60.2% on HumanEval+ and 32.4% on MBPP+.

For the medium group, DeepSeekCoder-6.7B remains ahead. The paper reports that its advantage over StarCoder2-7B is 32.4% on HumanEval+ and 24.1% on MBPP+. StarCoder2-7B nonetheless improves over the other medium alternatives discussed.

The large-group HumanEval comparison gives a direct numerical example:

Python function completion on HumanEval with greedy decoding StarCoder2 leads this comparison within the large-system group.

**The numbers**

| System or setting | pass@1 |
| --- | --- |
| CodeLlama-13B | 37.8 |
| StarCoder2-15B (this paper) | 46.3 |

StarCoder2-15B also improves over StarCoderBase-15B and CodeLlama-13B on HumanEval+. The reported relative improvements are 47.7% and 17.0%, respectively. It exceeds CodeLlama-34B on MBPP and MBPP+, showing that the larger parameter count does not guarantee a higher score on these tests.

The scope remains narrow in spite of the stronger testing. These tasks mostly exercise basic Python functionality. They do not establish equivalent competence with external packages, other programming languages, or changes spanning a repository.

#### Completion across programming languages

MultiPL-E translates HumanEval tasks into 18 additional programming languages. This supports comparisons across languages while keeping the underlying problems broadly aligned. Translation can introduce its own constraints, and some prompts cannot be carried over successfully.

The authors generate 50 completions per prompt with temperature 0.2 and top-p 0.95, then report pass@1. StarCoder2-3B leads its size group on 11/18 languages. StarCoder2-15B leads its group on 16/18, with CodeLlama-13B ahead on Go and Java.

Against larger alternatives, StarCoder2-15B matches or exceeds CodeLlama-34B on 10/18 languages. It also matches or exceeds DeepSeekCoder-33B on D, Julia, Lua, and Perl. These results support the claim that the largest StarCoder2 variant has useful breadth beyond the most heavily represented languages.

They do not show uniform multilingual strength. No system wins in every language, and the medium-group leader is again DeepSeekCoder-6.7B. Coverage in the corpus and reliable performance on every covered language remain different properties.

#### Data-science libraries

DS-1000 tests 1,000 Python data-science tasks involving seven widely used libraries. Its purpose in this evaluation is to move beyond standard-library function problems. Library calls introduce interfaces and conventions that basic Python benchmarks do not adequately exercise.

The setup samples 40 completions per task at temperature 0.2 and top-p 0.95. The reported metric is mean pass@1. StarCoder2-3B is strongest overall among the small alternatives, although its performance on PyTorch and TensorFlow is slightly below one comparator.

StarCoder2-7B ranks behind DeepSeekCoder-6.7B but is described as close overall. StarCoder2-15B leads its large-system group and approaches CodeLlama-34B. The practical implication is that the family’s strength is not confined to small self-contained functions, although package-specific differences remain.

#### Bug fixing through a discussion interface

HumanEvalFix tests correction in six programming languages. The evaluated variant supplies tests but no docstrings. This changes the task substantially: the system must infer the problem from the code and testing context rather than simply implement a fresh textual specification.

The authors compare an ordinary instruction prompt with an issue-style prompt. In the latter, buggy code appears within a discussion, followed by the beginning of a response offering corrected code. This resembles material present in StarCoder2’s pretraining collection.

The experiment evaluates StarCoder2-15B using 20 samples at temperature 0.2. An ordinary instruction prompt produces weak results for the base StarCoder systems. The issue-style prompt improves StarCoder2-15B enough to exceed the instruction-tuned CodeLlama alternatives and approach the instruction-tuned DeepSeekCoder alternatives.

The result demonstrates useful behavior without a separate instruction-tuning stage. It also demonstrates interface sensitivity. A system that appears poor under one prompt can perform much better when the task is expressed in a familiar structure.

C++ exposes a specific failure mode. The authors find that one-third of generated responses are incomplete, sometimes stopping immediately after a loop begins. This harms the aggregate result and motivates their interest in later instruction tuning. The underlying ability and the reliability of eliciting a complete answer are not identical.

#### Instruction-driven code editing

CanItEdit evaluates whether a requested modification is correctly applied to existing Python. It includes detailed descriptions and shorter, more informal instructions that should request the same edit. Hidden tests determine whether the resulting code satisfies the intended change.

The authors sample 100 completions per problem at temperature 0.2 and top-p 0.95. StarCoder2 variants use the issue-style format, while comparison systems generally use their instruction-tuned versions. Earlier StarCoderBase results use a commit-oriented prompt.

StarCoder2-3B ranks behind DeepSeekCoder-1.3B in the small group. In the medium group, StarCoder2-7B is strongest for descriptive instructions, while DeepSeekCoder-6.7B leads for shorter instructions. This split shows that instruction form can alter the ranking even within a single benchmark.

StarCoder2-15B leads the large group and exceeds CodeLlama-34B. These results strengthen the case that structured discussion pretraining can support editing behavior. They do not isolate which discussion source or formatting choice supplies the benefit.

#### Mathematics with program execution

The mathematics evaluation uses GSM8K, introduced in [Training Verifiers to Solve Math Word Problems](https://md.research.elamur.ai/free/en/papers/cobbe-2021-training-verifiers-solve-math-word/). The authors adopt PAL: the system generates a Python program, and execution supplies the answer.

This is an important qualification to “math reasoning.” The evaluation measures the combined process of translating a problem into code and executing that code. It does not require every arithmetic step to be completed through text prediction alone.

The setup uses greedy decoding with an 8-shot prompt. A few-shot prompt includes worked examples before the new problem. StarCoder2-3B leads the small group, while StarCoder2-7B is close to DeepSeekCoder-6.7B in the medium group.

StarCoder2-15B exceeds the other large-group alternatives and both extra-large comparisons, CodeLlama-34B and DeepSeekCoder-33B. The result supports a strength in program-aided problem solving under this prompt format. It should not be generalized to every form of mathematical reasoning.

#### Predicting program inputs and outputs

CRUXEval contains 800 examples and separates input prediction from output prediction. In the input task, the system must find an input that produces a specified output. In the output task, it must determine what a function returns for a supplied input.

These tests focus more directly on program behavior than ordinary code generation. The functions are filtered to avoid cases demanding particularly complicated arithmetic or lengthy execution. Strong performance therefore concerns this bounded collection of short programs.

The authors use temperature 0.2 for pass@1 and 0.8 for pass@5, with 10 samples. They also report the benchmark’s uncertainty estimates: sampling noise is around 0.2%, while variation associated with choosing the benchmark examples is about 1.5%.

StarCoder2-3B is competitive on input prediction and leads the small group on output prediction. StarCoder2-7B falls substantially behind DeepSeekCoder-6.7B. StarCoder2-15B leads the large group and improves strongly over StarCoderBase-15B.

The comparison with extra-large systems is nuanced. StarCoder2-15B leads both on input prediction, but the advantage lies within the stated uncertainty. On output prediction, it clearly exceeds CodeLlama-34B and remains slightly below DeepSeekCoder-33B. The detailed results therefore support a more qualified conclusion than a blanket claim of superiority in execution reasoning.

#### Infilling and repository context

The fill-in-the-middle benchmark asks for a missing line within Python, JavaScript, or Java code. The metric is mean exact match over 20 sampled completions, using temperature 0.2 and top-p 0.95. Exact match requires the predicted line to match the reference text, which is stricter in a different way from passing functional tests.

The authors report unexpectedly weak behavior for the largest variant. A training implementation problem reduced its fill-in-the-middle exposure for much of the run. This prevents the result from serving as a clean test of the intended infilling recipe.

Repository evaluation uses RepoBench and CrossCodeEval. RepoBench v1.1 tests next-line prediction with varying context lengths and several cross-file settings. The authors report exact match, edit similarity, and CodeBLEU. StarCoder2 consistently improves over corresponding StarCoderBase variants, and the largest variant is competitive with CodeLlama-34B.

CrossCodeEval requires information from other files and evaluates Python, Java, TypeScript, and C#. Retrieval supplies candidate code context before generation. The reported metrics distinguish similarity of generated code from overlap in identifiers.

StarCoder2-15B leads similarly sized alternatives and performs particularly well in Java and C#, including comparisons with larger systems. Yet language-dependent weaknesses persist, including a weaker relative result in TypeScript. These tests support repository-level usefulness while leaving its precise cause unresolved.

#### Security and harmful language

The security evaluation uses selected tasks from the “Asleep at the Keyboard” benchmark. It covers 18 vulnerability classes, with 23 C scenarios and 17 Python scenarios. Each system produces 25 samples per scenario, yielding 1,000 completions.

The evaluation distinguishes syntactic validity from insecurity among valid outputs. This separation matters because invalid code cannot be interpreted in the same way as a working but vulnerable program. StarCoder2-7B and StarCoder2-15B have high insecure-output rates relative to similarly sized alternatives.

The authors suggest that stronger functional completion may partly explain this pattern: a system that reaches a working implementation also reaches the vulnerable behavior the scenario probes. That is an interpretation, not a reason to discount the vulnerability. Functional improvement does not establish secure coding.

The [bias, fairness, and safety](https://md.research.elamur.ai/free/en/topics/bias-fairness-safety/) evaluations use BOLD, WinoBias, HONEST, and RealToxicityPrompts. These examine different forms of harmful or stereotyped language. The paper describes broadly similar harmful-content levels across the compared code-focused systems.

Those findings concern the chosen prompts, classifiers, and scoring procedures. They do not certify downstream deployments, especially where security, privacy, or user-specific harms depend on a larger application.

### What the ablations show

#### Useful comparisons, but no complete causal breakdown

The paper contains preliminary architectural comparisons, prompt comparisons, cross-task analyses, and disclosed implementation problems. It does not provide a comprehensive experiment that independently switches every major data and training choice on and off.

That distinction limits causal interpretation. StarCoder2 differs from its predecessor in corpus size, source composition, context organization, architecture, training duration, and formatting. Improved benchmark scores show that the combined recipe is effective. They do not assign a separate contribution to each ingredient.

#### Rotary positions and vocabulary size

The authors report that replacing learned positional embeddings with rotary encodings produced a substantial improvement in preliminary testing. This is the clearest stated architectural selection result. It supports their choice, although the account does not supply a detailed score breakdown for that comparison.

The vocabulary experiment points in the other direction. The authors retained a vocabulary of 49,152 entries because expanding it to 100K yielded no performance gain. The lesson is specific: a larger vocabulary was not useful under the tested conditions.

It would be unwarranted to infer that larger vocabularies never help code generation. Tokenizer training data, architecture, and compute allocation can all affect such a comparison. The paper establishes the selection made for StarCoder2, not a universal vocabulary rule.

#### Discussion prompts expose latent editing ability

The ordinary-instruction versus issue-style comparison directly changes the interface to an already trained system. It therefore supplies clearer evidence about elicitation than the cross-generation benchmark comparisons supply about training causes.

The issue format substantially improves bug fixing for StarCoder2-15B. This is consistent with the hypothesis that structured discussions in pretraining teach patterns useful for correction. However, changing the prompt does not identify whether issues, pull requests, StackOverflow answers, or their combination contributed most.

The comparison with commit-style prompting for StarCoderBase suggests another possible route to editing behavior. Discussion and review material can offer an alternative to commit-oriented training examples. The paper supports the viability of that route without establishing that one source is intrinsically best.

#### Repository gains have several possible explanations

RepoBench and CrossCodeEval favor the newer family over corresponding StarCoderBase variants. Repository grouping is a plausible contributor because it places related files together during training. Longer contexts and the expanded corpus are also plausible contributors.

The authors themselves frame some explanations cautiously. A fair reading preserves that caution: repository-aware training is part of a successful design, but the evaluation does not isolate its effect from all other changes.

The random ordering of files is also relevant. The training procedure does not depend on a sophisticated ordering algorithm that reconstructs execution or dependency structure. It preserves shared repository membership while accepting a simple ordering choice.

#### The middle size and the largest infilling result

StarCoder2-7B’s relative weakness is an unresolved observation. It uses a different mixture from StarCoder2-3B and differs in capacity and training from both neighboring sizes. Without controlled reruns, the pattern cannot reliably be assigned to a particular source or architectural decision.

The largest variant’s infilling weakness has a more concrete associated problem: the intended transformation rate was not maintained through much of training. This disclosure narrows interpretation of the result. It does not quantify how well the same system would have performed under a corrected run.

Together, these cases show why benchmark irregularities deserve investigation. A family-level trend can coexist with a weaker size or task, and an implementation error can disrupt an otherwise reasonable training design.

### Limitations

#### Limits explicitly acknowledged by the authors

The authors state that the reason for StarCoder2-7B’s weaker relative performance is unclear. This leaves an important gap in understanding the family. The results do not support a simple claim that increasing size under this recipe always yields equally strong standing against competitors.

They disclose training problems affecting StarCoder2-15B. A configuration-parsing issue changed rotary-position settings, and an implementation issue reduced infilling exposure. The largest base run also ended before its planned training schedule was complete. These details qualify conclusions about the intended configuration.

The security findings are unfavorable enough to matter in practice. Strong functional results coexist with a high rate of vulnerable completions in the selected benchmark. The authors also recognize that removing malware from training cannot prevent malicious use or ensure secure generated code.

Privacy redaction is likewise incomplete as a guarantee. The authors recommend additional downstream checking for personal information and privacy-relevant behavior. Detecting names or credentials in training text is different from verifying how generated software collects, processes, or transmits personal data.

Representation remains uneven. Popular programming languages contribute far more material than less common ones, and English predominates in natural-language content. The authors acknowledge that this can affect both capability and fairness across languages and coding environments.

Traceability also requires usable tooling. Publishing Software Heritage identifiers makes artifacts identifiable, but the authors recognize that following those identifiers through a downstream development process can be difficult. An available identifier is a foundation for investigation, not an automatic explanation.

#### Limits visible in the experimental design

A careful reader should distinguish broad evaluation from causal isolation. The paper tests many behaviors, but most comparisons concern complete systems with multiple differences. It therefore establishes performance more convincingly than it establishes why each improvement occurred.

Data breadth changes with system size. StarCoder2-15B receives many more programming languages than the smaller variants, while the natural-language mixtures also differ. Cross-size comparisons consequently combine capacity and data-distribution effects.

Decontamination has explicit scope boundaries. Selected benchmark strings are removed from several sources, but documentation, LHQ, arXiv, and Wikipedia do not undergo that step. Ignoring whitespace improves matching recall, yet literal matching cannot on its own establish the absence of translated or substantially rewritten task material.

Benchmark coverage is necessarily partial. HumanEval-style tasks are short and self-contained. DS-1000 expands library coverage, while repository benchmarks add cross-file dependencies, but none of these establishes reliability across an entire software-development project.

Editing comparisons also mix base and instruction-tuned systems. This is useful for practical assessment, especially because ordinary base-system prompting performs poorly. It is less suitable for isolating the effect of pretraining when competitors have undergone additional adaptation.

Repository metrics require interpretation. Exact match can reject a valid alternative line, while edit similarity and identifier overlap measure resemblance rather than complete program behavior. Their combination provides more information than any single measure, but it does not replace integration testing.

The mathematical result depends on program execution through PAL. It demonstrates successful problem-to-program behavior under an 8-shot prompt. It does not establish equivalent performance in unaided textual calculation or in every mathematical domain.

#### Transparency has boundaries of its own

A membership check can show that a sufficiently long passage occurs in training material. It cannot establish that this passage caused a particular generated answer. Conversely, the lack of an exact match does not rule out related material or transformed versions.

The Data Portrait uses about 70GB and supports exact matching for long strings. More flexible investigation requires the full search index. These facilities serve different questions, and neither should be treated as a complete attribution system.

The license policy also deserves precise wording. The corpus includes material without an identified license as well as permissively licensed material. Filtering and disclosure make this choice inspectable, but they do not turn all retained content into the same licensing category.

The BigCode Open RAIL-M license contains use restrictions. Accessible weights therefore should not be conflated with an absence of conditions. The paper treats release governance as part of responsible access.

Finally, the environmental accounting is incomplete for the family. The authors estimate total emissions of 16,107.01 kgCO₂eq for StarCoder2-3B and 29,622.83 kgCO₂eq for StarCoder2-7B, including long-context continuation. The report does not yet give the corresponding estimate for StarCoder2-15B. These estimates also depend on the stated hardware and carbon-efficiency assumptions.

### What came after

The later citation record places StarCoder2 within several continuing research directions: code-specialized pretraining, training-data design, evaluation, efficient adaptation, and systems that act on software. A citation establishes a scholarly connection, but it does not by itself show that a later project reused The Stack v2, adopted repository formatting, or reproduced the training recipe. The relationships below distinguish the later works’ stated subjects from specific reuse that is not established.

#### Continuing code-specialized development

[DeepSeek-Coder-V2](https://md.research.elamur.ai/free/en/papers/deepseek-ai-2024-deepseek-coder-v2-breaking-barrier/) continues work on code intelligence. Its citation places StarCoder2 among the relevant preceding systems. This is a natural continuation of the competitive setting in which StarCoder2 compared size groups, programming languages, and different coding capabilities. The citation alone does not establish which StarCoder2 design decisions it adopted.

[Qwen2.5-Coder](https://md.research.elamur.ai/free/en/papers/hui-2024-qwen2-5-coder-technical-report/) is another subsequent code-focused technical report. Its connection illustrates that StarCoder2 became part of the reference landscape for later code-specialized development. A stronger claim about shared data, architectural influence, or direct methodological inheritance would require details beyond the citation relationship.

[CodeGemma](https://md.research.elamur.ai/free/en/papers/zhao-2024-codegemma-open-code-models-based/) and [Granite Code](https://md.research.elamur.ai/free/en/papers/mishra-2024-granite-code-models-family-open/) likewise concern openly accessible code-oriented foundations. Their inclusion among later citing works reflects the continuing relevance of the questions StarCoder2 made concrete: what capability is achieved, what is disclosed, and how the system is evaluated. It does not establish that their meanings of openness or their release conditions are identical.

[OpenCoder](https://md.research.elamur.ai/free/en/papers/huang-2025-opencoder-open-cookbook-top-tier/) makes the training recipe a prominent part of its stated subject. That emphasis is closely related to the reusable value of StarCoder2’s report: the corpus and development procedure are research objects alongside the resulting system. The specific details of OpenCoder’s reuse are not established by its title and citation alone.

#### Evaluation becomes a broader research object

[LiveCodeBench](https://md.research.elamur.ai/free/en/papers/jain-2024-livecodebench-holistic-contamination-free-evaluation/) focuses on holistic code evaluation and contamination concerns. This continues a problem that StarCoder2 addresses through training-data decontamination and repository benchmarks. The connection is especially relevant because increasingly capable systems make narrow or exposed tests less informative. No later benchmark scores are needed to recognize the continuity of the measurement problem.

[BigCodeBench](https://md.research.elamur.ai/free/en/papers/zhuo-2024-bigcodebench-benchmarking-code-generation-diverse/) emphasizes varied function calls and complex instructions. Its subject aligns with the gap StarCoder2 identifies between simple Python tasks and broader coding demands. StarCoder2 already uses DS-1000 and editing benchmarks to move beyond basic function completion; the later work’s stated scope keeps that broader evaluation question active.

[SciCode](https://md.research.elamur.ai/free/en/papers/tian-2024-scicode-research-coding-benchmark/) concerns research coding and scientist-curated evaluation. It represents another application setting in which general coding scores may be insufficient. The citation connection does not show a specific borrowed mechanism, but it places StarCoder2 within the background for evaluating code generation in more specialized work.

These later evaluation projects are best understood as evidence that measuring coding ability remained an active problem. They should not be used retrospectively to claim that StarCoder2 succeeded or failed on tests the paper did not run.

#### Training data and compact systems

[DataComp-LM](https://md.research.elamur.ai/free/en/papers/li-2024-datacomp-lm-search-next-generation/) centers the search for better training sets. This is directly adjacent to The Stack v2’s contribution: collection, filtering, deduplication, and mixture design are treated as consequential research choices. The citation identifies StarCoder2 as relevant prior work without establishing that DataComp-LM reproduces its pipeline.

[SmolLM2](https://md.research.elamur.ai/free/en/papers/allal-2025-smollm2-smol-goes-big-data/) concerns data-centered training for a small language system. Its stated focus makes it relevant to StarCoder2’s decision to train relatively compact variants extensively and tailor their mixtures. It would be too strong to infer that the same capacity-diversity hypothesis was confirmed simply because both works discuss small systems and data.

The later study of [scaling under over-training](https://md.research.elamur.ai/free/en/papers/gadre-2024-language-models-scale-reliably-over/) addresses another question raised by StarCoder2’s allocation of many training tokens to comparatively small parameter counts. Its subject connects to the tradeoff between training expense and the usefulness of the resulting system. The exact empirical relationship it establishes cannot be inferred from its citation alone.

[Fishing for Magikarp](https://md.research.elamur.ai/free/en/papers/land-2024-fishing-magikarp-automatically-detecting-under/) studies under-trained tokens. That topic connects to the importance of tokenizer and training-distribution choices, which StarCoder2 reports explicitly. The later work’s citation should not be interpreted as evidence that StarCoder2’s tokenizer has a particular defect.

#### Adaptation, execution, and software action

[LlamaFactory](https://md.research.elamur.ai/free/en/papers/zheng-2024-llamafactory-unified-efficient-fine-tuning/) addresses efficient fine-tuning across many language systems. This is relevant to StarCoder2 as a released base family that can support subsequent adaptation. The citation relationship does not establish which StarCoder2 variants were used in a particular experiment.

[OpenCodeInterpreter](https://md.research.elamur.ai/free/en/papers/zheng-2024-opencodeinterpreter-integrating-code-generation-execution/) explicitly connects generation with execution and refinement. That direction is related to StarCoder2’s separation of code production, execution reasoning, and correction. It also points beyond a single completion: generated code can become part of a process that observes results and revises its output.

[OpenHands](https://md.research.elamur.ai/free/en/papers/wang-2024-openhands-open-platform-ai/) concerns a platform for software-development agents. This moves the unit of interest from a generated function toward action within a development environment. StarCoder2’s repository and editing evaluations are relevant background, but they do not establish autonomous performance in such a platform.

[SelfCodeAlign](https://md.research.elamur.ai/free/en/papers/wei-2024-selfcodealign-self-alignment-code-generation/) concerns self-alignment for code generation, while [SWE-RL](https://md.research.elamur.ai/free/en/papers/wei-2025-swe-rl-advancing-llm-reasoning/) concerns reinforcement learning using software evolution. Both belong to the later landscape of improving behavior beyond ordinary pretraining. StarCoder2 explicitly leaves instruction adaptation and preference-oriented improvement for future work, making this a meaningful research connection without proving a particular implementation lineage.

The lasting lesson across these directions is that a strong base system is only part of the research object. Data provenance affects inspection; formatting affects what behavior can be elicited; evaluation determines which claims are justified; and later adaptation changes how capability is used. StarCoder2 contributes a concrete, inspectable foundation for studying those relationships, while its unresolved results show why the relationships still require careful experiments.

## Cite

Cite as Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, Tianyang Liu, Max Tian, Denis Kocetkov, Arthur Zucker, Younes Belkada, Zijian Wang, Qian Liu, Dmitry Abulkhanov, Indraneil Paul, Zhuang Li, Wen-Ding Li, Megan Risdal, Jia Li, Jian Zhu, Terry Yue Zhuo, Evgenii Zheltonozhskii, Nii Osae Osae Dade, Wenhao Yu, Lucas Krauß, Naman Jain, Yixuan Su, Xuanli He, Manan Dey, Edoardo Abati, Yekun Chai, Niklas Muennighoff, Xiangru Tang, Muhtasham Oblokulov, Christopher Akiki, Marc Marone, Chenghao Mou, Mayank Mishra, Alex Gu, Binyuan Hui, Tri Dao, Armel Zebaze, Olivier Dehaene, Nicolas Patry, Canwen Xu, Julian McAuley, Han Hu, Torsten Scholak, Sebastien Paquet, Jennifer Robinson, Carolyn Jane Anderson, Nicolas Chapados, Mostofa Patwary, Nima Tajbakhsh, Yacine Jernite, Carlos Muñoz Ferrandis, Lingming Zhang, Sean Hughes, Thomas Wolf, Arjun Guha, Leandro von Werra and Harm de Vries. 2024. StarCoder 2 and The Stack v2: The Next Generation. arXiv:2402.19173.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2402.19173](https://doi.org/10.48550/arxiv.2402.19173) · [arXiv 2402.19173](https://arxiv.org/abs/2402.19173)

```bibtex
@misc{lozhkov2024starcoder,
  title = {{StarCoder 2 and The Stack v2: The Next Generation}},
  author = {Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, Tianyang Liu, Max Tian, Denis Kocetkov, Arthur Zucker, Younes Belkada, Zijian Wang, Qian Liu, Dmitry Abulkhanov, Indraneil Paul, Zhuang Li, Wen-Ding Li, Megan Risdal, Jia Li, Jian Zhu, Terry Yue Zhuo, Evgenii Zheltonozhskii, Nii Osae Osae Dade, Wenhao Yu, Lucas Krauß, Naman Jain, Yixuan Su, Xuanli He, Manan Dey, Edoardo Abati, Yekun Chai, Niklas Muennighoff, Xiangru Tang, Muhtasham Oblokulov, Christopher Akiki, Marc Marone, Chenghao Mou, Mayank Mishra, Alex Gu, Binyuan Hui, Tri Dao, Armel Zebaze, Olivier Dehaene, Nicolas Patry, Canwen Xu, Julian McAuley, Han Hu, Torsten Scholak, Sebastien Paquet, Jennifer Robinson, Carolyn Jane Anderson, Nicolas Chapados, Mostofa Patwary, Nima Tajbakhsh, Yacine Jernite, Carlos Muñoz Ferrandis, Lingming Zhang, Sean Hughes, Thomas Wolf, Arjun Guha, Leandro {von Werra} and Harm {de Vries}},
  year = {2024},
  doi = {10.48550/arxiv.2402.19173},
  eprint = {2402.19173},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2402.19173}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
