Hugging Face | GitHub | Launch Blog | Documentation
License: Apache 2.0 | Authors: Google DeepMind

Gemma 4-E2B

This is a custom quantized version of the Gemma 4-E2B model, quantized to Q4_0 with custom OVERRIDE file. It is designed to achieve fast inference on Qualcomm Hexagon NPU while maintaining adequate accuracy.

how model is generated

Built with llama.cpp commit 7c158fb.

Three steps, run from the repo root.

Step 1 — download the unquantized HF model

hf download google/gemma-4-E2B-it-qat-q4_0-unquantized --local-dir ./hf-model

Step 2 — convert HF → F16 GGUF

convert_hf_to_gguf.py ./hf-model --outfile model-f16.gguf --outtype f16

Step 3 — follow the OVERRIDE file and quantize to Q4_0

build/bin/llama-quantize --tensor-type-file <override-file> \
    model-f16.gguf model-q4_0-override.gguf q4_0

Performance Measurement Commands

CPU uses --device none -ngl 0; HTP uses --device HTP0 -ngl 99. For each (model, backend, CTX ∈ {512, 1024, 4096}) two llama-bench runs were issued — one for prefill, one for decode:

# environment on device
export LD_LIBRARY_PATH=./lib
export ADSP_LIBRARY_PATH=./lib

# Prefill (Prefill tok/s; TTFT = CTX / Prefill × 1000)
./bin/llama-bench --device <none|HTP0> -m <model.gguf> \
  --poll 1000 -t 6 --cpu-mask 0xfc --cpu-strict 1 --ubatch-size 1024 -fa on \
  -ngl <0|99> -p <CTX> -n 0

# Decode at depth = CTX (Decode tok/s)
./bin/llama-bench --device <none|HTP0> -m <model.gguf> \
  --poll 1000 -t 6 --cpu-mask 0xfc --cpu-strict 1 --ubatch-size 1024 -fa on \
  -ngl <0|99> -p 0 -n 128 -d <CTX>

Performance Metrics

Performance on IQ9 (QCS9075M)

Compute CTX Unsloth PTQ GGUF Google QAT GGUF Ours
CPU 512 82.2 / 22.25 107.2 / 22.51 98.9 / 23.78
CPU 1024 76.6 / 21.65 97.8 / 21.94 90.8 / 23.16
CPU 4096 61.3 / 18.09 76.5 / 18.26 72.3 / 19.10
HTP 512 273.2 / 19.22 582.5 / 16.40 582.4 / 18.33
HTP 1024 266.9 / 18.93 552.3 / 16.45 552.2 / 18.17
HTP 4096 254.9 / 18.30 502.5 / 15.87 501.8 / 17.53

Accuracy Metrics

The MMLU-Pro is measured:

Subject Unsloth PTQ GGUF Google QAT GGUF Ours
mmlu_pro 0.4084 0.4178 0.4131
biology 0.6248 ± 0.0181 0.6262 0.6248 ± 0.0181
business 0.4956 ± 0.0178 0.5019 0.4740 ± 0.0178
chemistry 0.3021 ± 0.0137 0.3127 0.3004 ± 0.0136
computer_science 0.4683 ± 0.0247 0.4854 0.4683 ± 0.0247
economics 0.4538 ± 0.0171 0.4976 0.4431 ± 0.0171
engineering 0.2859 ± 0.0145 0.3375 0.2931 ± 0.0146
health 0.3961 ± 0.0171 0.3423 0.3985 ± 0.0171
history 0.2730 ± 0.0229 0.2310 0.3097 ± 0.0237
law 0.2416 ± 0.0129 0.2289 0.2480 ± 0.0130
math 0.6366 ± 0.0131 0.6366 0.6373 ± 0.0131
other 0.3561 ± 0.0158 0.3528 0.3431 ± 0.0156
philosophy 0.3387 ± 0.0212 0.3848 0.3487 ± 0.0214
physics 0.3580 ± 0.0133 0.4003 0.3926 ± 0.0136
psychology 0.4875 ± 0.0177 0.5113 0.5013 ± 0.0177

License

Apache 2.0

Downloads last month
3,370
GGUF
Model size
5B 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 zackliqcom/gemma4-E2B-Q40-custom

Quantized
(33)
this model