Mellum2.1 Instruct Local Coding Agent Setup: A Step-by-Step Guide
Mellum2.1 Instruct is JetBrains' instruction-tuned 12B-parameter mixture-of-experts coding model, released on Hugging Face on October 8, 2026, under the Apache 2.0 license. Setting it up as a local coding agent involves four steps: choose a quantized GGUF build that fits your VRAM, serve the model with Ollama or llama.cpp, point an OpenAI-compatible coding tool at the local endpoint, and apply the recommended sampling settings of temperature 0.6, topp 0.95, and topk 20. Because the model supports a 131,072-token context, raising the default context window in your runtime is the single most important configuration detail.
What Mellum2.1 Instruct Is
Mellum2.1 is the successor to Mellum2, which JetBrains open-sourced in June 2026. The architecture is unchanged: a mixture-of-experts model with 12 billion total parameters but only 2.5 billion active parameters per token, which is what makes it fast enough to run locally on a single consumer GPU. The main change in this release happened after pretraining. JetBrains moved reinforcement learning from a short final stage to the center of the training process, running millions of sandboxed environments across math, competitive programming, tool use, and software engineering tasks. The result is a model that can explore a codebase, edit files, and verify its own changes rather than only completing code.
Two variants are published on Hugging Face: JetBrains/Mellum2.1-12B-A2.5B-Instruct and JetBrains/Mellum2.1-12B-A2.5B-Thinking. The Instruct variant is the general-purpose, instruction-following build intended for direct use in agents. The Thinking variant adds an explicit reasoning trace before the final answer. For most local agent setups, the Instruct variant is the practical starting point because it responds directly without the extra reasoning tokens. On JetBrains' own evaluation, the model moved from 2.0 to 47.0 on SWE-bench Verified, a benchmark that measures the ability to resolve real GitHub issues, though these are vendor-reported numbers.
Hardware and Model Format Requirements
The practical question for local deployment is VRAM, not raw parameter count. Because only 2.5 billion parameters are active at any moment, the model can run on hardware that would struggle with a dense 12B model. JetBrains' official GGUF builds on the model card include Q4KM at 8.1 GB, Q6K at 10.9 GB, Q80 at 12.9 GB, MXFP4MOE at 7.0 GB, and BF16 at 24.3 GB. The Q4KM build is the recommended balanced option and fits a 12 GB GPU or a 16 GB Apple Silicon Mac. Q6K and Q8_0 trade additional VRAM for weights closer to the full BF16 model.
Quantization is not free of trade-offs. JetBrains reports a top-token match of 88.0 percent for Q4KM, 93.9 percent for Q6K, and 96.1 percent for Q80 relative to BF16 weights, measured on Wikipedia text at a short context rather than on code. This is a useful signal, not a coding benchmark. For a single-machine coding agent, Q4KM is the sensible default;teams with 16 GB or more VRAM can step up to Q6_K.
Setting Up with Ollama
Ollama offers the quickest path. Pull the model directly from the Hugging Face GGUF repository with a command such as:
OLLAMA_CONTEXT_LENGTH=32768 ollama run hf.co/JetBrains/Mellum2.1-12B-A2.5B-Thinking-GGUF:Q4_K_M
For the Instruct variant, substitute the Instruct GGUF repository name. The critical detail is OLLAMACONTEXTLENGTH. Ollama's default context is 4,096 tokens, while Mellum2.1 supports 131,072 tokens. Leaving the default in place will truncate any real repository task almost immediately. Set it to 32,768 for a balanced setup or the full 131,072 for large codebases, at the cost of higher memory use and slower prompt processing.
Once running, Ollama exposes an OpenAI-compatible endpoint at http://localhost:11434/v1. Most agent frontends, including Continue, Cline, and Codex CLI, accept this endpoint without modification. Select the pulled model name and the client routes requests through the local server instead of a hosted API.
Setting Up with llama.cpp
llama.cpp gives more explicit control over sampling and context. Start the server with:
llama-server -hf JetBrains/Mellum2.1-12B-A2.5B-Thinking-GGUF:Q4_K_M \
--ctx-size 131072 --temp 0.6 --top-p 0.95 --top-k 20 --port 8080
Change the repository name for the Instruct GGUF build. llama-server also exposes an OpenAI-compatible API at the /v1 path on the configured port and supports Anthropic's Messages API, which means Claude Code and other tools built around that protocol can connect to the same local process. Tool calling works through the built-in Jinja chat templates.
Connecting a Coding Agent Frontend
After the model is served, point an agent tool at the local endpoint. The general pattern is the same across frontends: choose the local or OpenAI-compatible option, enter http://localhost:11434/v1 for Ollama or the llama-server address for llama.cpp, and select the model name. Continue, Cline, Codex CLI, and Zed all support this configuration. No proxy layer is required because both runtimes expose OpenAI-compatible APIs.
For an IDE-native setup, LM Studio supports the GGUF builds through its model browser. For server-grade deployments, vLLM can serve the full-precision weights in BF16, FP8, and NVFP4 formats with a 131,072-token context.
Recommended Settings and Deployment Notes
JetBrains recommends temperature 0.6, topp 0.95, and topk 20 for chat and one-off coding questions across Ollama, llama.cpp, and vLLM. In an agent stack, Mellum2.1 Instruct is most commonly positioned as the high-volume worker rather than the sole planner: a larger model handles repository-level planning and difficult judgment calls, while Mellum2.1 Instruct performs focused sub-agent tasks such as reading files, locating function calls, drafting fixes, and checking tests. The Apache 2.0 license removes restrictions on commercial use and modification, and local serving keeps source code within your own infrastructure.
FAQ
Which GGUF quantization should I choose?
Choose Q4KM (8.1 GB) for a 12 GB GPU or a 16 GB Apple Silicon Mac. Move to Q6K (10.9 GB) or Q80 (12.9 GB) if you have at least 16 GB of VRAM and want weights closer to the full model.
Why does the model seem to forget context or stop early?
Check the context length. Ollama defaults to 4,096 tokens, which truncates repository work almost immediately. Set OLLAMACONTEXTLENGTH to 32,768 or 131,072 before running the model, or pass --ctx-size 131072 to llama-server.
How do I connect my coding tool to the local model?
Point the tool at the OpenAI-compatible endpoint: http://localhost:11434/v1 for Ollama, or the llama.cpp server address with /v1 appended. Then select the pulled model name. Continue, Cline, Codex CLI, and Zed all support this configuration.
What sampling settings should I use?
Use temperature 0.6, topp 0.95, and topk 20. These are the values JetBrains recommends and they apply across Ollama, llama.cpp, and vLLM.
