gemma-4-31B ยท FP8 (dynamic)

8-bit quantization of google/gemma-4-31B (commit 5bbc2fb), produced for efficient vLLM serving. Quantized by axteam.

Base model google/gemma-4-31B (commit 5bbc2fb)
Method FP8 (dynamic)
Format compressed-tensors float-quantized (scheme FP8_DYNAMIC)
Weights / activations W8A8 โ€” FP8 E4M3 weights (per-output-channel scale), dynamic per-token FP8 activations
Architecture Gemma 4 ยท Dense
Size on disk ~33.3 GB
Calibration None (data-free static weight scales)
License Gemma 4 / Apache-2.0

Quantization details

  • Scheme โ€” W8A8 โ€” FP8 E4M3 weights (per-output-channel scale), dynamic per-token FP8 activations, stored as compressed-tensors float-quantized (scheme FP8_DYNAMIC).
  • 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 / processor_config / generation_config are byte-identical to the original. This is a base (pre-trained) model with no chat template โ€” use plain text completion, not chat. config.json is the original plus a quantization_config block.

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: FP8 dynamic โ€” a calibration-free PTQ (static per-channel weight scales + runtime per-token activation scales).

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 (this repo) AWQ-8bit NVFP4A16 NVFP4 AWQ-4bit
MMLU (5-shot, generative) 84.59 84.71 (100.1%) 84.52 (99.9%) 83.70 (98.9%) 83.09 (98.2%) 84.02 (99.3%)
GSM8K (5-shot, strict) 84.46 83.09 (98.4%) 84.23 (99.7%) 83.78 (99.2%) 82.03 (97.1%) 84.15 (99.6%)
ARC-Challenge (0-shot) 69.62 68.94 (99.0%) 69.11 (99.3%) 68.43 (98.3%) 67.49 (96.9%) 69.11 (99.3%)
Winogrande (5-shot) 83.90 84.29 (100.5%) 84.29 (100.5%) 84.45 (100.7%) 82.64 (98.5%) 83.58 (99.6%)
KMMLU (5-shot, direct) 67.35 67.22 (99.8%) 67.39 (100.1%) 66.41 (98.6%) 65.22 (96.8%) 67.33 (100.0%)
HAE-RAE (0-shot) 82.31 82.03 (99.7%) 82.03 (99.7%) 81.94 (99.6%) 80.29 (97.6%) 81.85 (99.4%)
Average 78.71 78.38 (99.6%) 78.60 (99.9%) 78.12 (99.3%) 76.79 (97.6%) 78.34 (99.5%)

Evaluation (measured)

Perplexity was measured against the BF16 original on public text โ€” the WikiText-2 test set (English) and a Korean Wikipedia sample, 2,048-token chunks. 8-bit builds (AWQ INT8, FP8) stayed within 0.5% of BF16; 4-bit builds (AWQ INT4, NVFP4) were 2.0โ€“6.6% higher (range across both base models and both 4-bit formats). Next-token top-1 agreement was not measured for the base models.

Requirements

Runtime vLLM โ€” the architecture is in vLLM โ‰ฅ 0.19.0; tested here with vLLM 0.32.0 (text input only โ€” the benchmarks above, run with image input disabled; image input not run for this build).
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, e.g. T4) or newer. FP8 math runs on Ada / Hopper / Blackwell (sm89+); on Turing and Ampere vLLM switches to weight-only FP8 automatically. V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.)
Memory Weights: 33.3 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-FP8-dynamic
from vllm import LLM, SamplingParams

llm = LLM(model="axteam/gemma-4-31B-FP8-dynamic")
params = SamplingParams(temperature=1.0, top_p=0.95, top_k=64, max_tokens=1024)
out = llm.generate("The three primary colors are", params)
print(out[0].outputs[0].text)

Recommended sampling (per Google): temperature=1.0, top_p=0.95, top_k=64.

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-FP8-dynamic --kv-cache-dtype fp8

--kv-cache-dtype accepts auto (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 and tokenizer belong to Google DeepMind.


ํ•œ๊ตญ์–ด ์š”์•ฝ

google/gemma-4-31B์˜ FP8 (W8A8) ์–‘์žํ™” ๋นŒ๋“œ ยท ์ œ์ž‘ axteam

๊ฐœ์š”

ํ•ญ๋ชฉ ๋‚ด์šฉ
์›๋ณธ ๋ชจ๋ธ google/gemma-4-31B (์ปค๋ฐ‹ 5bbc2fb)
์–‘์žํ™” ๋ฐฉ์‹ FP8 ๋™์  ์–‘์žํ™” (W8A8)
์ €์žฅ ํ˜•์‹ compressed-tensors float-quantized (scheme FP8_DYNAMIC)
๋ชจ๋ธ ๊ตฌ์กฐ Gemma 4 ยท Dense
์šฉ๋Ÿ‰ ์•ฝ 33.3 GB
๋ณด์ • ๋ฐ์ดํ„ฐ ์—†์Œ (๊ฐ€์ค‘์น˜ ์Šค์ผ€์ผ์€ ๊ฐ€์ค‘์น˜๋งŒ์œผ๋กœ ๊ณ„์‚ฐ, ํ™œ์„ฑํ™” ์Šค์ผ€์ผ์€ ์‹คํ–‰ ์‹œ ๊ณ„์‚ฐ)

์–‘์žํ™” ์ƒ์„ธ

  • ๊ฐ€์ค‘์น˜: FP8(E4M3), ์ถœ๋ ฅ ์ฑ„๋„๋ณ„ ์Šค์ผ€์ผ
  • ํ™œ์„ฑํ™”: ์‹คํ–‰ ์‹œ ํ† ํฐ๋ณ„ ๋™์  FP8
  • ์–‘์žํ™” ์ ˆ์ฐจ: PTQ(ํ•™์Šต ํ›„ ์–‘์žํ™”, ์žฌํ•™์Šต ์—†์Œ), ๊ฐ€์ค‘์น˜ ์Šค์ผ€์ผ์€ ๋ฏธ๋ฆฌ ๊ณ„์‚ฐํ•˜๊ณ  ํ™œ์„ฑํ™” ์Šค์ผ€์ผ์€ ์‹คํ–‰ ์‹œ ํ† ํฐ๋งˆ๋‹ค ๊ณ„์‚ฐ
  • BF16 ์œ ์ง€: ๋น„์ „ ํƒ€์›Œ, ๋น„์ „ ํˆฌ์˜์ธต, ํ† ํฐ ์ž„๋ฒ ๋”ฉ(LM ํ—ค๋“œ์™€ ๊ณต์œ ), ๋ชจ๋“  ์ •๊ทœํ™”์ธต โ€” ์ „์ฒด ํŒŒ๋ผ๋ฏธํ„ฐ์˜ ์•ฝ 6%
  • ์›๋ณธ ํŒŒ์ผ: ํ† ํฌ๋‚˜์ด์ €ยทprocessorยทgeneration config๋ฅผ ๋ฐ”์ดํŠธ ๋‹จ์œ„๋กœ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉ(์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์ด๋ผ chat template์€ ์—†์Œ), config.json์€ ์›๋ณธ์— quantization_config ๋ธ”๋ก๋งŒ ์ถ”๊ฐ€

ํ’ˆ์งˆ (์‹ค์ธก)

  • ๊ณต๊ฐœ ํ…์ŠคํŠธ PPL: WikiText-2(์˜์–ด)ยทํ•œ๊ตญ์–ด ์œ„ํ‚ค ํ‘œ๋ณธ, 2,048ํ† ํฐ ๋‹จ์œ„ โ€” 8๋น„ํŠธ(AWQ INT8ยทFP8)๋Š” ์›๋ณธ ๋Œ€๋น„ 0.5% ์ด๋‚ด, 4๋น„ํŠธ(AWQ INT4ยทNVFP4)๋Š” 2.0~6.6% ์ƒ์Šน (๋‘ base ๋ชจ๋ธยท๋‘ 4๋น„ํŠธ ํ˜•์‹์„ ํ•ฉ์นœ ๋ฒ”์œ„, top-1์€ ๋ฏธ์ธก์ •)
  • ๋ฒค์น˜๋งˆํฌ ํ‰๊ท : 78.38 (์›๋ณธ 78.71, 99.6%) โ€” MMLU(์ƒ์„ฑํ˜•)ยทGSM8KยทARC-ChallengeยทWinograndeยทKMMLUยทHAE-RAE 6์ข… ํ‰๊ท , lm-evaluation-harness + vLLM, chat template ์—†๋Š” ์™„์„ฑํ˜• ํ”„๋กฌํ”„ํŠธ(๊ณผ์ œ๋ณ„ 0ยท5-shot, ํ‘œ ์ฐธ๊ณ )ยทgreedy, ๋ชจ๋“  ๋นŒ๋“œ๋ฅผ ๊ฐ™์€ ์„ค์ •์œผ๋กœ ์ธก์ •
  • ํ•œ๊ตญ์–ด ๋ฒค์น˜๋งˆํฌ: KMMLU 67.22 (์›๋ณธ 67.35, 99.8%) ยท HAE-RAE 82.03 (์›๋ณธ 82.31, 99.7%)
  • MMLU ๋ฐฉ์‹: lm-eval ์ƒ์„ฑํ˜• ๋ณ€ํ˜•(mmlu_generative) โ€” ๋ชจ๋ธ์ด ๋‹ต ๊ธ€์ž๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ฒซ ์ค„์ด ์ •ํ™•ํžˆ ์ผ์น˜ํ•ด์•ผ ์ •๋‹ต์œผ๋กœ ์ฑ„์ ํ•˜๋ฏ€๋กœ, ๋‹ค๋ฅธ ๋ฐฉ์‹(์˜ˆ: log-likelihood ์ฑ„์ )์œผ๋กœ ์žฐ MMLU ์ ์ˆ˜์™€ ์ง์ ‘ ๋น„๊ต ๋ถˆ๊ฐ€

์š”๊ตฌ์‚ฌํ•ญ

  • ์‹คํ–‰ ์—”์ง„: vLLM 0.19.0 ์ด์ƒ(์ด ๊ตฌ์กฐ๋ฅผ ์ง€์›ํ•˜๋Š” ์ฒซ ๋ฒ„์ „), ์ด ๋นŒ๋“œ๋Š” vLLM 0.32.0์—์„œ ์‹คํ–‰ ํ™•์ธ (ํ…์ŠคํŠธ ์ž…๋ ฅ๋งŒ โ€” ์œ„ ๋ฒค์น˜๋งˆํฌ, ์ด๋ฏธ์ง€ ์ž…๋ ฅ์€ ๋„๊ณ  ์ธก์ •, ์ด ๋นŒ๋“œ์˜ ์ด๋ฏธ์ง€ ์ž…๋ ฅ์€ ์‹คํ–‰ ๋ฏธํ™•์ธ)
  • 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, ์˜ˆ: T4) ์ด์ƒ, V100(sm70) ๋ฏธ์ง€์› โ€” FP8 ์—ฐ์‚ฐ์€ AdaยทHopperยทBlackwell(sm89 ์ด์ƒ)์—์„œ ์ˆ˜ํ–‰, TuringยทAmpere๋Š” vLLM์ด ๊ฐ€์ค‘์น˜ ์ „์šฉ FP8๋กœ ์ž๋™ ์ „ํ™˜ (GPU๋ณ„ ์ง€์› ์—ฌ๋ถ€๋Š” vLLM 0.32 ์ปค๋„ ์„ ํƒ ์ฝ”๋“œ ๊ธฐ์ค€, ์‹ค์ œ ์‹คํ–‰์€ B200์—์„œ๋งŒ ํ™•์ธ)
  • ๋ฉ”๋ชจ๋ฆฌ: ๊ฐ€์ค‘์น˜ 33.3 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-FP8-dynamic
  • Python: LLM(model="axteam/gemma-4-31B-FP8-dynamic").generate(...) โ€” ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์ด๋ผ ๋Œ€ํ™”๊ฐ€ ์•„๋‹Œ ํ…์ŠคํŠธ ์ด์–ด์“ฐ๊ธฐ
  • ๊ถŒ์žฅ ์ƒ˜ํ”Œ๋ง: temperature=1.0, top_p=0.95, top_k=64 (Google ๊ถŒ์žฅ๊ฐ’)
  • KV ์บ์‹œ ์ ˆ๊ฐ(์„ ํƒ): vllm serve์— --kv-cache-dtype fp8 ์ถ”๊ฐ€ โ€” ๊ธฐ๋ณธ BF16์ธ KV ์บ์‹œ๋ฅผ FP8๋กœ ์ €์žฅํ•ด KV ์บ์‹œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์•ฝ ์ ˆ๋ฐ˜์œผ๋กœ ์ค„์ž„ (๊ธด ์ปจํ…์ŠคํŠธยท๋™์‹œ ์š”์ฒญ์ด ๋งŽ์„ ๋•Œ ์œ ๋ฆฌ, ๊ฐ€์ค‘์น˜ ์–‘์žํ™”์™€ ๋ณ„๊ฐœ์ธ ์‹คํ–‰ ์˜ต์…˜)

๋ผ์ด์„ ์Šค

  • ๋ผ์ด์„ ์Šค: Apache-2.0 (Gemma 4 ๋ผ์ด์„ ์Šค ์•ˆ๋‚ด) โ€” ์›๋ณธ ๋ชจ๋ธ์˜ ๋ผ์ด์„ ์Šค๋ฅผ ๊ทธ๋Œ€๋กœ ๋”ฐ๋ฆ„
  • ๊ถŒ๋ฆฌ: ์›๋ณธ ๊ฐ€์ค‘์น˜ยทํ† ํฌ๋‚˜์ด์ €๋Š” Google DeepMind ์†Œ์œ , ์ด ๋ฆฌํฌ๋Š” ์–‘์žํ™” ํŒŒ์ƒ๋ฌผ
Downloads last month
308
Safetensors
Model size
31B params
Tensor type
BF16
ยท
F8_E4M3
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for axteam/gemma-4-31B-FP8-dynamic

Quantized
(49)
this model

Collection including axteam/gemma-4-31B-FP8-dynamic