Coding
Open-weight
BigCode OpenRAIL-M

StarCoder

by BigCode (HuggingFace + ServiceNow)

The BigCode community's open-weight code family. StarCoder 2 + earlier StarCoder. Permissive license + transparent training data — the 'reproducible code model' canonical pick.

Architecture evolution

BigCode's StarCoder family is the leading open-weight code generation model series, spanning two generations built on the SantaCoder→StarCoder→[StarCoder2](/families/starcoder) lineage. StarCoder 1 (May 2023, 15.5B parameters) was trained on The Stack v1, a 6.4 TB dataset of permissively licensed code from GitHub spanning 358 programming languages with near-deduplication and PII redaction. The architecture is a standard decoder-only Transformer with two distinguishing features: Multi-Query Attention (MQA) for 2× faster inference vs Multi-Head Attention at equivalent quality, and Fill-In-the-Middle (FIM) training — the model is trained to infill masked spans in source code, enabling code completion, refactoring, and bug-patching without full-file regeneration. StarCoder's 8K context window (limited by the GPT-2-based position encoding) was the primary architectural constraint in v1. The 8K limit (~2,000 lines of code) was sufficient for single-file operations but inadequate for repository-scale reasoning (cross-file references, project-wide refactoring). StarCoder 2 (February 2024) addressed this across three model sizes: 3B (trained on 3.3T tokens), 7B (3.7T tokens), and 15B (4.1T tokens), all with RoPE position encoding and 16K context windows — 2× the v1 context, sufficient for multi-file repository understanding. The Stack v2 dataset upgrade (from v1 to v2) improved code quality filtering, added issue-tracker and pull-request metadata for instruction tuning, and expanded the language mix to 619 programming languages. StarCoder2-15B was trained on The Stack v2 with Grouped-Query Attention (GQA) replacing MQA — GQA provides 8 query groups, a middle ground between MQA's speed and Multi-Head Attention's quality. The FIM training rate was increased from 50% to 90% of training tokens (vs 50% in v1), making StarCoder2 more capable at infilling tasks — the primary operational use case for code models in IDE copilots. StarCoder2-Instruct variants (3B, 7B, 15B) are supervised fine-tuned on the CommitPackFT+OASST dataset — 4B tokens of code instructions, commit messages, and issue resolutions. The Instruct variants add instruction-following capability (for code-generation-from-prompt) to the base models' FIM-focused pretraining. The architectural future points to StarCoder3 with [DeepSeek](/families/deepseek)MoE-style routing for efficient scaling beyond 15B, 128K context, and repository-level code understanding with file-relationship encoding.

Local viability

Which versions actually run locally, on what hardware.

StarCoder variants span a wide hardware compatibility range. StarCoder2-3B at FP16 (~6 GB) fits in 8 GB VRAM and generates at 40–60 tok/s on an [RTX 3060 12GB](/hardware/rtx-3060-12gb) — the accessible entry point for local code AI. At Q4_K_M (~3 GB), StarCoder2-3B fits in 4 GB VRAM and runs on integrated GPUs — functional for single-function code completion on any modern laptop. StarCoder2-7B at FP16 (~14 GB) requires 16 GB VRAM for full GPU offload. On an [RTX 4060 Ti 16GB](/hardware/rtx-4060-ti-16gb), it generates at 30–45 tok/s — sufficient for interactive IDE code completion. At Q4_K_M (~7 GB), it fits in 8 GB VRAM at 20–30 tok/s. The 7B model represents the VRAM-quality sweet spot for local code generation: enough parameters to handle multi-file reasoning and API usage, fast enough for real-time completions. StarCoder2-15B at FP16 (~30 GB) is the quality leader but requires 24 GB+ VRAM. An [RTX 4090](/hardware/rtx-4090) runs it at Q4_K_M (~15 GB) at 20–30 tok/s with full GPU offload. At FP16 on a dual [RTX 3090](/hardware/rtx-3090) (48 GB pool), it generates at 25–35 tok/s. The [Apple M3 Ultra](/hardware/apple-m3-ultra) with 192 GB unified memory runs StarCoder2-15B at FP16 at 25–40 tok/s — a viable local code-model workstation. StarCoder1-15B has similar VRAM requirements with ~10–15% faster inference (MQA vs GQA) but lower code quality. The practical deployment pattern for local code AI: StarCoder2-7B Q4 for interactive completions (low-latency, always-on in IDE), StarCoder2-15B Q5 for batch code generation and refactoring (higher-latency, higher-quality, triggered manually). The 3B model is viable for on-device mobile code completion (smartphone IDEs, tablet coding) where 15B and 7B are not deployable. The StarCoder family's license (BigCode Open RAIL-M v1.0) permits commercial use with attribution and responsible-use restrictions — less permissive than MIT/Apache 2.0 but more permissive than [Llama's](/families/llama) community license for most commercial deployments. The license's responsible-use clause (prohibiting generation of malicious code) is operationally relevant for code models but difficult to enforce technically — it functions as a legal backstop rather than a technical safeguard.
Hardware buying guidance for StarCoder

StarCoder coding models trade quality for speed across 1B to 15B variants — your VRAM ceiling decides which version actually helps you ship code.

Benchmark history

StarCoder entered the code model benchmark landscape in mid-2023 competitive with but trailing the closed-source leaders. On HumanEval (Python function generation from docstrings), StarCoder1-15B scored 33.6% pass@1 vs Codex's 33.5% (tied) and GPT-3.5's 48.1% (trailing by 14.5 points). On the expanded HumanEval+ (more test cases per problem), StarCoder1-15B scored 29.8% vs GPT-3.5's 40.2% — the gap widened on rigorous testing, suggesting StarCoder1's solutions were more brittle under edge-case testing. [StarCoder2](/families/starcoder) improved HumanEval benchmarks significantly. StarCoder2-15B scored 46.3% pass@1 on HumanEval (matching GPT-3.5's 48.1% within error margins) and 39.1% on HumanEval+. The 3B and 7B variants scored 31.4% and 39.8% on HumanEval respectively — the 7B model outperformed StarCoder1-15B despite having half the parameters, demonstrating The Stack v2's data-quality improvement over v1. On the more comprehensive MultiPL-E benchmark (HumanEval translated to 19 programming languages), StarCoder2-15B averaged 38.2% pass@1 across all languages vs CodeLlama-34B's 37.1% — competitive leadership at 2.3× smaller parameter count. StarCoder2 was strongest in Python (46.3%), JavaScript (41.2%), and TypeScript (39.7%), and weakest in R (28.1%) and Lua (25.4%) — the language performance distribution matches The Stack v2's language token distribution closely. On the RepoBench benchmark (repository-level code understanding, cross-file references), StarCoder2-15B scored 31.5% vs the best closed model's 42.3% at the time (GPT-4). This is an inherent training-data limitation — The Stack contains individual files, not repositories-as-units. StarCoder3 with repository-structure-aware training is expected to address this gap. On the CodeContests benchmark (competitive programming), StarCoder2-15B scored 8.7% pass@1 vs [DeepSeek-Coder-V3's](/families/[deepseek](/families/deepseek)) 17.2% — a 2× gap. Competitive programming is the hardest code-generation subdomain, requiring deep algorithmic reasoning that current StarCoder-generation models haven't achieved. This is not a deployment-relevant benchmark for most code-AI use cases (API wiring, boilerplate generation, unit test generation) but illustrates the reasoning ceiling.

Runtime support

StarCoder runtime support is broad through the Hugging Face [Transformers](/tools/transformers) ecosystem. The `AutoModelForCausalLM` pipeline loads any StarCoder variant for text/code generation with native FIM support via the `` token for infill-span marking. The Transformers implementation supports FP16, BF16, and 8-bit quantization via bitsandbytes — sufficient for 90% of local deployment needs. For optimized GPU inference, StarCoder is supported in [vLLM](/tools/vllm), [Ollama](/tools/ollama), [llama.cpp](/tools/llama-cpp), [SGLang](/tools/sglang), and [TensorRT-LLM](/tools/tensorrt-llm) — essentially every major LLM inference engine. vLLM provides continuous batching for production serving (useful for CI/CD code-review bots processing multiple pull requests). Ollama one-liner: `ollama run starcoder2:15b` pulls and serves StarCoder2-15B at Q4_K_M with an OpenAI-compatible API — the easiest local code model deployment path. The FIM (Fill-In-the-Middle) inference mode is a key runtime consideration. Standard text generation runtimes support FIM through the `<fim_prefix>`, `<fim_suffix>`, `<fim_middle>` special tokens. [vLLM's](/tools/vllm) FIM support requires configuring the tokenizer's FIM tokens and is less polished than standard text generation — some community-maintained vLLM forks include FIM-specific optimizations. [llama.cpp](/tools/llama-cpp) provides native FIM support via the `--infill` flag, with GPU offload for the FIM context — the most reliable FIM runtime for local deployment. For IDE integration, StarCoder serves through the [Continue](https://continue.dev) extension (VS Code/JetBrains), which supports any OpenAI-compatible API. Deploy StarCoder via [Ollama](/tools/ollama) or [vLLM](/tools/vllm) with the /v1/completions endpoint, point Continue at localhost:11434 (Ollama) or localhost:8000 (vLLM), and StarCoder becomes the IDE code completion engine. This is the most common local StarCoder deployment: Ollama + Continue + StarCoder2-7B Q4 on a developer's workstation — a completely local, offline-capable code AI. The [llama.cpp](/tools/llama-cpp) GGUF ecosystem provides the broadest platform coverage: StarCoder2 GGUF runs on Windows (CUDA/Vulkan), macOS (Metal), Linux (CUDA/ROCm/Vulkan), Android (via llama.cpp's Android NDK), and iOS (via LLMFarm). This cross-platform runtime support makes StarCoder the most portable code model family — deployable on any device with 4+ GB of available RAM.

Quantization support

StarCoder quantization follows the decoder-only Transformer quantization pattern with code-specific sensitivity characteristics. Q8_0 achieves near-FP16 quality (<0.5% HumanEval pass@1 degradation) for all StarCoder sizes. Q5_K_M is the practical sweet spot: <2% HumanEval degradation, 2.5–3× memory reduction vs FP16. Q4_K_M introduces 3–5% HumanEval degradation — acceptable for code completion (where the user validates output) but risky for autonomous code generation. Q2_K and Q3_K variants degrade synthetic code quality noticeably (10–15% HumanEval drop) and should be avoided for production code generation. StarCoder's quantization sensitivity varies by code task type. Code completion (single-line or few-line completions) is quantization-resilient — Q4_K_M produces nearly indistinguishable completions from FP16 for short spans because the model's local syntactic knowledge is well-distributed across parameters. The operational guideline: Q5 for full-function generation, Q4 for completion, FP16 for mission-critical autonomous code generation. StarCoder2's GQA (Grouped-Query Attention) in the 15B model makes quantization of the attention key/value projections slightly more sensitive than StarCoder1's MQA. With GQA, there are 8 key/value head groups (vs MQA's single shared group), and quantizing these projections below Q5 can introduce attention pattern distortions where the model attends to syntactically incorrect tokens. This manifests as syntax errors that a non-quantized model would avoid — the most visible quantization artifact for code models. Recommendation: quantize attention KV projections at Q8 or higher, reserving aggressive quantization for the feedforward layers (which are ~80% of parameters and ~30% less quantization-sensitive for code tasks). Whisper GGUF quantization quality is benchmarked at each level in the community-maintained [StarCoder2 GGUF quality comparison](https://github.com/ggerganov/llama.cpp/discussions) — Q4_K_M achieves 43.1% HumanEval pass@1 vs FP16 46.3% for 15B. Q5_K_M achieves 45.0%, within 1.3 points of FP16. The diminishing returns from Q5→Q8 (45.0%→45.8%) are small enough that Q5_K_M is the recommended production quantization for local deployment. This Q5-mantra (Q5_K_M for all StarCoder variants) is the community consensus for local code AI — it's the VRAM-quality Pareto optimal point.

Ecosystem maturity

StarCoder's ecosystem is code-AI focused and narrower than general-purpose LLM ecosystems, but deep within its domain. The BigCode project (governed by Hugging Face and ServiceNow Research) provides: the Stack dataset (v1 and v2, publicly accessible on Hugging Face), the StarCoder models (base and instruct, all sizes), training infrastructure (the Megatron-LM-based training code), and evaluation harnesses (BigCode-Eval-Harness with MultiPL-E support). This full-stack openness (data, model, training code, evaluation) is unique among major code models — [DeepSeek-Coder](/families/[deepseek](/families/deepseek)) releases weights but not training data. The StarCoder fine-tune ecosystem is modest but focused. The Hugging Face StarCoder model hub hosts ~2,000 community fine-tunes — a fraction of general-purpose LLM fine-tune counts but higher average quality due to the specialized code-domain audience. Popular fine-tune categories: language-specific ([StarCoder2](/families/starcoder)-Python, StarCoder2-Typescript, StarCoder2-Rust), framework-specific (StarCoder2-React, StarCoder2-Django, StarCoder2-SpringBoot), and task-specific (StarCoder2-UnitTest, StarCoder2-Docstring, StarCoder2-Refactor). The WizardCoder fine-tune series (evol-instruct applied to StarCoder) is the most prominent community derivative, achieving 57.3% HumanEval pass@1 — a 11-point jump over base StarCoder2-15B. The IDE integration ecosystem is the primary deployment surface: [Continue](https://continue.dev) (VS Code/JetBrains), Tabby (self-hosted code completion server), Cody (Sourcegraph's code AI, uses StarCoder in its local mode), and Cursor (supports custom OpenAI-compatible API endpoint for StarCoder). The Continue+Ollama+StarCoder2 stack has become the standard local code AI configuration — installation takes ~10 minutes and results in a fully offline IDE copilot. The code evaluation and benchmarking ecosystem (BigCode-Eval-Harness, MultiPL-E, HumanEval+) is well-developed, enabling thorough quality validation before deployment. The BigCode project's governance model (an open research collaboration with public decision-making via RFCs) provides ecosystem stability that single-vendor projects lack — StarCoder's future isn't tied to a single company's strategic whims. This governance quality is underappreciated in the code-model space where vendor-driven projects (Codex, Code Llama, DeepSeek-Coder) dominate mindshare but present single-point-of-failure risk for long-term deployments.

Finetune ecosystem

StarCoder fine-tuning leverages the standard Hugging Face causal-LM training pipeline with code-specific dataset preparation. Fine-tuning [StarCoder2](/families/starcoder)-7B on a domain-specific codebase (e.g., your company's internal libraries, APIs, and coding conventions) requires 16–24 GB VRAM for full fine-tuning or 8–12 GB for LoRA (rank-16). Training time on an [RTX 4090](/hardware/rtx-4090): 4–8 hours for 100K code samples via LoRA, 12–24 hours for full fine-tuning. The LoRA approach is recommended for most use cases — it preserves base StarCoder's broad coding knowledge while adapting to domain-specific patterns. The data preparation pipeline for code fine-tuning is more structured than for natural language. The code-specific data quality issues are: auto-generated code (ORM scaffolding, protobuf stubs) that teaches the model to generate boilerplate, copy-pasted Stack Overflow code that introduces license contamination risk, and outdated API usage that teaches the model deprecated patterns. FIM-specific fine-tuning (training the model to infill masked code spans) requires constructing training samples with `<fim_prefix>` and `<fim_suffix>` token placement. The FIM training data is generated by: (1) taking a code file, (2) randomly selecting a contiguous span (function body, block, expression), (3) placing the span as the target completion and the surrounding code as prefix+suffix context. FIM fine-tuning is most valuable for IDE code-completion use cases — it's the key differentiator between a model that generates new code and a model that completes partial code. The StarCoder fine-tuning community is engineer-heavy rather than researcher-heavy — GitHub repositories with practical fine-tuning scripts, training configurations, and deployment guides outnumber arXiv papers. The BigCode project's official fine-tuning repository provides LoRA and full fine-tuning scripts with recommended hyperparameters for each StarCoder size — the most reliable starting point for production adaptation. The community's fine-tuning quality is generally high because code-domain fine-tuning is inherently more testable than natural-language fine-tuning — you can run the fine-tuned model's output through a compiler/linter to objectively measure quality.

Deployment caveats

StarCoder's FIM inference mode requires careful prompt formatting that differs across inference engines. The FIM token sequence (`<fim_prefix>...<fim_suffix>...<fim_middle>`) must be correctly placed, with the `<fim_middle>` token signaling the model to begin infill generation. Each inference engine ([vLLM](/tools/vllm), [Ollama](/tools/ollama), [Transformers](/tools/transformers)) handles FIM tokenization slightly differently — validate FIM output on your specific engine before production deployment. The most common FIM failure mode: the model generates code beyond the suffix boundary (extending the infill into the suffix region), which requires post-generation truncation at the `<|endoftext|>` or EOS token. Code output security is the primary operational risk for code AI deployment. A code-generation pipeline without output validation will introduce these vulnerabilities into production codebases. Mitigation: integrate static analysis (Semgrep, CodeQL, SonarQube) as a post-generation filter that blocks or flags generated code with known vulnerability patterns. The static analysis pass adds ~2–5 seconds per generation — acceptable for batch code generation, less viable for real-time completions where latency must be <200ms. License contamination risk from training data is an unresolved operational concern. The Stack v2 dataset was filtered for permissive licenses, but license detection accuracy on code is imperfect (code files often have missing, incorrect, or ambiguous license headers). Generated code that closely matches training data could theoretically inherit the training data's license terms — a practical risk that is legally untested as of 2026. StarCoder2's 16K context window is generous for single-file operations but insufficient for repository-scale operations on large codebases (monorepos with 100K+ line files, projects with deep dependency chains across 50+ files). For cross-file reasoning, operators must implement a retrieval layer: embed the codebase via [BGE](/families/bge) embeddings, retrieve relevant files for a given prompt, and inject them into StarCoder's context. This RAG-for-code pattern adds ~200ms of latency (embedding search + context assembly) and is essential for repository-scale code AI — raw StarCoder with a code file open can only reason about that file and its imports, not the broader project architecture.

Best entry point for local use

Start with StarCoder2 15B via vLLM on RTX 4090 24 GB at FP16 — StarCoder2 is the best open-weight model for fill-in-the-middle (FIM) code completion, trained on The Stack v2 (619 programming languages, 3.3TB source code). The 15B variant fits on a single RTX 4090 at FP16 (30 GB) with half-precision attention and delivers HumanEval pass@1 62.4%. For lower VRAM (<16 GB), StarCoder2 7B fits on RTX 3060 12GB at FP16 (14 GB) and scores HumanEval pass@1 54.2%. For completion-only (no FIM), StarCoder2 3B runs on any GPU at ~6 GB FP16. Skip StarCoder 1 — the v2 architecture adds GQA and doubled context to 16K at 4× training data. StarCoder2 uses BigCode Open RAIL-M license — permits commercial use with ethical use restrictions. The training dataset (The Stack v2) is fully public — best-in-class data transparency.

Deployment guidance

For single-user code completion: llama.cpp server mode with StarCoder2 15B Q4_K_M (~10 GB) on RTX 3060 12GB — FIM requires the <fim_prefix> / <fim_suffix> / <fim_middle> token format. For VS Code integration: Continue + Ollama + starcoder2:15b Q4_K_M — ~15 tok/s tab completion latency. For multi-user FIM serving: vLLM 0.6.0+ on 2× L4 24 GB — FIM processing splits prefix/suffix into separate prefill passes; enable prefix caching to reuse overlapping prefixes across developer sessions. For datacenter: TensorRT-LLM FP8 on L40S 48 GB — ~8,000 tok/s at batch 64, FIM completion latency <100ms. For training/fine-tuning: StarCoder2 uses the SantaCoder tokenizer (49K vocab, code-optimized) — fine-tune with FIM rate at 50% for code completion, 0% for instruction-following. For code-only workflows that don't need FIM, DeepSeek Coder V3 outperforms StarCoder2 on instruction-following code generation but lacks FIM capability at comparable quality.

Recommended runtimes

Related families

Related — keep moving

Runtimes that fit
Alternatives
Before you buy

Verify StarCoder runs on your specific hardware before committing money.