How to use from
Ollama
ollama run hf.co/Krasnopjorovs/gemma-4-12b-it-Imatrix-IQ4_XS-GGUF:IQ4_XS
Quick Links

Gemma 4 12B Unified — Imatrix IQ4_XS GGUF

Custom importance-matrix quantized version of google/gemma-4-12B-it, the encoder-free unified multimodal model from Gemma 4 family.

Quantization details

  • Base model: google/gemma-4-12B-it (BF16, ~23.8 GB)
  • Method: IQ4_XS with custom importance matrix calibration
  • Calibration dataset: reapmix_imatrix (2237 chunks)
  • Embedding protection: per_layer_token_embd.weight preserved in Q6_K via imatrix
  • Final size: 6.16 GB (4.45 BPW)
  • Compression ratio: 0.26x from BF16

Architecture notes

Gemma 4 12B uses the new gemma4_unified architecture — encoder-free multimodal design where vision and audio modalities are projected directly into the decoder through lightweight linear layers, rather than dedicated encoders. The model has 48 layers with shared KV in every 6th global layer (head_count_kv=1), optimizing memory footprint for the 256K context window.

This quant requires llama.cpp commit including PR #24088 or later for gemma4_unified architecture support.

Hardware benchmark

Tested on NVIDIA RTX PRO 5000 Blackwell (72 GB VRAM):

Metric Value
Generation speed 99-104 tok/s sustained
VRAM at 32K context ~10 GB (with FlashAttention)
Time to first token <1 s on typical prompts

Recommended sampling

Per Google's Gemma 4 best practices — deviating from these will cause repetition loops on edge-case prompts:

  • temperature: 1.0
  • top_p: 0.95
  • top_k: 64
  • repeat_penalty: 1.0 (disabled)

Thinking mode

To enable Gemma 4's reasoning mode, prepend <|think|> to the system prompt. The model will produce internal reasoning in a <|channel>thought ... <channel|> block before the final answer.

Pipeline

Built using a hybrid CPU/GPU pipeline across a homelab cluster:

  1. BF16 to GGUF conversion on AI workstation (Dell 5820 + RTX PRO 5000)
  2. Importance matrix computed on GPU (~60 minutes for 2237 chunks)
  3. IQ4_XS quantization on dual Xeon E5-2699 v3 (88 threads, 128 seconds)
  4. Inter-node transfer via 40GbE direct-attach (RoCEv2 ring)

Quick start

./llama-server \
  -m gemma-4-12b-it-Imatrix-IQ4_XS.gguf \
  -c 32768 \
  -ngl 99 \
  --host 0.0.0.0 \
  --port 8080

License

Apache 2.0 (inherited from base model).

Downloads last month
135
GGUF
Model size
12B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Krasnopjorovs/gemma-4-12b-it-Imatrix-IQ4_XS-GGUF

Quantized
(265)
this model