StarCoder2: The Open Coding Model Trained on 600+ Programming Languages

Updated
7 min read
StarCoder2: The Open Coding Model Trained on 600+ Programming Languages
TL;DR

BigCode's StarCoder2-15B is trained on The Stack v2 covering 619 programming languages, bringing fill-in-the-middle completion and strong HumanEval scores to a model you can run without a vendor contract.

What Is StarCoder2?

StarCoder2 is the second generation of the BigCode project's open coding models, released in February 2024. The project is a collaboration between Hugging Face, ServiceNow, and the broader open-source research community. The flagship 15B model is trained on The Stack v2 - a cleaned and deduplicated dataset of source code across 619 programming languages.

Model Variants

BigCode released three sizes:

  • StarCoder2-3B - fits on a single consumer GPU (12GB VRAM), good for autocomplete
  • StarCoder2-7B - balanced size for most IDE integration use cases
  • StarCoder2-15B - best quality, recommended for generation tasks

All three are released under the BigCode Open RAIL-M license, which allows commercial use with attribution.

HumanEval and Benchmark Comparisons

Click any column to sort
4 rows
StarCoder2-15B46.3% (base), ~72% instruct15B
CodeLlama 34B53.7%34B
StarCoder (v1) 15B33.6%15B
Qwen2.5-Coder 7B88.4%7B

The instruct-tuned version (StarCoder2-15B-Instruct-v0.1) reaches competitive scores on instruction following, though newer models like Qwen2.5-Coder have surpassed it on raw HumanEval. StarCoder2 remains relevant for its breadth of language coverage and fill-in-the-middle support.

Fill-in-the-Middle Training

StarCoder2 is trained with the FIM (fill-in-the-middle) objective, using a special set of tokens that makes code completion feel natural:

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoder2-15b")
model = AutoModelForCausalLM.from_pretrained(
    "bigcode/starcoder2-15b",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

prefix = "def is_palindrome(s: str) -> bool:\n    "
suffix = "\n\nassert is_palindrome('racecar') == True"

fim_prompt = f"<fim_prefix>{prefix}<fim_suffix>{suffix}<fim_middle>"

inputs = tokenizer(fim_prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=64, temperature=0.2)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

VS Code Integration via Continue

The easiest way to use StarCoder2-15B for day-to-day coding is through the Continue extension:

  1. Install Continue from the VS Code marketplace
  2. In ~/.continue/config.json, add:
json
{
  "tabAutocompleteModel": {
    "title": "StarCoder2",
    "provider": "ollama",
    "model": "starcoder2:15b"
  }
}
  1. Run ollama pull starcoder2:15b

You now have local, private tab completion that never sends your code to a third-party server.

Hugging Face Code Leaderboard

The Big Code Models Leaderboard tracks models on HumanEval, MBPP, MultiPL-E, and DS-1000. As of early 2025, StarCoder2-15B sits in the top 10 for models under 20B parameters, though the Qwen2.5-Coder family has moved above it in absolute scores.

When to Choose StarCoder2

  • You need maximum language breadth (619 languages vs ~100 for most models)
  • You want IDE tab completion with FIM and full local privacy
  • You need a model in the 7 - 15B range that balances quality and hardware requirements
  • You want to build on top of a permissively licensed, academically documented model
#starcoder2#coding#bigcode#open-source#fill-in-middle

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns, delivered to your inbox.

What should we test or explain next?

Comments

Have a question or something to add? Sign in to join the discussion.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Software architect, full-stack engineer, and machine learning practitioner. Founder & CEO of Pristren, CTO at Venture Kick-backed PIN Sport Application GmbH (Basel, Switzerland), Software Development Lead at DailyFrame GmbH (building Dimetra patient transport software), and creator of Zlyqor. Focused on custom workflow automation, scalable web and mobile applications, and production AI/ML systems.