gemma-4-12B-it Β· NVFP4 (W4A4, FP4)

4-bit quantization of google/gemma-4-12B-it, produced for efficient vLLM serving. Quantized by axteam.

Base model google/gemma-4-12B-it
Method NVFP4 (W4A4, FP4)
Format compressed-tensors nvfp4-pack-quantized
Weights / activations W4A4 β€” FP4 (E2M1) weights group 16 (FP8 E4M3 scale + per-tensor FP32 global scale), FP4 activations
Architecture Gemma 4 Β· Dense
Size on disk ~7.7 GB
Calibration 256 samples (Korean-heavy; -it includes 32 self-generated thinking-mode answers)
License Gemma 4 / Apache-2.0

Quantization details

  • Scheme β€” W4A4 β€” FP4 (E2M1) weights group 16 (FP8 E4M3 scale + per-tensor FP32 global scale), FP4 activations, stored as compressed-tensors nvfp4-pack-quantized.
  • Kept in BF16 β€” vision tower, vision projection, token embeddings (tied with lm_head), MoE router, and all norms. These are left unquantized to preserve quality (a small fraction of total parameters).
  • Tokenizer / chat_template / processor_config / generation_config are byte-identical to the original, including Google's July-2026 corrected chat_template. 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, so it stays faithful to the original model's behaviour.

  • 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. Used only as an internal baseline here, not published.
  • 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).

Evaluation (measured)

Measured against the BF16 original on an internal mixed English/Korean set. Quantization variant: AWQ attention + MLP(gate/up).

Metric This model BF16 original
Perplexity (lower is better) 1.4465 1.1488 (+25.9%)
Top-1 next-token agreement 87.4% 99.2%

These numbers measure fidelity to the base model, not absolute task scores.

Usage (vLLM)

vllm serve axteam/gemma-4-12B-it-NVFP4
from vllm import LLM, SamplingParams

llm = LLM(model="axteam/gemma-4-12B-it-NVFP4")
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. This is a Blackwell-only format β€” it needs FP4 tensor cores (B200, RTX PRO) for full speed.

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-12B-it-NVFP4 --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, tokenizer, and chat template belong to Google DeepMind.


ν•œκ΅­μ–΄ μš”μ•½

google/gemma-4-12B-it λ₯Ό NVFP4 (W4A4, FP4) 둜 μ–‘μžν™”ν•œ μ„œλΉ™μš©(4-bit) λͺ¨λΈμž…λ‹ˆλ‹€. μž‘μ„±: axteam.

  • 방식 β€” κ°€μ€‘μΉ˜Β·ν™œμ„±ν™” λͺ¨λ‘ FP4(W4A4). Blackwell(B200 λ“±) FP4 ν…μ„œμ½”μ–΄μ—μ„œ 제 속도. ν™œμ„±ν™”λ„ FP4라 ν’ˆμ§ˆ 손싀이 κ°€μž₯ 큼 β€” ν’ˆμ§ˆ μš°μ„ μ΄λ©΄ NVFP4A16 ꢌμž₯. ν˜•μ‹μ€ compressed-tensors nvfp4-pack-quantized.
  • BF16 μœ μ§€ β€” λΉ„μ „ νƒ€μ›ŒΒ·λΉ„μ „ νˆ¬μ˜Β·ν† ν° μž„λ² λ”©(lm_head와 λ¬Άμž„)Β·MoE λΌμš°ν„°Β·λ…Έλ¦„ (μ „μ²΄μ˜ 극히 일뢀).
  • ν† ν¬λ‚˜μ΄μ €Β·chat_templateΒ·processorΒ·generation_config λŠ” 원본과 λ°”μ΄νŠΈκΉŒμ§€ 동일 (ꡬ글이 2026-07에 고친 chat_template κ·ΈλŒ€λ‘œ). config.json 은 원본 + quantization_config.
  • μ–‘μžν™” 방식(PTQ vs QAT) β€” ν•™μŠ΅ ν›„(PTQ) 방식이라 μž¬ν•™μŠ΅ 없이 원본 κ°€μ€‘μΉ˜λ₯Ό μ €λΉ„νŠΈλ‘œ λ°”κΏ‰λ‹ˆλ‹€. RTN=보정 없이 반올림만(κ°€μž₯ λΉ λ₯΄λ‚˜ μ΄μƒμΉ˜ 보상이 μ•ˆ 돼 4λΉ„νŠΈ ν’ˆμ§ˆ μ΅œμ €, λ‚΄λΆ€ κΈ°μ€€μš©Β·λΉ„κ³΅κ°œ) Β· AWQ=μ†ŒλŸ‰ λ³΄μ •μœΌλ‘œ 큰 ν™œμ„±ν™”μ™€ κ³±ν•΄μ§€λŠ” μ€‘μš” 채널을 채널 μŠ€μΌ€μΌλ‘œ λ³΄ν˜Έν•œ λ’€ 반올림(경사 μ—†μŒ, 4λΉ„νŠΈμ„œ RTN보닀 훨씬 μ’‹μŒ) Β· QAT=μ–‘μžν™”λ₯Ό 흉내 λ‚΄λ©° μž¬ν•™μŠ΅ν•΄ κ°€μ€‘μΉ˜κ°€ μ˜€μ°¨μ— 적응(μ €λΉ„νŠΈ μ΅œμƒμ΄λ‚˜ ν•™μŠ΅ μŠ€νƒΒ·λ°μ΄ν„°Β·GPU ν•„μš”, ꡬ글 Gemma QAT μ²΄ν¬ν¬μΈνŠΈλŠ” 별도 β€” λ³Έ λ ˆν¬λŠ” QAT μ•„λ‹˜). μ €λΉ„νŠΈ ν’ˆμ§ˆ β‰ˆ QAT β‰₯ AWQ > RTN. λ³Έ λΉŒλ“œ: AWQ β€” 보정 기반 PTQ(256λ¬Έν•­ 보정, 경사 μ—†μŒ).
  • ν’ˆμ§ˆ(μ‹€μΈ‘) β€” BF16 원본 λŒ€λΉ„ perplexity 1.4465(원본 1.1488, +25.9%), top-1 μΌμΉ˜λ„ 87.4%(원본 99.2%). λ‚΄λΆ€ 영/ν•œ ν‰κ°€μ…‹μ—μ„œ μΈ‘μ •. λ³€ν˜•: AWQ attention + MLP(gate/up).
  • μ‚¬μš© β€” vllm serve axteam/gemma-4-12B-it-NVFP4. ꢌμž₯ μƒ˜ν”Œλ§ temperature=1.0, top_p=0.95, top_k=64.
  • KV μΊμ‹œ 절감(선택, μ„œλΉ™ μ‹œ) β€” 기본은 BF16 KV(μ–‘μžν™” 체크포인트 ν‘œμ€€, RedHatΒ·NVIDIA 동일). κ°€μ€‘μΉ˜ μ–‘μžν™”μ™€ λ¬΄κ΄€ν•œ λŸ°νƒ€μž„ 선택. κΈ΄ λ¬Έλ§₯Β·λŒ€λ°°μΉ˜μ—μ„  vllm serve … --kv-cache-dtype fp8 둜 KV λ©”λͺ¨λ¦¬ 절반. (GGUF라면 llama.cpp --cache-type-k q8_0 --cache-type-v q8_0)
  • λΌμ΄μ„ μŠ€ β€” ꡬ글 Gemma 4 νŒŒμƒλ¬Ό. Gemma 4 λΌμ΄μ„ μŠ€ 적용. 원본 κ°€μ€‘μΉ˜Β·ν† ν¬λ‚˜μ΄μ €Β·chat_template κΆŒλ¦¬λŠ” Google DeepMind.
Downloads last month
155
Safetensors
Model size
12B params
Tensor type
BF16
Β·
U8
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for axteam/gemma-4-12B-it-NVFP4

Quantized
(391)
this model

Collection including axteam/gemma-4-12B-it-NVFP4