Codestral 2 Review 2026: Apache 2.0 Coding on 16GB VRAM
TL;DR: Codestral 2 is Mistral’s 22B dense coding model, and the big news for self-hosters is the license: it moved to Apache 2.0 in April 2026, dropping the non-commercial restriction that made the original Codestral legally useless in a paid product. It runs on a single 16GB GPU at Q4_K_M and has the best fill-in-the-middle completion of any open model this size. The catch: it’s a code specialist, not a general chat or agentic model.
| Codestral 2 (22B) | Qwen3-Coder | DeepSeek Coder V2 Lite | |
|---|---|---|---|
| Best for | IDE autocomplete + FIM | Multi-file agent tasks | Budget local coding |
| License | Apache 2.0 (clean) | Apache 2.0 / Qwen License | MIT |
| Local VRAM (Q4) | ~13 GB | 6 GB–276 GB (size varies) | ~10 GB |
| The catch | Not built for agentic edits | Larger sizes need big GPUs | Older, weaker on newer langs |
Honest take: If you want autocomplete in your editor that never sends a keystroke to the cloud, Codestral 2 is the model to run — but pair it with a bigger agent model like Qwen3-Coder for whole-repo refactors.
What actually changed with Codestral 2
The original Codestral shipped on May 29, 2024 under the Mistral AI Non-Production License (MNPL). That license read well until you got to the part that mattered: you could not “supply the Mistral Models or Derivatives in the course of a commercial activity… including through a hosted or managed service.” In plain terms, you could test it, but the moment you wired it into an internal tool your company depended on, you needed a separate paid agreement. That single clause kept Codestral out of most real deployments, no matter how good the completions were.
Codestral 2 landed April 8, 2026 and flipped that switch. It’s now Apache 2.0. You can run it in a commercial IDE extension, a code-review bot, or a CI pipeline with zero procurement paperwork. For a niche where the two other strong contenders — Qwen3-Coder and DeepSeek Coder — already ship under Apache 2.0 and MIT respectively, this finally puts Mistral’s code specialist on equal legal footing.
The model itself is a 22-billion-parameter dense transformer. Dense, not mixture-of-experts, which matters more than it sounds: VRAM use and throughput are predictable. There’s no “active vs total parameters” math to do, no expert-routing surprises. A 22B dense model at Q4_K_M is roughly 13GB on disk and in memory, full stop. That predictability is part of why it hit 380K Hugging Face downloads in its first week.
Specs that matter for self-hosting
- Parameters: 22B dense
- Context window: 256K tokens (carried over from the 25.01 architecture update that took it from 32K to 256K)
- License: Apache 2.0 (as of April 2026)
- Training: 80+ programming languages
- Specialty: Fill-in-the-middle (FIM) code completion + code generation from natural language
- Availability: Mistral API and Hugging Face weights
The 256K context is the sleeper feature. It’s what moves Codestral from a single-file autocomplete toy to something that can hold a handful of related source files in context at once. You won’t feed it a whole monorepo, but you can give it the file you’re editing plus its imports and get completions that respect your actual types and function signatures.
On benchmarks, be careful with the numbers floating around. The widely-cited 86.6% HumanEval figure belongs to Codestral 25.01, the January 2025 release. Mistral says Codestral 2 improves on GPT-4o across HumanEval and MBPP, but a clean, independent Codestral-2-specific HumanEval score isn’t published as of July 2026. Treat HumanEval as a rough capability signal, not gospel — it measures short, self-contained Python problems, which is the easiest slice of real coding. What Codestral 2 is genuinely class-leading at, per Mistral’s own framing and community reports, is FIM: predicting the middle of a function when it can see the code before and after the cursor. That’s the exact task an IDE autocomplete does thousands of times a day.
Hardware: what you actually need
Codestral 2 runs comfortably on a single consumer GPU. Here’s the honest VRAM math for a 22B dense model in GGUF (these are standard quantization sizes — verify the exact file size when you pull it):
| Quantization | Approx. size | Fits on | Quality |
|---|---|---|---|
| Q4_K_M | ~13 GB | RTX 4060 Ti 16GB, RTX 4080, RTX 4090 | Sweet spot for local |
| Q5_K_M | ~15.5 GB | 16GB+ cards | Slightly better, tighter fit |
| Q8_0 | ~23 GB | 24GB cards (RTX 3090 / 4090) | Near-lossless |
| FP16 | ~44 GB | 2× 24GB or an A6000 | Reference quality |
The practical answer for most people: Q4_K_M on a 16GB card. It runs on a single RTX 4060 Ti 16GB with room left for a modest context window. If you push context toward 32K+, budget more VRAM — long context grows memory use roughly linearly, and it’s the thing that tips a “fits fine” setup into out-of-memory territory. If you want to run FP16 for maximum fidelity or serve it to a team, rent an A100 or H100 by the hour on RunPod rather than buying a data-center card. For a deeper look at which consumer GPU fits which model tier, the runaihome GPU buying guide breaks down the price-per-VRAM math.
Setup with Ollama
The fastest path to a running instance is Ollama. Install it, then pull the model:
$ ollama pull codestral
pulling manifest
pulling 5b68668f65de... 100% ▕████████████▏ 13 GB
verifying sha256 digest
writing manifest
success
$ ollama run codestral "Write a Python function that returns the nth Fibonacci number iteratively."
def fibonacci(n):
if n <= 0:
return 0
a, b = 0, 1
for _ in range(n - 1):
a, b = b, a + b
return b
Confirm it’s actually on your GPU and not silently falling back to CPU:
$ ollama ps
NAME ID SIZE PROCESSOR UNTIL
codestral:latest a1b2c3d4e5f6 15 GB 100% GPU 4 minutes from now
If PROCESSOR shows anything other than 100% GPU, your context window or quantization is too big for your VRAM — drop to Q4_K_M or lower num_ctx. This is the single most common local-inference mistake, and it turns a fast model into a painfully slow one. The same GPU-verification step applies to any local model; the Ollama + Open WebUI Linux setup guide covers the full stack if you want a chat UI on top.
One default worth changing: Ollama ships models with a 4096-token context by default, which silently truncates anything longer. To use Codestral 2’s real context, raise it. In a Modelfile:
FROM codestral
PARAMETER num_ctx 32768
Then ollama create codestral-32k -f Modelfile.
Wiring FIM into your editor with Continue.dev
Autocomplete is where Codestral 2 earns its keep, and Continue.dev is the cleanest way to get it into VS Code or JetBrains with a local model. Codestral uses special FIM tokens, so you have to tell Continue to use the correct template. In ~/.continue/config.json:
{
"tabAutocompleteModel": {
"title": "Codestral 2",
"provider": "ollama",
"model": "codestral",
"template": "codestral"
}
}
The "template": "codestral" line is the part people miss. Without it, Continue sends a generic FIM prompt and you get completions that ignore the code after your cursor — which defeats the entire point of a fill-in-the-middle model. With it, Codestral sees both sides of the gap and completes accordingly. For a full agentic coding workflow rather than just autocomplete, Aider pairs well with local models too.
Codestral 2 vs the alternatives
The real question isn’t “is Codestral 2 good” — it’s “when do you reach for it over Qwen3-Coder or DeepSeek Coder.” Here’s the honest breakdown:
Pick Codestral 2 for: inline autocomplete and FIM. Its completion quality-per-VRAM is the best in the 22B class, and the Apache 2.0 license means you can ship it commercially. If your main use is “finish this function as I type,” this is the one.
Pick Qwen3-Coder for: agentic, multi-file work. It’s built to plan and execute edits across a codebase, and it scales from a 6GB variant up to the 480B monster. Codestral 2 is a strong completer but was not designed to be a coding agent that reasons over a whole repo.
Pick DeepSeek Coder V2 Lite for: the tightest budgets. MIT-licensed, runs on ~10GB, and still respectable — though it’s an older generation and lags on newer language features.
There’s also Mistral’s own Devstral Small 2, which is the agentic counterpart to Codestral: a 24B Apache 2.0 model that scores 68% on SWE-bench Verified. If you find yourself wanting Codestral to do things rather than complete things, Devstral is the sibling to reach for. Think of Codestral 2 as autocomplete and Devstral as the agent.
If you’re comparing these against cloud coding assistants like Cursor or Copilot, aicoderscope covers those head-to-head — the short version is that local models are a privacy and cost play, not a “beat GPT-5.5 on hard refactors” play.
When NOT to use Codestral 2
- You need an agent, not a completer. Codestral 2 completes code well but isn’t tuned for the plan-edit-verify loop that Devstral, Qwen3-Coder, or cloud agents handle. Using it as an agent backend will frustrate you.
- You need general chat or reasoning. It’s a code specialist. Ask it to draft an email or reason through a non-code problem and you’ll get worse answers than a general 7B model.
- Your GPU is under 12GB. You can technically run heavily-quantized versions, but quality drops and you’re better served by a smaller purpose-built model like DeepSeek Coder V2 Lite or a 7B Qwen coder.
- You want the absolute top SWE-bench score. For hard, multi-file agentic benchmarks, Codestral 2 is not the leader — its lane is completion, and that’s where it wins.
FAQ
Is Codestral 2 really free for commercial use? Yes. As of the April 2026 release it’s Apache 2.0, which permits commercial use, modification, and redistribution with no revenue cap or attribution-beyond-license requirement. This is the key difference from the original Codestral’s non-commercial MNPL license.
Can it run on a 16GB GPU? Yes, at Q4_K_M (~13GB) with a moderate context window. Push context past ~32K and you’ll want a 24GB card, or you’ll spill into system RAM and slow down.
Does it support fill-in-the-middle?
Yes — FIM is its headline strength. Make sure your editor extension uses the codestral prompt template so it actually sends the code after your cursor.
How is it different from Devstral? Codestral 2 is a completion specialist; Devstral Small 2 is an agentic software-engineering model tuned for SWE-bench-style tasks. Same company, different jobs.
What context length does it support? 256K tokens, though you’ll rarely fill that locally — VRAM for the KV cache becomes the limit long before the model does.
Sources
- Codestral | Mistral AI (original announcement)
- The Mistral AI Non-Production License (MNPL)
- Codestral Guide: Specs, Benchmarks & Local Deployment 2026 — UCStrategies
- Codestral 22B v0.1 model card — Hugging Face
- Codestral 2 Review 2026 — AIToolTier
- Mistral Models Overview — Mistral Docs
Recommended Gear
- RTX 4060 Ti 16GB — the budget sweet spot for running Codestral 2 at Q4_K_M with headroom for context.
- RTX 4090 — for Q8_0 near-lossless quality or serving completions to more than one user.
Was this article helpful?
Thanks for the feedback — it helps improve future articles.
Need hands-on help?
I offer 1-on-1 technical consulting for local AI setup, GPU selection, and AI coding tool configuration — same topics covered on this site.
Book a session — $49 / hour →