Gemma-4-E4B-it — GLQ 3.5 bpw (mixed 3–8)

GLQ (Golay–Leech Quantization) of google/gemma-4-E4B-it at 3.5 bpw param-weighted average, with sensitivity-driven mixed precision over the range 3–8 bpw. Layers are ranked by proxy loss; the most sensitive ones (typically k_proj, o_proj, per_layer_input_gate) get more bits; the bulk MLP layers (gate_proj, up_proj, down_proj) get 3 bpw.

Quick start

pip install glq "transformers>=5.13.1,<5.15"

Pin transformers below 5.15 — 5.15.0 moved gemma-4 to a per-layer config, so config.head_dim raises and vLLM dies before loading a single weight. Verified on 5.14.1 with vLLM 0.27.1. Not specific to GLQ: stock bf16 gemma-4 fails the same way.

import glq.hf_integration  # registers the GLQ quantization config
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "xv0y5ncu/Gemma-4-E4B-it-GLQ-3.5bpw-mix3-8",
    torch_dtype="bfloat16",
    device_map="cuda",
)
tokenizer = AutoTokenizer.from_pretrained("xv0y5ncu/Gemma-4-E4B-it-GLQ-3.5bpw-mix3-8")

vLLM (pip install vllm + pip install glq):

vllm serve xv0y5ncu/Gemma-4-E4B-it-GLQ-3.5bpw-mix3-8 --quantization glq

Quality vs other 3-bpw-class quants

mmlu_pro at 2% sample (n = 247), all generation with enable_thinking=true:

Variant bpw (param-weighted) acc stderr engine vs bf16
bf16 16.0 0.6640 0.0289 vLLM 100%
GLQ 3.5 mix 3–8 (this model) 3.50 0.5628 0.0310 vLLM 84.8%
GGUF Q3_K_S 3.89 0.4696 0.0300 llama.cpp 70.7%
GGUF UD-IQ3_XXS (calibrated) 3.75 0.4818 0.0295 llama.cpp 72.6%
GLQ uniform 3.0 3.00 0.4413 0.0311 vLLM 66.5%

At 3.5 bpw — lower than both GGUF Q3 variants — GLQ outperforms them by ~9pp thanks to sensitivity-driven bit allocation.

Bit allocation summary

Total quantized weights: 3,945,267,200
   3 bpw: 113 sublayers (2,941,255,680 weights, 74.6%)  — mostly mlp.{gate,up,down}_proj
   4 bpw:  41 sublayers (  525,598,720 weights, 13.3%)
   5 bpw:  35 sublayers (  200,540,160 weights,  5.1%)
   6 bpw:  32 sublayers (  110,755,840 weights,  2.8%)
   7 bpw:  72 sublayers (  121,896,960 weights,  3.1%)
   8 bpw:  49 sublayers (   45,219,840 weights,  1.1%)  — most sensitive: k_proj, per_layer_*

PLE embedding: 4 bpw (separate)
embed_tokens, lm_head, norms: bf16
Average SQNR: 21.77 dB

Quantization details

  • Method: E8 lattice codebook (65 536 entries) + RHT (random Hadamard transform) + LDLQ optimal rounding, with a 256-entry second-stage codebook for residual quantization (RVQ).
  • Calibration: 128 samples × 2048 tokens from C4.
  • Allocator: greedy marginal-gain over per-layer proxy losses, profiled at 3–8 bpw.
  • Quantizer: glq.quantize_model.
  • Hardware: NVIDIA RTX PRO 6000 Blackwell, 96 GB VRAM. Total quantization wall time: ~8 min (profile + allocate + quantize).

License

License: Apache 2.0 — see https://ai.google.dev/gemma/docs/gemma_4_license

Original model: https://huggingface.co/google/gemma-4-E4B-it

Derivative quantization work; the base Gemma 4 model and the GLQ tooling (https://github.com/cnygaard/glq) are both Apache 2.0. Quantizing the weights does not change the license.


🔗 GLQ on GitHub: https://github.com/cnygaard/glq — if you like it, a ⭐ is appreciated.

Downloads last month
13
Safetensors
Model size
3B params
Tensor type
F32
·
BF16
·
F16
·
I16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for xv0y5ncu/Gemma-4-E4B-it-GLQ-3.5bpw-mix3-8

Quantized
(338)
this model

Collections including xv0y5ncu/Gemma-4-E4B-it-GLQ-3.5bpw-mix3-8