v0 — quantization artifact, no engine-side verification yet.
This release contains the NVFP4 (W4A4) quantization of
google/gemma-4-12B-it produced with NVIDIA Model Optimizer.
The artifact is complete and self-consistent; we have not
yet verified a full inference-engine run end-to-end on this
checkpoint (see "Engine support" below). A v0.1 follow-up
will ship with throughput, latency, and wikitext-2
perplexity numbers once the engine side is wired up.
Engine support (status as of 2026-06-03)
Engine
Status
transformers (≥ dev main)
Loads the BF16 base model. Cannot load NVFP4 packed weights (uint8 FP4).
vLLM (≥ 0.22.0)
Blocked: Gemma4UnifiedForConditionalGeneration is not in vLLM's model registry; it falls back to TransformersMultiModalForCausalLM which crashes inside flashinfer_scaled_fp4_mm with a 3D→2D activation shape mismatch. We are working on a custom registry registration.
SGLang (dev image)
Blocked: same registry gap as vLLM, plus a deeper issue — SGLang's Gemma4DecoderLayer does not match the 12B Unified's full-attention layer shape (head_dim=512, no v_proj because attention_k_eq_v=True).
TensorRT-LLM
Not yet evaluated.
llama.cpp / GGUF
Not yet evaluated.
Practical advice right now: if you want to use this
checkpoint, the cleanest path is to load it in
transformers (dev main) and dequantize the FP4 weights to
BF16 yourself, then run inference. This loses the speed
benefit of FP4 but lets you validate the model. A v0.1
follow-up will publish a working engine path.
Credits and Attribution
This checkpoint was produced by r0b0tlab
(@mr-r0b0t on X). It is derived work built on top of the
following projects, models, datasets, and tools — all of which
deserve direct credit:
Base model
google/gemma-4-12B-it
— Google DeepMind. The Gemma 4 12B Unified
instruction-tuned multimodal model. The architecture is
Gemma4UnifiedForConditionalGeneration, a 48-layer dense
11.96B-parameter model with hybrid sliding-window + global
attention, raw-patch image and raw-waveform audio
projection, and 256K context.
Quantization tool
NVIDIA Model Optimizer
(formerly TensorRT Model Optimizer). The PTQ (post-training
quantization) library used to convert the BF16 weights and
activations to NVFP4. Version used: 0.44.0.
The library is part of NVIDIA's inference optimization
stack and is integrated with vLLM, SGLang, TensorRT-LLM,
and the Megatron training frameworks.
Calibration data
abisee/cnn_dailymail
— Abigail See, Peter J. Liu, Christopher D. Manning. Get To
The Point: Summarization with Pointer-Generator Networks.
arXiv:1704.04368, 2017. ~300,000 unique English news
articles from CNN and the Daily Mail. Licensed under
Apache 2.0. This is the de-facto standard calibration set
for NVIDIA's NVFP4 checkpoints (used for
nvidia/Gemma-4-31B-IT-NVFP4
and most other NVIDIA-published NVFP4 models).
Prior art (the patterns we adapted)
bg-digitalservices/quantize_gemma4_moe.py
— the quantization script that this work adapts. The 6-step
pipeline (load → apply exclusion → calibrate → quantize →
export → copy auxiliary files) is borrowed directly. The
MoE plugin classes are removed because the 12B Unified is
dense (no MoE). The multimodal exclusion pattern is the
intellectual seed of the exclusion list below.
vLLM — the
target inference engine. vLLM 0.22.0+ natively supports
modelopt_fp4 quantization via --quantization modelopt_fp4.
We are working on a custom model registration for
Gemma4UnifiedForConditionalGeneration.
Model loading and multimodal processor
Hugging Face transformers
(≥ 5.10.0.dev0) — the loader for
Gemma4UnifiedForConditionalGeneration via
AutoModelForImageTextToText and the multimodal processor
via AutoProcessor.
Quantization format
NVFP4 — NVIDIA's 4-bit floating-point format designed
for FP4 weights with FP8 E4M3 per-block scales and a
FP32 per-tensor global scale. Specified in
hf_quant_config.json as quant_algo: NVFP4.
ModelOpt's default config also excludes norms, biases, and
the vocab embedding; the three lines above are the
modelopt-specific additions.
Calibration details
Calibration set:abisee/cnn_dailymail (3.0.0)
Number of samples: 512 (text-only forward pass)
Sequence length: 1,024 tokens
Batch size: 4
Forward loop:model(input_ids=batch) only
Why text-only calibration: the multimodal pipeline
(vision embedder + projection, audio projection) is
excluded from quantization, so the calibration data does
not need to be multimodal. This is the same approach used
by all NVIDIA-published NVFP4 checkpoints.
We have not run a full PPL or benchmark comparison in
this v0 release. The expected behaviour based on NVIDIA's
publicly published NVFP4 model cards (e.g.
nvidia/Gemma-4-31B-IT-NVFP4, which reports 0.2–0.4pp loss
across GPQA Diamond, AIME 2025, MMLU Pro, LiveCodeBench,
Scicode, and Terminal-Bench Hard) is that NVFP4 retains
99% of BF16 accuracy. The 12B Unified is a different
architecture than the 31B, so we do not claim parity; a
wikitext-2 PPL comparison and a small multimodal smoke test
are planned for v0.1.
How to use
With transformers (for direct use / research)
python
1import torch
2from transformers import AutoModelForImageTextToText, AutoProcessor
34model_id ="r0b0tlab/gemma-4-12B-it-nvfp4"5model = AutoModelForImageTextToText.from_pretrained(6 model_id, dtype=torch.bfloat16, device_map="auto")7processor = AutoProcessor.from_pretrained(model_id)89# Text10msgs =[{"role":"user","content":[{"type":"text",11"text":"What is the capital of France?"}]}]12inputs = processor.apply_chat_template(13 msgs, tokenize=True, return_dict=True, return_tensors="pt",14 add_generation_prompt=True).to(model.device)15output = model.generate(**inputs, max_new_tokens=64, do_sample=False)16print(processor.decode(output[0][inputs.input_ids.shape[-1]:],17 skip_special_tokens=True))
Caveat: this loads the BF16 base architecture. Loading
the NVFP4 packed weights requires an engine with FP4
support. See "Engine support" above.
With vLLM (planned, not yet working)
bash
1# The command we expect to work once the engine is fixed:2vllm serve r0b0tlab/gemma-4-12B-it-nvfp4 \3 --quantization modelopt_fp4 \4 --tensor-parallel-size 1\5 --max-model-len 65536\6 --gpu-memory-utilization 0.85
Engine support is incomplete. See the status table at
the top of this card. v0 ships the quantization artifact
only; v0.1 will ship with a working engine path and
benchmark numbers.
Multimodal sub-modules are preserved in BF16. The
vision embedder (~35M), vision projection (~15M), and
audio projection (~2.5M) are not quantized. This is a
conservative choice; quantizing them would save < 100 MB
and we judged the numerical risk of degrading multimodal
understanding unacceptable.
Calibration is text-only. Following the NVIDIA NVFP4
standard, the calibration forward loop is text-only.
No fine-tuning was performed. This is a pure PTQ
(post-training quantization) checkpoint; no QAT
(quantization-aware training) or LoRA adapters are
included.
Hardware requirements. NVFP4 requires an NVIDIA GPU
with native FP4 tensor-core execution. On GPUs without
native FP4, the engine will fall back to an emulation
backend which is significantly slower.
How to cite this model
bibtex
1@misc{r0b0tlab_gemma4_12b_nvfp4_2026,
2 title={Gemma 4 12B IT NVFP4 (r0b0tlab native optimization, v0)},
3 author={r0b0tlab},
4 year={2026},
5 howpublished={Hugging Face},
6 note={NVFP4 quantization of google/gemma-4-12B-it via NVIDIA Model Optimizer v0.44.0},
7 url={https://huggingface.co/r0b0tlab/gemma-4-12B-it-nvfp4}
8}
910@misc{google_gemma4_12b_2026,
11 title={Gemma 4 12B (Unified)},
12 author={Google DeepMind},
13 year={2026},
14 howpublished={Hugging Face},
15 url={https://huggingface.co/google/gemma-4-12B}
16}
1718@software{nvidia_modelopt_2026,
19 title={TensorRT Model Optimizer},
20 author={NVIDIA},
21 year={2026},
22 url={https://github.com/NVIDIA/TensorRT-Model-Optimizer}
23}
2425@misc{cnn_dailymail_2017,
26 title={Get To The Point: Summarization with Pointer-Generator Networks},
27 author={Abigail See and Peter J. Liu and Christopher D. Manning},
28 year={2017},
29 eprint={1704.04368},
30 archivePrefix={arXiv},
31 url={https://arxiv.org/abs/1704.04368}
32}