Mellum 2.1 Instruct, hands-on: JetBrains' fast local coding model that skips the thinking
JetBrains released Mellum 2.1 Instruct today: a 12B mixture-of-experts coding model that answers without a chain of thought, uses about half the tokens of its Thinking sibling, and runs on your own hardware for free. Install it with Ollama, verify it with real commands, and put it to work as a fix-the-failing-test sub-agent.
- The model in one sentence: 12B mixture-of-experts, 2.5B active parameters, 131,072-token context, Apache 2.0 — trained with reinforcement learning inside real repositories, rewarded when hidden tests pass.
- The verified install:
ollama pull hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M— 8.1 GB, no Modelfile, no account, no key. Model IDae9559075c7cin this tutorial. - The sampling settings that matter: temperature 0.6, top_p 0.95, top_k 20, straight from the model card. Set
num_ctxexplicitly (32,768 used here) — Ollama’s default is far smaller than the model’s 131K maximum. - The measured speed: 216.8 tokens/sec steady-state on an RTX 3090 with the full model in VRAM. The first call takes ~48 seconds because it loads 8.1 GB of weights — that is load time, not generation speed.
- The agent loop: failing test → patch → the test suite decides. Passed on try 1 in 1.1 seconds and 450 tokens, with a genuine one-line fix (
reverse=True).

JetBrains shipped a new coding model today, and it is built for a job most models are bad at: being the fast, cheap worker inside your own tools. Mellum 2.1 Instruct is the direct-answer sibling of October’s Mellum 2.1 Thinking. Same 12-billion-parameter mixture-of-experts model, same reinforcement-learning training in real repositories — but where Thinking reasons out loud before it acts, Instruct answers straight, with no chain of thought. On JetBrains’ repository-level tasks it uses about half as many tokens as Thinking, and it still resolves 40.4% of SWE-bench Verified tasks, double its predecessor’s 20.2%. The weights are Apache 2.0, the GGUF builds are on Hugging Face, and the whole thing runs on your own hardware for $0 after the download.
This tutorial runs it for real. You will install Ollama, pull the 8.1 GB Q4_K_M build, get a first answer with the model card’s exact sampling settings, call it from Python through the OpenAI-compatible API, and then put it to work as a sub-agent: a small loop that hands it a failing test, takes back a patch, and lets the test suite decide. Every command below ran while writing this tutorial, on a desktop RTX 3090, and the outputs shown are the real ones.

What you’ll need#
- Ollama 0.40 or newer (ollama.com/download). This tutorial used Ollama 0.40.2 on Windows with an RTX 3090; the same commands work on macOS and Linux.
- About 9 GB of free disk for the Q4_K_M weights (8.1 GB) plus overhead. The other quants are 7.0 GB (MXFP4_MOE, smallest) to 24.3 GB (BF16, reference).
- A GPU with 8 GB+ of VRAM is strongly recommended — an RTX 3090/4090, an Apple Silicon Mac, or any card that fits the quant. CPU-only works, but a 12B MoE at 2.5B active parameters generates a few tokens a second on a laptop CPU, which is too slow for an agent loop.
- Cost: $0. No account, no API key, no cloud. The model is Apache 2.0, so commercial use is fine.
- Python 3.10+ for the API and agent-loop steps. Only the standard library is used — no extra packages.
Time: about 20 minutes including the download. The finished setup is a local model server on localhost:11434 answering OpenAI-compatible requests, plus a 60-line Python loop that turns it into a fix-the-failing-test sub-agent.
1. Install Ollama and pull the model#
Mellum 2.1 Instruct ships as GGUF files in the Hugging Face repo JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF. Ollama can pull a GGUF straight from the Hub with no Modelfile: the hf.co/ prefix names the repo, and the tag after the colon picks the quantization. Q4_K_M is the default when no tag is given, and it is the right starting point — JetBrains’ own measurements put it at 87.4% top-token agreement with the unquantized model, against 94.3% for Q6_K and 96.2% for Q8_0.
ollama pull hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M
Expect an 8.1 GB download. Verify it landed:
ollama list
NAME ID SIZE MODIFIED
hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M ae9559075c7c 8.1 GB 13 seconds ago
Picking a quant is a VRAM decision, and JetBrains publishes the quality cost of each one, measured as KL divergence and top-token agreement against the BF16 logits on Wikitext-2:
| Quantization | Size | Top-token match vs BF16 | Use it when |
|---|---|---|---|
MXFP4_MOE | 7.0 GB | 84.3% | VRAM is tightest; smallest file |
Q4_K_M | 8.1 GB | 87.4% | Default; best size/quality balance |
Q6_K | 10.9 GB | 94.3% | JetBrains’ recommended quant |
Q8_0 | 12.9 GB | 96.2% | Near-lossless; 16 GB+ VRAM |
BF16 | 24.3 GB | — (reference) | Reference quality; 24 GB VRAM |
The same repo also ships the multi-token prediction (MTP) head — one extra transformer block that predicts the token after the one just sampled, used for speculative decoding in llama.cpp. Step 5 covers it. Ollama does not use the MTP head; the quants above are what ollama run hf.co/… resolves to.
2. First run: chat with the exact sampling settings#
Start a chat session:
ollama run hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M
That drops you into an interactive prompt. Before asking anything, set the sampling parameters from the model card. Instruct is tuned for temperature 0.6, top-p 0.95, top-k 20 — noticeably cooler than the temperature 1.0 JetBrains used for the Thinking variant in its agent evals. In the Ollama chat, type:
/set parameter temperature 0.6
/set parameter top_p 0.95
/set parameter top_k 20
Then ask it the model card’s own example task:
>>> Write a Python function to reverse a string.
On this machine the answer came back as exactly this, nothing more:
def reverse_string(s):
return s[::-1]
Note what did not happen: no thinking block, no “let me think through this” preamble. That is the whole point of Instruct. The Thinking variant would have spent tokens reasoning about a one-line function; Instruct just answers. On a trivial task the difference is cosmetic. On an agent loop that makes dozens of calls, it is the difference between a snappy tool and a slow one.
One honest number about that first call: it took 48.5 seconds wall-clock for 15 reply tokens. That is not the model’s speed — it is the cold-load cost of pulling 8.1 GB of weights into VRAM the first time. Once loaded, the same model is fast, as the next step measures.
3. Call it from Python through the OpenAI-compatible API#
Ollama serves an OpenAI-compatible API on http://localhost:11434/v1, so any OpenAI client works unchanged. The script below uses only the standard library, so there is nothing to install. Save it as mellum_check.py:
#!/usr/bin/env python3
"""mellum_check.py — first-run verification against desktop Ollama (stdlib only).
Calls /api/chat with Mellum 2.1 Instruct sampling params from the model card
(temp 0.6, top_p 0.95, top_k 20) and prints the reply + token/timing stats.
Usage: python mellum_check.py
"""
import json, time, urllib.request
MODEL = "hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M"
BASE = "http://127.0.0.1:11434"
def chat(messages, num_ctx=32768):
body = {
"model": MODEL,
"messages": messages,
"stream": False,
"options": {"temperature": 0.6, "top_p": 0.95, "top_k": 20,
"num_ctx": num_ctx},
}
req = urllib.request.Request(
BASE + "/api/chat",
data=json.dumps(body).encode(),
headers={"Content-Type": "application/json"},
)
t0 = time.time()
with urllib.request.urlopen(req, timeout=600) as r:
out = json.load(r)
wall = time.time() - t0
return out, wall
def main():
messages = [
{"role": "user", "content":
"Write a Python function to reverse a string. Reply with only the code, no explanation."},
]
out, wall = chat(messages)
reply = out["message"]["content"]
print("=== REPLY ===")
print(reply)
print("=== STATS ===")
print("wall_s: %.1f" % wall)
print("prompt_tokens:", out.get("prompt_eval_count"))
print("reply_tokens:", out.get("eval_count"))
dur = out.get("eval_duration") # nanoseconds
if dur and out.get("eval_count"):
print("eval_tok_per_s: %.1f" % (out["eval_count"] / (dur / 1e9)))
print("done_reason:", out.get("done_reason"))
if __name__ == "__main__":
main()
Two details matter. First, num_ctx: the model supports a 131,072-token context, but Ollama’s default context is far smaller, so set it explicitly — 32,768 covers a file plus test output with room to spare. Second, the eval_count / eval_duration fields in Ollama’s response give you a real tokens-per-second measurement for every call, which is how the speed numbers in this tutorial were produced. Run it:
python mellum_check.py
The same reverse-a-string call, now through the API, returned the same one-liner. The interesting measurement came from a longer ask — an LRU cache class with docstrings and an example, 616 reply tokens:
reply_chars: 2131
wall_s: 3.1
prompt_tokens: 54
reply_tokens: 616
prompt_eval_s: 0.25
eval_tok_per_s: 216.8
done_reason: stop
216.8 tokens per second on an RTX 3090, with the full 8.1 GB model offloaded to VRAM (Ollama’s /api/ps reports size_vram equal to the full model size). That is the number that makes the agent loop in the next step practical: a 150-token patch costs under a second of generation. The reply itself was clean, complete code with docstrings — no thinking block, no preamble, no truncation.
If you prefer the openai package, the model card’s quickstart is the same call with a different client: OpenAI(base_url="http://localhost:11434/v1", api_key="ollama"), model set to the hf.co/… name, temperature=0.6, top_p=0.95, extra_body={"top_k": 20}. The api_key value is ignored by Ollama; any string works.
4. The fix loop: Mellum as a fast sub-agent#
This is the use case Instruct was trained for. JetBrains’ own benchmark setup runs the model as an agent inside real repositories with shell and file tools, rewarded only when hidden tests pass. The loop below is the same idea shrunk to one file: a failing test, a prompt, a patch, and the test suite as judge. The model proposes; the tests decide.

First the buggy file, buggy.py — a top_k_frequent helper with one planted bug (it sorts by count ascending, so it returns the least frequent items):
"""buggy.py — small module with one planted bug for the fix-loop demo.
The bug: top_k_frequent sorts by count ASCENDING, so it returns the
LEAST frequent items instead of the most frequent ones.
"""
def top_k_frequent(items, k):
"""Return the k most frequent items, most frequent first."""
counts = {}
for it in items:
counts[it] = counts.get(it, 0) + 1
ranked = sorted(counts.items(), key=lambda kv: kv[1])
return [item for item, _ in ranked[:k]]
And a plain-assert test runner, run_tests.py (no pytest needed):
"""run_tests.py — plain-assert test runner for the fix-loop demo (no pytest needed)."""
import sys
from buggy import top_k_frequent
failures = []
def check(name, got, want):
if got != want:
failures.append(f"{name}: got {got!r}, want {want!r}")
else:
print(f"ok: {name}")
check("basic top-2",
top_k_frequent(["a", "b", "a", "c", "b", "a"], 2), ["a", "b"])
check("top-1",
top_k_frequent(["x", "y", "y", "z", "y"], 1), ["y"])
check("k larger than distinct",
top_k_frequent(["p", "p", "q"], 5), ["p", "q"])
check("ties keep insertion order",
top_k_frequent(["m", "n", "m", "n"], 2), ["m", "n"])
if failures:
print("FAILURES:")
for f in failures:
print(" -", f)
sys.exit(1)
print("ALL TESTS PASSED")
Confirm the bug is real before the model touches anything:
python run_tests.py; echo "exit=$?"
ok: ties keep insertion order
FAILURES:
- basic top-2: got ['c', 'b'], want ['a', 'b']
- top-1: got ['x'], want ['y']
- k larger than distinct: got ['q', 'p'], want ['p', 'q']
exit=1
Three of four tests fail; the tie test passes even with the bug, which is useful — it guards against a fix that breaks tie order. Now the loop itself, fix_loop.py. It runs the tests, sends the file plus the failure output to Mellum, takes back a complete corrected file from a single ```python block, writes it, and runs the tests again. Three tries maximum, then it stops and says so:
#!/usr/bin/env python3
"""fix_loop.py — Mellum 2.1 Instruct as a fast fix-the-failing-test sub-agent.
Stdlib only. Loop: run tests -> send file + failure to local Ollama ->
apply the model's full-file rewrite -> run tests again. Max 3 tries.
Usage: python fix_loop.py (run from the demo project directory)
"""
import json, re, subprocess, sys, time, urllib.request
MODEL = "hf.co/JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q4_K_M"
BASE = "http://127.0.0.1:11434"
TARGET = "buggy.py"
TESTS = "run_tests.py"
MAX_TRIES = 3
PROMPT = """You are a precise coding assistant. Fix the bug in the file below so the
tests pass. Reply with the COMPLETE corrected file inside one ```python block
and nothing else outside it. Do not change the function signatures.
FILE buggy.py:
```python
{source}
```
TEST OUTPUT:
```
{test_out}
```
"""
def chat(messages):
body = {"model": MODEL, "messages": messages, "stream": False,
"options": {"temperature": 0.6, "top_p": 0.95, "top_k": 20,
"num_ctx": 32768}}
req = urllib.request.Request(BASE + "/api/chat",
data=json.dumps(body).encode(), headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=600) as r:
return json.load(r)
def run_tests():
p = subprocess.run([sys.executable, TESTS], capture_output=True, text=True, timeout=120)
return p.returncode, (p.stdout + p.stderr).strip()
def main():
total_prompt = total_reply = 0
t_start = time.time()
for attempt in range(1, MAX_TRIES + 1):
rc, test_out = run_tests()
print(f"--- try {attempt}: tests exit={rc}")
print(test_out)
if rc == 0:
print(f"RESULT: PASS on try {attempt} (no fix needed)" if attempt == 1
else f"RESULT: PASS after {attempt - 1} fix(es)")
print(f"total wall_s: {time.time() - t_start:.1f}")
print(f"total prompt_tokens: {total_prompt} reply_tokens: {total_reply}")
return 0
source = open(TARGET).read()
out = chat([{"role": "user", "content": PROMPT.format(source=source, test_out=test_out)}])
reply = out["message"]["content"]
total_prompt += out.get("prompt_eval_count", 0)
total_reply += out.get("eval_count", 0)
m = re.search(r"```python\n(.*?)```", reply, re.S)
if not m:
print("RESULT: FAIL — model reply had no python block")
print(reply[:500])
return 1
open(TARGET, "w").write(m.group(1))
print(f"try {attempt}: patch applied ({len(m.group(1))} chars, "
f"reply_tokens={out.get('eval_count')})")
rc, test_out = run_tests()
print(f"--- final: tests exit={rc}")
print(test_out)
print("RESULT: FAIL after 3 tries" if rc else "RESULT: PASS on final check")
print(f"total wall_s: {time.time() - t_start:.1f}")
print(f"total prompt_tokens: {total_prompt} reply_tokens: {total_reply}")
return rc
if __name__ == "__main__":
sys.exit(main())
Run it:
python fix_loop.py
--- try 1: tests exit=1
ok: ties keep insertion order
FAILURES:
- basic top-2: got ['c', 'b'], want ['a', 'b']
- top-1: got ['x'], want ['y']
- k larger than distinct: got ['q', 'p'], want ['p', 'q']
try 1: patch applied (495 chars, reply_tokens=157)
--- try 2: tests exit=0
ok: basic top-2
ok: top-1
ok: k larger than distinct
ok: ties keep insertion order
ALL TESTS PASSED
RESULT: PASS after 1 fix(es)
total wall_s: 1.1
total prompt_tokens: 293 reply_tokens: 157
One try, 1.1 seconds wall-clock, 450 tokens total. And the patch was a genuine one-line fix, not a test-gaming rewrite — the model added reverse=True to the sort and left everything else alone:
ranked = sorted(counts.items(), key=lambda kv: kv[1], reverse=True)
That is the honest shape of a local sub-agent: fast, cheap, and judged by an external check rather than by its own confidence. The loop’s guardrails are doing as much work as the model — the three-try cap, the full-file rewrite (no patch parsing to get wrong), and the rule that only a green test run counts as done. On a harder bug the model will fail the cap, and that is the correct outcome: escalate to a stronger model instead of letting a small one guess repeatedly.
5. Faster still: MTP speculative decoding with llama.cpp#
Mellum 2.1 Instruct ships with a multi-token prediction head: one extra transformer block, trained with the model, that predicts the token after the one just sampled. llama.cpp uses it as a speculative draft — the full model verifies every drafted token, so the output is unchanged and generation is faster whenever drafts are accepted. JetBrains reports the head makes generation up to 1.8x faster.
The GGUF repo ships the head two ways: a standalone 1.8 GB BF16 draft file (mtp-Mellum2.1-12B-A2.5B-Instruct-BF16.gguf), and combined model-plus-head files under mtp/. The combined files need llama.cpp build b11747 (19 October 2026) or newer; older builds, Ollama, and LM Studio cannot load them yet. With the llama CLI from llama.app or any recent llama.cpp build, serving with the draft is one command:
# Pull and serve in one step; the suffix picks the quantization
llama serve -hf JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF:Q6_K \
--temp 0.6 --top-p 0.95 --top-k 20
That serves the same OpenAI-compatible API on http://localhost:9931/v1 — note the port, 9931, not Ollama’s 11434. To actually use the draft head, pass --spec-type draft-mtp; without it the head is simply not used and nothing else changes. This step is documented from the GGUF repo’s README rather than run end to end here — the Ollama path above is the verified one, and MTP only pays off once you are generating long outputs in a loop.
6. The server paths: vLLM and Transformers#
For a shared server instead of a laptop, the model card gives two more routes. vLLM serves the full-precision weights with tool calling enabled:
# Without tool calling
vllm serve JetBrains/Mellum2.1-12B-A2.5B-Instruct --max-model-len 131072
# With tool calling
vllm serve JetBrains/Mellum2.1-12B-A2.5B-Instruct \
--max-model-len 131072 \
--enable-auto-tool-choice \
--tool-call-parser hermes
And plain Transformers works from version 5.11.0, which added the mellum architecture. Both need a real GPU and a 24 GB+ download; they are here so you know the options exist, not as steps this tutorial ran.
Which approach should you use?#
| Your situation | Use | Why |
|---|---|---|
| You want it running in five minutes | Ollama + Q4_K_M | One pull command; API on :11434; the verified path in this tutorial |
| You want the fastest local generation | llama.cpp + MTP head | Speculative decoding, up to 1.8x faster; needs a recent build |
| You are serving a team or an app | vLLM | Throughput, tool calling, 131K context; needs a server GPU |
| The task needs deep reasoning | Mellum 2.1 Thinking | Same weights + chain of thought; 47.0% vs 40.4% on SWE-bench Verified |
| The task is a small fix, a question, a tool call | Mellum 2.1 Instruct | About half the tokens, nearly the same agentic score |
The Instruct/Thinking choice is the one that matters most, and JetBrains is unusually direct about it: reasoning is crucial on hard algorithmic and math problems (LiveCodeBench, AIME), where Thinking leads by a wide margin; on ordinary agent work — a small fix, a command to run, a question about the code — reasoning adds time and compute without adding quality. Use Instruct as the fast worker, Thinking as the escalation.
What the benchmarks actually say#
All numbers below are JetBrains’ own, from the model card, and every one is self-reported. The agentic rows were produced with the same open-source harness for every model — the Pi coding agent v0.73.1, shell and file tools, 114K-token context, up to 16K tokens per turn — which is the right way to compare agents, but it is still one harness, and harness choice moves scores.
| Benchmark | Mellum 2.1 Instruct | Mellum 2.1 Thinking | Qwen3.5 9B |
|---|---|---|---|
| SWE-bench Verified | 40.4 | 47.0 | 49.8 / 55.6 |
| LiveCodeBench v6 | 53.7 | 82.0 | 65.2 / 74.8 |
| HumanEval+ | 89.1 | 91.5 | 84.8 / 89.0 |
| MBPP+ | 74.3 | 79.4 | 63.8 / 69.0 |
| AIME 25/26 | 61.1 | 83.3 | 69.2 / 79.8 |
| BFCL v4 (tool use) | 46.5 | 62.3 | 61.2 / 60.0 |
| Terminal-Bench 2.1 | 8.2 | 17.4 | 17.6 / 18.5 |
Read the table as a tradeoff, not a ranking. Instruct leads its comparison group on code generation (HumanEval+, MBPP+) and doubles its predecessor on SWE-bench Verified — but Qwen3.5 9B, a dense 9B model, scores higher on the agentic benchmarks while activating more parameters per token (9B vs Mellum’s 2.5B). JetBrains’ answer is speed: Mellum generates about 1.4x faster than Qwen3.5 9B on a single request and about 1.8x faster under load, and it does it on hardware you already own. If your bottleneck is latency and cost per agent step, that matters more than nine points on SWE-bench. If your bottleneck is solving the hardest tasks, it does not — and the Thinking variant, or a bigger model, is the right call.
Limitations, stated plainly#
- The benchmarks are vendor-reported. Nobody outside JetBrains has reproduced the SWE-bench numbers yet, and the agentic scores come from one harness. Treat them as a starting point.
- Instruct is not a reasoner. It answers directly, which is a feature on easy tasks and a liability on hard ones: LiveCodeBench drops from 82.0 (Thinking) to 53.7 (Instruct). Do not use it for algorithmic work that needs a chain of thought.
- 131K context is a maximum, not a default. Ollama’s default context is much smaller; pass
num_ctxexplicitly, and remember that a long context on a local GPU costs VRAM for the KV cache. - The MTP head is llama.cpp-only for now. Ollama and LM Studio cannot use the combined files until they ship a new enough llama.cpp build.
- 12B MoE is small, not tiny. Q4_K_M needs ~8 GB of VRAM plus context. On a CPU-only laptop it runs, but slowly enough that an agent loop stops being fun.
The takeaway#
Mellum 2.1 Instruct is a small, honest proposition: a fast open model that does the routine half of coding-agent work on your own machine, for free, without a chain of thought tax on every call. Install Ollama, pull the Q4_K_M build, point your tools at localhost:11434, and let the test suite — not the model’s confidence — decide whether a patch lands. Keep the Thinking variant, or a bigger model, one escalation away for the tasks that actually need reasoning. That two-tier setup, fast worker plus strong reasoner, is the shape of local coding agents now, and this model was built to be the fast half.
Sources#
- JetBrains: Mellum2.1 Instruct Is Out — the release announcement (November 26, 2026): the Instruct/Thinking split, token savings, MTP head, and training on NeMo RL.
- JetBrains/Mellum2.1-12B-A2.5B-Instruct — the model card: architecture, sampling settings (temperature 0.6, top_p 0.95, top_k 20), the full benchmark table, and the vLLM and Transformers quickstarts.
- JetBrains/Mellum2.1-12B-A2.5B-Instruct-GGUF — the GGUF repo README: the quantization table with KL divergence and top-token agreement, the
llama servecommands, and the MTP speculative-decoding notes. - Hugging Face: Use Ollama with any GGUF Model — the
ollama run hf.co/…syntax and the default-Q4_K_M rule.