gemma-4-31B-it ยท AWQ INT4 (W4A16)
4-bit quantization of google/gemma-4-31B-it (commit 842da37), produced for efficient vLLM serving. Quantized by axteam.
| Base model | google/gemma-4-31B-it (commit 842da37) |
| Method | AWQ INT4 (W4A16) |
| Format | compressed-tensors pack-quantized |
| Weights / activations | W4A16 โ INT4 asymmetric weights, group size 32 (BF16 scale + INT4 zero-point), BF16 activations |
| Architecture | Gemma 4 ยท Dense |
| Size on disk | ~20.9 GB |
| Calibration | 256 samples (Korean-heavy; -it includes 32 self-generated thinking-mode answers) |
| License | Gemma 4 / Apache-2.0 |
Quantization details
- Scheme โ W4A16 โ INT4 asymmetric weights, group size 32 (BF16 scale + INT4 zero-point), BF16 activations, stored as compressed-tensors
pack-quantized. - Kept in BF16 โ vision tower, vision projection, token embeddings (tied with lm_head), and all norms. These stay unquantized to preserve quality โ about 6% of all parameters in this build.
- Tokenizer /
chat_template/processor_config/generation_configare byte-identical to the original, including Google's July-2026 correctedchat_template.config.jsonis the original plus aquantization_configblock.
Quantization method โ PTQ (AWQ / RTN) vs QAT
This model is a post-training quantization (PTQ): the released BF16 weights are quantized after training, with no retraining. How close each build stays to BF16 is reported in the measured sections where available.
- RTN (round-to-nearest) โ weights are simply rounded to the quantization grid with per-group scales; no calibration data. Fastest, but outliers aren't compensated, so 4-bit fidelity is the lowest. Not used for this model's AWQ-8bit, AWQ-4bit, NVFP4A16 and NVFP4 builds, which all apply AWQ (see each repo's
recipe.yaml). - AWQ (activation-aware weight quantization) โ a small calibration set finds the weight channels that multiply the largest activations; those salient channels are protected by per-channel scaling (the scale is folded into adjacent layers, e.g. LayerNorm โ q/k/v) before rounding. Still PTQ (no gradient, secondsโminutes), and far better than RTN at 4-bit.
- QAT (quantization-aware training) โ the model is fine-tuned with quantization simulated in the forward pass, so the weights adapt to quantization error via gradient descent. Best low-bit fidelity, but needs the full training stack, data and GPU hours. Google ships separate Gemma QAT checkpoints; this repo is not one of them.
Rough low-bit fidelity: QAT โฅ AWQ > RTN. Cost: QAT โซ AWQ > RTN. This build: AWQ โ a calibration-based PTQ (256-sample calibration, no gradient).
Benchmarks (measured)
Every column was measured with the same harness and settings โ lm-evaluation-harness on vLLM, greedy, completion-style prompts without a chat template (0- or 5-shot, as listed in each row). MMLU here is lm-eval's generative variant (mmlu_generative: the model writes the answer letter and only an exact match on the first line counts), so it is not directly comparable with MMLU scores measured another way (e.g. log-likelihood scoring). Percentages are recovery vs. the BF16 original.
| Benchmark | BF16 (original) | FP8-dynamic | AWQ-8bit | NVFP4A16 | NVFP4 | AWQ-4bit (this repo) |
|---|---|---|---|---|---|---|
| MMLU (5-shot, generative) | 56.46 | 56.07 (99.3%) | 56.41 (99.9%) | 58.32 (103.3%) | 58.51 (103.6%) | 57.12 (101.2%) |
| GSM8K (5-shot, strict) | 91.81 | 91.89 (100.1%) | 91.66 (99.8%) | 91.96 (100.2%) | 91.74 (99.9%) | 92.34 (100.6%) |
| ARC-Challenge (0-shot) | 57.59 | 58.36 (101.3%) | 57.68 (100.1%) | 57.76 (100.3%) | 56.91 (98.8%) | 57.17 (99.3%) |
| Winogrande (5-shot) | 66.22 | 66.14 (99.9%) | 65.82 (99.4%) | 65.59 (99.0%) | 64.96 (98.1%) | 66.77 (100.8%) |
| KMMLU (5-shot, direct) | 25.02 | 23.89 (95.5%) | 25.21 (100.8%) | 26.55 (106.1%) | 26.78 (107.0%) | 25.02 (100.0%) |
| HAE-RAE (0-shot) | 76.81 | 75.25 (98.0%) | 76.81 (100.0%) | 77.09 (100.4%) | 77.09 (100.4%) | 78.09 (101.7%) |
| Average | 62.32 | 61.93 (99.4%) | 62.27 (99.9%) | 62.88 (100.9%) | 62.66 (100.6%) | 62.75 (100.7%) |
| Average without KMMLU | 69.78 | 69.54 (99.7%) | 69.68 (99.9%) | 70.14 (100.5%) | 69.84 (100.1%) | 70.30 (100.7%) |
โ ๏ธ Note on KMMLU: with these completion-style prompts the BF16 original itself scores 25.02 on KMMLU, which is chance level for its 4-option questions (the base
gemma-4-31BBF16 scores 67.35 with the same harness and settings). Every quantized build lands between 23.89 and 26.78, so this row and its share of the Average do not reflect Korean ability or quantization loss. The second average leaves it out.
Evaluation (measured)
Measured against the BF16 original on an internal mixed English/Korean set. Quantization variant: AWQ attention + MLP (gate/up, upโdown).
| Metric | This model | BF16 original |
|---|---|---|
| Perplexity (lower is better) | 1.1754 | 1.1120 (+5.7%) |
| Top-1 next-token agreement | 94.3% | 99.4% |
These numbers measure fidelity to the base model, not absolute task scores.
Comparison with other public quantizations
Same eval set and harness for every row โ closer to the BF16 original is better.
| Model | Perplexity | Top-1 |
|---|---|---|
| BF16 original (upper bound) | 1.1120 | 99.4% |
This model (axteam) |
1.1754 | 94.3% |
| cyankiwi/gemma-4-31B-it-AWQ-4bit | 1.1759 | 94.4% |
On our harness this model is on par with or ahead of the public same-format quantizations above. It also ships Google's corrected July-2026 chat_template; some earlier community builds were based on the older template.
Requirements
| Runtime | vLLM โ the architecture is in vLLM โฅ 0.19.0; tested here with vLLM 0.32.0 (text: the benchmarks above; image: an image-description check on 2026-11-02). |
| vLLM install | vLLM 0.32 itself needs Python 3.11โ3.14, torch 2.13 (CUDA 13.0 build, so an NVIDIA driver with CUDA 13 support), transformers โฅ5.16.1,<5.20 and compressed-tensors 0.17.0 (both pinned by vLLM; 0.17.0 reads this checkpoint, which was saved with 0.19.0 โ do not upgrade it separately). |
| GPU | NVIDIA Turing (sm75) or newer โ weight-only INT, no special tensor cores needed. V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.) |
| Memory | Weights: 20.9 GB. Add KV cache (grows with context length ร concurrent requests) and a few GB for activations / CUDA graphs; use --tensor-parallel-size N when the weights do not fit one GPU. |
| Transformers (without vLLM) | transformers>=5.5.0 (5.5.2+ recommended; not run here for 31B). |
| trust_remote_code | not needed |
Usage (vLLM)
vllm serve axteam/gemma-4-31B-it-AWQ-4bit
from vllm import LLM, SamplingParams
llm = LLM(model="axteam/gemma-4-31B-it-AWQ-4bit")
params = SamplingParams(temperature=1.0, top_p=0.95, top_k=64, max_tokens=1024)
out = llm.chat(
[{"role": "user", "content": "Write a short joke about saving RAM."}],
params,
)
print(out[0].outputs[0].text)
Recommended sampling (per Google):
temperature=1.0,top_p=0.95,top_k=64. Thinking mode is off by default; turn it on withchat_template_kwargs={"enable_thinking": True}(Pythonllm.chat(..., chat_template_kwargs=...)or the request body), and add--reasoning-parser gemma4tovllm serveto return the reasoning separately.
Reducing KV-cache memory (optional, serve-time)
The KV cache is unquantized (BF16) here โ the standard for quantized checkpoints (RedHatAI, NVIDIA, etc. ship the same way). KV-cache precision is a runtime choice, independent of the weight quantization above. For long context or large batches you can roughly halve KV-cache memory with FP8:
vllm serve axteam/gemma-4-31B-it-AWQ-4bit --kv-cache-dtype fp8
--kv-cache-dtypeacceptsauto(default, BF16),fp8/fp8_e4m3,fp8_e5m2. For a GGUF build the llama.cpp equivalent is--cache-type-k q8_0 --cache-type-v q8_0.
License
This is a quantized derivative of Google's Gemma 4. Use is governed by the Gemma 4 license. All original weights, tokenizer, and chat template belong to Google DeepMind.
ํ๊ตญ์ด ์์ฝ
google/gemma-4-31B-it์ AWQ INT4 (W4A16) ์์ํ ๋น๋ ยท ์ ์ axteam
๊ฐ์
| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| ์๋ณธ ๋ชจ๋ธ | google/gemma-4-31B-it (์ปค๋ฐ 842da37) |
| ์์ํ ๋ฐฉ์ | AWQ INT4 (W4A16) |
| ์ ์ฅ ํ์ | compressed-tensors pack-quantized |
| ๋ชจ๋ธ ๊ตฌ์กฐ | Gemma 4 ยท Dense |
| ์ฉ๋ | ์ฝ 20.9 GB |
| ๋ณด์ ๋ฐ์ดํฐ | ์ํ 256๊ฐ (ํ๊ตญ์ด ์์ฃผ, ์๋ณธ ๋ชจ๋ธ์ด ์ค์ค๋ก ์์ฑํ thinking ๋ชจ๋ ๋ต๋ณ 32๊ฐ ํฌํจ) |
์์ํ ์์ธ
- ๊ฐ์ค์น: INT4 ๋น๋์นญ, ๊ทธ๋ฃน ํฌ๊ธฐ 32 (BF16 ์ค์ผ์ผ + INT4 ์์ )
- ํ์ฑํ: BF16 (์์ํํ์ง ์์)
- ์์ํ ์ ์ฐจ: PTQ(ํ์ต ํ ์์ํ, ์ฌํ์ต ์์), AWQ ๋ฐฉ์ โ ๋ณด์ ๋ฐ์ดํฐ๋ก ํ์ฑํ๊ฐ ํฐ ๊ฐ์ค์น ์ฑ๋์ ์ฐพ์ ์ฑ๋๋ณ ์ค์ผ์ผ๋ก ๋ณดํธํ ๋ค INT4๋ก ๋ฐ์ฌ๋ฆผ
- AWQ ์ ์ฉ ๋ฒ์: ์ดํ ์ ์ ๋ ฅยทMLP(gate/up, upโdown)
- BF16 ์ ์ง: ๋น์ ํ์, ๋น์ ํฌ์์ธต, ํ ํฐ ์๋ฒ ๋ฉ(LM ํค๋์ ๊ณต์ ), ๋ชจ๋ ์ ๊ทํ์ธต โ ์ ์ฒด ํ๋ผ๋ฏธํฐ์ ์ฝ 6%
- ์๋ณธ ํ์ผ: ํ ํฌ๋์ด์ ยทchat template(Google์ 2026๋
7์ ์์ ๋ณธ)ยทprocessorยทgeneration config๋ฅผ ๋ฐ์ดํธ ๋จ์๋ก ๊ทธ๋๋ก ์ฌ์ฉ,
config.json์ ์๋ณธ์quantization_config๋ธ๋ก๋ง ์ถ๊ฐ
ํ์ง (์ค์ธก)
- ์๋ณธ ๋๋น ์ถฉ์ค๋: PPL 1.1754 (์๋ณธ 1.1120, +5.7%, ๋ฎ์์๋ก ์๋ณธ์ ๊ฐ๊น์), ๋ค์ ํ ํฐ top-1 ์ผ์น์จ 94.3% (์๋ณธ ์์ฒด ๊ธฐ์ค๊ฐ 99.4%) โ ๋ด๋ถ ์์ดยทํ๊ตญ์ด ํผํฉ ํ๊ฐ์ , ์๋ณธ(BF16)๊ณผ ๋น๊ต ์ธก์
- ๋ค๋ฅธ ๊ณต๊ฐ ๋น๋์ ๋น๊ต: ๊ฐ์ ํ์์ cyankiwi/gemma-4-31B-it-AWQ-4bit PPL 1.1759 ยท top-1 94.4%, ์ด ๋น๋ PPL 1.1754 ยท top-1 94.3% (๊ฐ์ ํ๊ฐ์ ยท๊ฐ์ ํ๊ฐ ์ฝ๋) โ ์ด ๋น๋๊ฐ ๋๋ฑ ์ด์, Google์ 2026๋ 7์ ์์ chat template ํฌํจ (์ผ๋ถ ์ด์ ์ปค๋ฎค๋ํฐ ๋น๋๋ ์์ ์ ํ ํ๋ฆฟ ๊ธฐ๋ฐ)
- ๋ฒค์น๋งํฌ ํ๊ท : 62.75 (์๋ณธ 62.32, 100.7%) โ MMLU(์์ฑํ)ยทGSM8KยทARC-ChallengeยทWinograndeยทKMMLUยทHAE-RAE 6์ข ํ๊ท , lm-evaluation-harness + vLLM, chat template ์๋ ์์ฑํ ํ๋กฌํํธ(๊ณผ์ ๋ณ 0ยท5-shot, ํ ์ฐธ๊ณ )ยทgreedy, ๋ชจ๋ ๋น๋๋ฅผ ๊ฐ์ ์ค์ ์ผ๋ก ์ธก์
- KMMLU ์ ์ธ ํ๊ท : 70.30 (์๋ณธ 69.78, 100.7%) โ ๋๋จธ์ง 5์ข ํ๊ท
- ํ๊ตญ์ด ๋ฒค์น๋งํฌ: HAE-RAE 78.09 (์๋ณธ 76.81, 101.7%) โ KMMLU๋ ์๋ณธ(BF16)๋ถํฐ 25.02๋ก 4์ง์ ๋ค ์ฐ๊ธฐ ์์ค(๊ฐ์ ํ๊ฐ ๋ฐฉ์์์ base gemma-4-31B๋ 67.35)์ด๋ผ ๋ชจ๋ ์์ํ ๋น๋๊ฐ 23.89~26.78์ ๋จธ๋ฌผ๋ฌ ํ๊ตญ์ด ๋ฅ๋ ฅยท์์ํ ์์ค์ ๋ํ๋ด์ง ์์
- MMLU ๋ฐฉ์: lm-eval ์์ฑํ ๋ณํ(
mmlu_generative) โ ๋ชจ๋ธ์ด ๋ต ๊ธ์๋ฅผ ์์ฑํ๊ณ ์ฒซ ์ค์ด ์ ํํ ์ผ์นํด์ผ ์ ๋ต์ผ๋ก ์ฑ์ ํ๋ฏ๋ก, ๋ค๋ฅธ ๋ฐฉ์(์: log-likelihood ์ฑ์ )์ผ๋ก ์ฐ MMLU ์ ์์ ์ง์ ๋น๊ต ๋ถ๊ฐ
์๊ตฌ์ฌํญ
- ์คํ ์์ง: vLLM 0.19.0 ์ด์(์ด ๊ตฌ์กฐ๋ฅผ ์ง์ํ๋ ์ฒซ ๋ฒ์ ), ์ด ๋น๋๋ vLLM 0.32.0์์ ์คํ ํ์ธ (ํ ์คํธ โ ์ ๋ฒค์น๋งํฌ, ์ด๋ฏธ์ง โ 2026-11-02 ๊ทธ๋ฆผ ์ค๋ช ์ ๊ฒ)
- vLLM 0.32 ์ค์น ์กฐ๊ฑด: Python 3.11~3.14, torch 2.13(CUDA 13.0 ๋น๋, CUDA 13 ์ง์ ๋๋ผ์ด๋ฒ ํ์), transformers 5.16.1 ์ด์ 5.20 ๋ฏธ๋ง, compressed-tensors 0.17.0 โ transformersยทcompressed-tensors๋ vLLM์ด ๋ฒ์ ์ ๊ณ ์ ํ๋ฏ๋ก compressed-tensors๋ฅผ ๋ฐ๋ก ์ ๊ทธ๋ ์ด๋ํ์ง ๋ง ๊ฒ (์ด ์ฒดํฌํฌ์ธํธ๋ 0.19.0์ผ๋ก ์ ์ฅ๋์ง๋ง 0.17.0์์๋ ๋ก๋๋จ)
- GPU: NVIDIA Turing(sm75) ์ด์, V100(sm70) ๋ฏธ์ง์ โ ๊ฐ์ค์น ์ ์ฉ ์ ์ ํ์์ด๋ผ FP8ยทFP4 ์ ์ฉ ํ ์์ฝ์ด ๋ถํ์ (GPU๋ณ ์ง์ ์ฌ๋ถ๋ vLLM 0.32 ์ปค๋ ์ ํ ์ฝ๋ ๊ธฐ์ค, ์ค์ ์คํ์ B200์์๋ง ํ์ธ)
- ๋ฉ๋ชจ๋ฆฌ: ๊ฐ์ค์น 20.9 GB + KV ์บ์(์ปจํ
์คํธ ๊ธธ์ด ร ๋์ ์์ฒญ ์์ ๋น๋ก) + ํ์ฑํยทCUDA graph์ฉ ์ GB โ GPU ํ ์ฅ์ ๋ค ๋ค์ด๊ฐ์ง ์์ผ๋ฉด
--tensor-parallel-size N์ผ๋ก ๋ถ์ฐ - Transformers๋ก ์ง์ ์ฌ์ฉ: transformers 5.5.0 ์ด์ (5.5.2 ์ด์ ๊ถ์ฅ) โ ์ด ๋ชจ๋ธ์ Transformers๋ก ์ง์ ์คํํด ๋ณด์ง ์์
- trust_remote_code: ๋ถํ์
์ฌ์ฉ๋ฒ
- ์๋ฒ ์คํ:
vllm serve axteam/gemma-4-31B-it-AWQ-4bit - Python:
LLM(model="axteam/gemma-4-31B-it-AWQ-4bit").chat(...)โ ์ ์ฒด ์์๋ ์ ์์ด ๋ณธ๋ฌธ 'Usage (vLLM)' ์ ์ฐธ๊ณ - ๊ถ์ฅ ์ํ๋ง:
temperature=1.0,top_p=0.95,top_k=64(Google ๊ถ์ฅ๊ฐ) - thinking ๋ชจ๋: ๊ธฐ๋ณธ ๊บผ์ง โ ์ผ๋ ค๋ฉด
chat_template_kwargs={"enable_thinking": True}์ ๋ฌ(Python์llm.chat()์ธ์, HTTP๋ ์์ฒญ ๋ณธ๋ฌธ์"chat_template_kwargs": {"enable_thinking": true}), ์ถ๋ก ๊ณผ์ ์ ๋ต๋ณ๊ณผ ๋ถ๋ฆฌํด ๋ฐ์ผ๋ ค๋ฉดvllm serve์--reasoning-parser gemma4์ถ๊ฐ - KV ์บ์ ์ ๊ฐ(์ ํ):
vllm serve์--kv-cache-dtype fp8์ถ๊ฐ โ ๊ธฐ๋ณธ BF16์ธ KV ์บ์๋ฅผ FP8๋ก ์ ์ฅํด KV ์บ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฝ ์ ๋ฐ์ผ๋ก ์ค์ (๊ธด ์ปจํ ์คํธยท๋์ ์์ฒญ์ด ๋ง์ ๋ ์ ๋ฆฌ, ๊ฐ์ค์น ์์ํ์ ๋ณ๊ฐ์ธ ์คํ ์ต์ )
๋ผ์ด์ ์ค
- ๋ผ์ด์ ์ค: Apache-2.0 (Gemma 4 ๋ผ์ด์ ์ค ์๋ด) โ ์๋ณธ ๋ชจ๋ธ์ ๋ผ์ด์ ์ค๋ฅผ ๊ทธ๋๋ก ๋ฐ๋ฆ
- ๊ถ๋ฆฌ: ์๋ณธ ๊ฐ์ค์นยทํ ํฌ๋์ด์ ยทchat template์ Google DeepMind ์์ , ์ด ๋ฆฌํฌ๋ ์์ํ ํ์๋ฌผ