gemma-4-12B-it-MATE-3b
MATE 3-bit (3.00 bpw, 5.88 GB) | 12 GB VRAM at 32K context

At a Glance
| Spec |
Value |
| Base model |
google/gemma-4-12B-it |
| Parameters |
12B multimodal hybrid-attention |
| Quantization |
3-bit CPTC-TQIR trellis |
| Effective bpw / Size |
3.00 bpw / 5.88 GB |
| Multimodal towers |
Vision encoder preserved in BF16 |
| KV cache runtime |
Compact 640-row k_eq_v + shared-layer aliasing + 4-bit R4KV |
| Min GPU VRAM (32K context) |
12 GB |
| Quality (WT-2 PPL / KLD / Top-1) |
14.011 (+0.715) / 0.1704 / 85.79% |
Which Variant Should I Pick?
| Variant |
Min GPU (32K context) |
When to Pick |
| 4b |
12-16 GB |
Default pick for 12-16 GB+ GPUs with BF16 vision tower preserved |
| 3b (this repo) |
12 GB |
Lower VRAM footprint on 12 GB GPUs |
| 2b |
8 GB |
Fits 8 GB GPUs at maximum compression |
Memory Breakdown (32K Context)
| Component (32K ctx) |
FP16 KV |
Compact KV + R4KV |
| Quantized weights (+ BF16 vision tower) |
6.04 GB |
6.04 GB |
| 32K KV cache |
Full sliding + global FP16 |
640-row k_eq_v compact KV + shared-layer aliasing + 4-bit R4KV |
Quickstart
One-Command Launch (mate run)
mate run inspects your GPU/RAM, configures KV compression, offload, and speculative decoding automatically, and loads the checkpoint:
pip install mate-llm[hf]
mate run Honkware/gemma-4-12B-it-MATE-3b --ctx 32768
mate run Honkware/gemma-4-12B-it-MATE-3b --ctx 32768 --serve --port 8000
Query the running server via OpenAI (/v1/chat/completions) or Anthropic (/v1/messages, ANTHROPIC_BASE_URL=http://127.0.0.1:8000):
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"Honkware/gemma-4-12B-it-MATE-3b","messages":[{"role":"user","content":"Write a C++20 lock-free ring buffer."}]}'
Python API
from mate import HybridFastDecodeRunner, load_quantized_model
model, tokenizer = load_quantized_model("Honkware/gemma-4-12B-it-MATE-3b")
runner = HybridFastDecodeRunner(model, tokenizer=tokenizer, max_seq_len=32768, kv_mode="r4kv")
out = runner.generate("Explain trellis quantization in two sentences.", max_new_tokens=128)
print(tokenizer.decode(out["token_ids"], skip_special_tokens=True))
Bare-Metal C++20 (mate-serve)
cmake -S mate/csrc/runtime -B build/runtime -DCMAKE_BUILD_TYPE=Release
cmake --build build/runtime -j
./build/runtime/mate-serve --model ./gemma-4-12B-it-MATE-3b --host 127.0.0.1 --port 8000 --max-batch 64 --max-kv-pages 1024
Sampling & Chat Template
| Mode |
Temperature |
Top-P |
Top-K |
Notes |
| Default chat |
1.0 |
0.95 |
64 |
Upstream Gemma-4 instruction-tuned defaults; use the tokenizer chat template |
| Deterministic / eval |
0.0 |
1.0 |
- |
Greedy decoding for exact-match verification |
Variants & Benchmarks
Quality is evaluated on wikitext-2-raw-v1:test (seq_len=2048, BF16 ref PPL 13.295).
| Variant |
bpw |
Size |
WT-2 PPL |
KLD |
Top-1 |
| 4b |
4.00 |
7.14 GB |
13.283 (-0.013) |
0.0682 |
90.97% |
| 3b |
3.00 |
5.88 GB |
14.011 (+0.715) |
0.1704 |
85.79% |
| 2b |
2.00 |
4.61 GB |
18.504 (+5.208) |
0.6316 |
72.47% |
Architecture & selective precision
- Selective mixed precision:
lm_head, embeddings, norms, and the multimodal vision tower stay in BF16/FP16; text linear projections use B=64 2D-FWHT + CPTC-TQIR (trellis_depth=10).
- Quality pipeline: sequential GPTAQ asymmetric LDLQ, YAQA 2D Kronecker
H_G, JARQ refinement, per-head V-O Hadamard folding (R2), lossless AWQ MLP smoothing, and pure KL scale distillation.
- Gemma-4 640-row
k_eq_v compact KV cache with shared-layer KV aliasing across sliding-window and global attention layers, paired with 4-bit R4KV and CUDA-graphed trellis_gemv_v3 decode.
Hardware backends
| Target |
Compute Path |
Notes |
NVIDIA Blackwell (sm_120a) |
Native CUDA (trellis_gemv_v3, r4kv, t2tc) |
Full DP4A, PDL, Stream-K, 128-split R4KV |
NVIDIA Ada / Hopper (sm_89 / sm_90) |
Native CUDA (trellis_gemv_v3, r4kv, t2tc) |
CUDA-Graph decode and 4-bit rotated KV cache (R4KV) |
NVIDIA Ampere (sm_80 / sm_86) |
Native CUDA (trellis_gemv_v3, r4kv, e8_v3) |
DP4A GEMV and compressed KV |
| CPU x86-64 / ARM64 (AVX-512 VNNI, AVX2, NEON) |
Mojo 1.2 / MAX 26.7 ops (mate/libmate.so) |
Zero libmax.so runtime dependency; optional on CUDA hosts |
| Bare-metal C++20 runtime |
mate-serve + libmate_runtime.so |
Zero-Python mmap, BPE/Unigram, Jinja2, epoll HTTP/SSE |
Quantization recipe & reproduction
| Field |
Value |
| Method |
CPTC-TQIR trellis quantization with sequential GPTAQ asymmetric LDLQ, YAQA 2D Kronecker H_G, JARQ refinement, per-head V-O Hadamard folding (R2), lossless AWQ MLP smoothing, and pure KL scale distillation (mode="ldlq", 64 x 512 tokens from wikitext-2-raw-v1:train+mate_prose_code_mix, disjoint from wikitext-2-raw-v1:test). |
| Base model |
google/gemma-4-12B-it |
| Bitwidth & precision |
3-bit CPTC-TQIR trellis (trellis_depth=10, B=64 2D-FWHT; lm_head, embeddings, norms, and vision tower kept in BF16/FP16) |
| KV cache runtime |
Gemma-4 640-row k_eq_v compact KV + shared-layer aliasing + 4-bit R4KV |
| Engine commit |
mate-llm 378ecdb |
| Raw results |
eval.json |
mate quantize google/gemma-4-12B-it -o gemma-4-12B-it-MATE-3b.safetensors --bits 3 --depth 10 --double-hadamard