Instructions to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0 # Run inference directly in the terminal: llama cli -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0 # Run inference directly in the terminal: llama cli -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
Use Docker
docker model run hf.co/Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
- Ollama
How to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with Ollama:
ollama run hf.co/Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
- Unsloth Desktop
- Docker Model Runner
How to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with Docker Model Runner:
docker model run hf.co/Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
- Lemonade
How to use Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF:Q8_0
Run and chat with the model
lemonade run user.Mellum2-12B-A2.5B-Base-code-GGUF-Q8_0
List all available models
lemonade list
- Atomic Chat
Mellum2-12B-A2.5B-Base β code-tuned mixed-precision GGUF
GGUF quantizations of JetBrains/Mellum2-12B-A2.5B-Base built for local code completion (fill-in-the-middle) on 16 GB and 8 GB GPUs.
Unlike uniform quants, every tensor type here was chosen from measured per-layer sensitivity (KL divergence against the BF16 model on held-out source code), with an importance matrix computed on code and FIM-formatted samples.
This is an unofficial community quantization. All credit for the model goes to JetBrains. The base model is a pretrained checkpoint, not an instruction/chat model: use it for completion and FIM.
Files
| File | Size | Mean KLD β | Same top-1 β | Target |
|---|---|---|---|---|
Mellum2-12B-A2.5B-Base-Q8_0.gguf |
12.9 GB | 0.00113 | 99.28 % | 16 GB GPU, headless / no desktop on the card |
Mellum2-12B-A2.5B-Base-code-Q6_K-HQ.gguf β |
11.2 GB | 0.00143 | 99.19 % | 16 GB GPU with a desktop |
Mellum2-12B-A2.5B-Base-code-Q6_K-FAST.gguf |
10.3 GB | 0.00298 | 98.81 % | 16 GB GPU, more room for other workloads |
Mellum2-12B-A2.5B-Base-code-Q4_K-8GB.gguf |
7.6 GB | 0.00879 | 97.75 % | 8 GB GPU (headless, β€16k context) |
imatrix-code.gguf |
82 MB | β | β | importance matrix used for the mixed quants (Q8_0 does not use one) |
Reference points measured with the same protocol (not uploaded):
| Config | Size | Mean KLD | Same top-1 |
|---|---|---|---|
| Q8_0 experts + 7 least-sensitive layers in 4-bit ("80 % Q8 / 20 % Q4") | 11.5 GB | 0.00284 | 98.84 % |
| All experts Q5_K / Q5_0 | 8.8 GB | 0.00388 | 98.41 % |
| All experts Q4_K / IQ4_NL (L27 included) | 7.4 GB | 0.01018 | 97.49 % |
Takeaway: for this MoE, "Q6 everywhere" (HQ) beats "Q8 with some layers at Q4" β it is smaller and has half the error.
Recipes
All quants keep the router (ffn_gate_inp) and norms in F32, and attention, token embedding and
output head in Q8_0. Only the expert tensors differ:
| Variant | ffn_gate_exps / ffn_up_exps |
ffn_down_exps |
Layer 27 experts |
|---|---|---|---|
| Q8_0 | Q8_0 | Q8_0 | Q8_0 |
| HQ | Q6_K | Q8_0 | Q8_0 |
| FAST | Q6_K, Q4_K on layers 0,1,18,21,22,23,24 | Q8_0, IQ4_NL on the same layers | Q8_0 |
| Q4-8GB | Q4_K | IQ4_NL | Q8_0 |
Notes:
ffn_down_expshas an input dimension of 896, which is not a multiple of 256, so K-quants cannot be used there; 32-element block types (Q8_0, Q5_0, IQ4_NL) are set explicitly instead of relying on llama.cpp's silent fallback.- Layer 27 (the last one) is 3β10Γ more sensitive than any other layer and is kept at Q8_0 everywhere.
- The least sensitive expert layers are 0, 23, 1, 22, 24, 18, 21 (full table in
eval/kl_sweep.csv). general.file_typeis a label only (Q6_K / Q4_K_M); the exact per-tensor types are inrecipes/.
Reproduce any file:
llama-quantize --imatrix imatrix-code.gguf --tensor-type-file recipes/HQ.txt \
Mellum2-12B-A2.5B-Base-BF16.gguf Mellum2-12B-A2.5B-Base-code-Q6_K-HQ.gguf Q6_K
Usage
llama.cpp server (recommended for IDE completion)
llama-server -m Mellum2-12B-A2.5B-Base-code-Q6_K-HQ.gguf \
-ngl 99 -fa on -c 32768 -np 1 -b 8192 -ub 1024 --cache-reuse 256 --port 8012
Then point an editor plugin that speaks llama.cpp's /infill endpoint (e.g. llama.vscode, llama.vim)
at http://localhost:8012. The FIM tokens are recognised automatically.
Two flags matter a lot for latency:
-np 1: with several slots, consecutive requests land on different slots and never hit the KV cache.-b 8192:/infilltruncates the prefix to a budget derived from the batch size; if the prefix start keeps shifting while you type, the cache never matches.
Raw FIM prompt (PSM)
<fim_prefix>{code before cursor}<fim_suffix>{code after cursor}<fim_middle>
The model writes the missing middle and ends with <|endoftext|>. Stop on <|endoftext|>,
<fim_prefix>, <fim_suffix> and <fim_middle>. An optional <filename>path\n line before
<fim_prefix> can be used for file context. Avoid <fim_pad> and <|extra_token_*|>: their
embeddings are essentially untrained.
Ollama
A Modelfile is included (untested by the author):
ollama create mellum2-code -f Modelfile
Performance
Measured on an AMD Radeon RX 7800 XT (16 GB, ROCm 7.2, llama.cpp 240d68f, flash attention on).
| File | Prefill (pp2048) | Generation (tg64) |
|---|---|---|
| Q8_0 | 4120 t/s | 94.5 t/s |
| HQ | 3220 t/s | 98.7 t/s |
| FAST | 3405 t/s | 99.6 t/s |
| Q4-8GB | 3980 t/s | 100.6 t/s |
HQ with growing context: generation 96.5 β 93.3 β 90.5 t/s at depth 0 / 4k / 16k (21 of 28 layers use a 1024-token sliding window, so long contexts are cheap).
Real FIM session (simulated typing, ~2.7k-token context, HQ, settings above):
| Request | Tokens re-processed | Total latency |
|---|---|---|
| First request (cold cache) | 2701 | 1.05 s |
| While typing, 16-token suggestion | ~400 (the suffix) | ~0.33 s |
| While typing, 64-token block | ~1 | ~0.72 s |
Memory (VRAM incl. KV cache): HQ β 11.3 GiB at 32k context, Q4-8GB β 7.7 GiB at 16k context. On ROCm, Q8_0 has faster prefill than the K-quant mixes, and generation on this card is not memory-bandwidth bound (~35 % utilisation), so speeds on other GPUs may rank differently.
Method
- HF β GGUF BF16 with llama.cpp
convert_hf_to_gguf.py. - Importance matrix on ~1.3 MB of source code in 10 languages (Python, JS, TS, Go, C, C++, headers, Ruby, Lua, shell), ~40 % of samples in PSM FIM format, context 512 (854 chunks). A few experts are never routed on this data (β₯ 98 % coverage per tensor).
- Reference logits from the BF16 model on a disjoint held-out code set (24 chunks Γ 2048 tokens).
- Sensitivity sweep: each layer's experts quantized to 4-bit alone, everything else Q8_0, KL divergence measured against BF16. Per-layer effects add up almost linearly.
- Candidate mixes built from the sweep and re-measured end to end (numbers above).
Calibration/eval text came from locally installed open-source code and is not redistributed;
scripts/build_calib.py regenerates an equivalent set from any directories of code.
scripts/kl_eval.sh and scripts/sweep.sh reproduce the measurements.
Limitations
- KL/top-1 measure fidelity to BF16, not benchmark accuracy (HumanEval, etc.).
- Evaluation context is 2048 tokens; behaviour at very long contexts was not measured for quality.
- Performance numbers are from a single AMD GPU; CUDA/Vulkan backends will differ.
License
Apache-2.0, inherited from JetBrains/Mellum2-12B-A2.5B-Base. See the Mellum2 technical report for details on the base model.
- Downloads last month
- 332
Model tree for Ruka6/Mellum2-12B-A2.5B-Base-code-GGUF
Base model
JetBrains/Mellum2-12B-A2.5B-Base