CoolFace
Modelpublic

majentik/gemma-4-31B-RotorQuant-GGUF-Q2_K

sourceHugging Faceapache-2.0updated 11d agoView on Hugging Face
0likes99downloads
Model Card
[!WARNING] Fork compatibility (2026-07-07): the llama-cpp-turboquant fork is currently based on a llama.cpp revision that predates `gemma4` architecture support — it fails with unknown model architecture: 'gemma4' and cannot run this model at all. Until the fork rebases, use mainline llama.cpp (which loads this GGUF fine with standard KV-cache types); the RotorQuant/TurboQuant KV-cache options are not usable with gemma-4 yet.

<!-- gemma4-fork-note -->

[!TIP] KV-cache quantization without any fork (recommended, 2026): upstream llama.cpp/Ollama now cover this natively — use -ctk q8_0 -ctv q8_0 (~half KV memory, negligible quality loss: perplexity +0.002–0.05) or -ctk q4_0 -ctv q4_0 (~quarter memory, ≈7.6% perplexity increase). In Ollama: OLLAMA_KV_CACHE_TYPE=q8_0 with OLLAMA_FLASH_ATTENTION=1. Keep K and V types symmetric to stay on the fast fused Flash-Attention path. Since April 2026, mainline llama.cpp also applies Hadamard rotation to KV activations (PR #21038), which greatly improves low-bit KV quality (opt-out: LLAMA_ATTN_ROT_DISABLE=1). The RotorQuant/TurboQuant fork flow below is experimental/legacy: the TurboQuant llama.cpp PR was closed without merging (June 2026) and the fork is unmaintained relative to mainline. It is NOT required to use this model.

<!-- kv-upstream-note -->

gemma-4-31B-RotorQuant-GGUF-Q2_K

GGUF Q2_K weight-quantized variant of google/gemma-4-31B optimised for use with RotorQuant KV cache compression via a dedicated llama.cpp fork.

Important: RotorQuant KV cache types (planar3, iso3) are not available in upstream llama.cpp, standard Ollama, or LM Studio. They require a specific llama.cpp fork. The GGUF file itself is a standard GGUF and works with any llama.cpp-compatible runtime using normal KV cache types (f16, q80, q40, etc.).

Hardware compatibility

DeviceVRAM / RAMRecommendation
CPU host with ≥12 GB RAM~12.3 GBworks via llama.cpp; slower than GPU but no accelerator required
Apple Silicon (Metal)~13.4 GBllama.cpp Metal backend; fast on M-series unified memory
NVIDIA GPU (partial offload)split between GPU + RAMoffload as many layers as VRAM allows; rest on CPU

Overview

This model combines two independent compression techniques:

TechniqueWhat it doesRequirement
GGUF Q2_K weight quantizationReduces model size from ~62 GB (BF16) to ~11.2 GBAny llama.cpp-compatible runtime
RotorQuant KV cache compression — block-diagonal Clifford-algebra rotors for 3-bit KV cache (--cache-type-k iso3 --cache-type-v iso3)Block-diagonal rotations / random rotation for compressed KV cachellama-cpp-turboquant fork only

Quickstart

llama.cpp / LM Studio / Ollama (upstream)

The GGUF works as a normal quantised model. For KV-cache savings use the upstream path described in the tip at the top of this card (-ctk q8_0 -ctv q8_0, or q4_0); no fork is required.

llama.cpp (upstream)

bash
llama-completion -no-cnv -m gemma-4-31B-RotorQuant-GGUF-Q2_K.gguf \
  --cache-type-k q8_0 --cache-type-v q8_0 \
  -ngl 99 -fa \
  -p "Explain quantum computing"

LM Studio

  1. 1.Download the GGUF file and load in LM Studio.
  2. 2.Enable Developer Mode (Settings → Developer).
  3. 3.In the model loader's advanced settings, set Flash Attention to ON.
  4. 4.Set K Cache Quantization and V Cache Quantization to q8_0 (or q4_0 for more aggressive VRAM savings).
  5. 5.Note: LM Studio does not currently support RotorQuant's iso3 cache types. Track this feature request for updates.

Ollama

bash
# Standard Ollama does not support RotorQuant cache types.
# Use with default or q8_0 KV cache via OLLAMA_KV_CACHE_TYPE=q8_0
OLLAMA_KV_CACHE_TYPE=q8_0 OLLAMA_FLASH_ATTENTION=1 ollama run majentik/gemma-4-31B-RotorQuant-GGUF-Q2_K

Specifications

PropertyValue
Base Modelgoogle/gemma-4-31B
ArchitectureDense transformer
Parameters31B (all active, dense)
Context Length128K
Weight QuantizationGGUF Q2_K (aggressive 2-bit, noticeable quality drop)
Original Size (BF16)~62 GB
Quantized File Size~11.2 GB
KV Cache (RotorQuant)3-bit via --cache-type-k iso3 --cache-type-v iso3 (fork only)
KV Cache (standard)q80, q40, f16, etc. (any llama.cpp runtime)
Licenseapache-2.0
ModalitiesText + Image (image-text-to-text)
Compatible Runtimesllama.cpp, LM Studio, Ollama, koboldcpp

About the RotorQuant / TurboQuant labels

RotorQuant and TurboQuant are this project's release labels, not distinct quantization algorithms — for any given tier, both brand repos carry byte-identical weights produced with the standard MLX / llama.cpp quantizers. No brand-specific speedup is claimed or measured. The KV-cache fork these labels originally referred to is legacy; for KV-cache memory savings use the upstream options described above (-ctk/-ctv q8_0, OLLAMA_KV_CACHE_TYPE).

Current Status of RotorQuant in the Ecosystem

RuntimeRotorQuant SupportStandard KV Quant
llama.cpp (upstream)❌ Not merged✅ q80, q40, q41, iq4nl, q50, q51
llama-cpp-turboquant fork✅ planar3, iso3✅ All standard types
LM Studio❌ Requested✅ Via advanced settings
Ollama❌ Not supported✅ Via OLLAMAKVCACHE_TYPE
koboldcpp❌ Not supported✅ Standard types

Recommended Settings

For VRAM-constrained setups, standard q8_0 KV cache quantization already halves KV cache memory with negligible quality impact. Flash Attention should always be enabled — it is required for V cache quantization and improves memory efficiency regardless.

VRAMSuggested Configuration
24 GB (RTX 4090)Q2K + q80 KV cache + Flash Attention, 8K–16K context
16 GBQ2K + q40 KV cache + Flash Attention, 4K–8K context
48+ GBQ2_K + f16 KV cache, full 32K+ context

See Also

Quant trade-off (GGUF lane)

QuantApprox sizeUse caseRecommendation
Q2_K~17 GBLossy, low-RAM CPU/edgeResource-constrained inference
Q3KM~19 GBSmaller-than-Q4, modest quality dropEdge devices with ~16 GB RAM
IQ4_XS~16 GBImportance-quant 4-bit, smaller than Q4KMBest size/quality at 4-bit
Q4KM~23 GBBalanced defaultRecommended for most users
Q5KM~24 GBHigher fidelity than Q4Quality-sensitive applications
Q6_K~28 GBApproaching FP16 qualityHigh-fidelity CPU/edge
Q8_0~32 GBNear-lossless referenceFidelity-critical work
MXFP4_MOE~17 GBMicroscaling FP4 (MoE-aware)vLLM / transformers users

(Current variant — Q2_K — is bolded.)

Variants in this family

(Showing 14 sibling variants under majentik/gemma-4-31b-*. The current variant — RotorQuant-GGUF-Q2_K — is bolded.)

VariantRuntimeApprox sizeUse case
RotorQuant-GGUF-IQ4_XSllama.cpp~27 GBLossy 4-bit, low-RAM CPU/edge
RotorQuant-GGUF-Q2_Kllama.cpp~19 GBLossy, low-RAM CPU/edge
RotorQuant-GGUF-Q3_K_Mllama.cpp~24 GBSmaller 3-bit, CPU-friendly
RotorQuant-GGUF-Q4_K_Mllama.cpp~34 GBBalanced default
RotorQuant-GGUF-Q5_K_Mllama.cpp~41 GBHigher fidelity, more RAM
RotorQuant-GGUF-Q8_0llama.cpp~65 GBNear-lossless reference
RotorQuant-MLX-2bitmlx-lm~9.9 GBApple Silicon, smallest
RotorQuant-MLX-4bitmlx-lm~19 GBApple Silicon balanced
RotorQuant-MLX-8bitmlx-lm~37 GBApple Silicon reference
TurboQuant-MLX-2bitmlx-lm~9.9 GBApple Silicon, smallest
TurboQuant-MLX-4bitmlx-lm~19 GBApple Silicon balanced
TurboQuant-MLX-8bitmlx-lm~37 GBApple Silicon reference