Sponsored by
Vmake Labs Video Enhancer
-Vmake Labs Video Enhancer uses AI to improve video quality, restore details, reduce blur, and upscale videos to 8K.
Developed by AxionML for open-source serving and deployment use cases. Part of AxionML's effort to provide ready-to-serve quantized models for the community.
This is an
FP8-quantized
version of
google/gemma-4-12B-it
(11.95B params), using
per-block 128×128 weight-only FP8 (E4M3)
with an FP8 KV-cache, MSE-calibrated. Activations are kept in BF16 — this is deliberate: gemma-4's attention activations carry large per-channel outliers, so quantizing activations (per-tensor W8A8) measurably degrades the model. Quantizing only the weights is lossless on GSM8K (0.9666 vs 0.9636 BF16) while halving the weight footprint (~24 GB → ~13 GB). Serves on Hopper (H100/H200) and Blackwell.
Quantization Details
This model was quantized by applying
per-block (128×128) FP8 (E4M3) to the weights
of the linear operators within the transformer blocks.
Activations are kept in BF16
(weight-only). The
KV-cache is quantized to FP8 (E4M3)
.
lm_head
and the multimodal (vision/audio) embedders are kept in their original BF16 precision.
Hopper (H100/H200, sm_90) and Blackwell (sm_100/103/120)
Usage
Deploy with SGLang
Requires the SGLang branch in
SGLang support
below (
fp8_pb_wo
block-FP8 support + Blackwell UE8M0 scale requant + transformers≥5.10 multimodal name handling for Gemma-4).
Multi-Token Prediction with the paired
google/gemma-4-12B-it-assistant
draft
works on this quantized target with the SGLang branch below. Use the
Triton
attention backend and load the draft
unquantized
:
MTP is lossless on GSM8K (see
Accuracy
). Earlier SGLang mis-loaded
ModelOpt's attention-projection scales (
self_attn.{k,v}_proj.{k,v}_scale
) as
the RadixAttention KV-cache scales, which corrupted the spec-decode verify
forward on quantized targets (degenerate output) while BF16 targets were fine.
The branch fix leaves gemma-4's KV scales at their identity default (1.0) —
correct, because gemma-4 writes K/V to the cache
after
q/k-norm and RoPE, so
the projection-output scales are the wrong descale factor. (The related
trtllm_mha SWA-pool crash,
sgl-project/sglang#26957
,
is already fixed on main.)
Sampling defaults for Gemma 4:
temperature=1.0, top_p=0.95, top_k=64
. Thinking mode is off by default; enable with
extra_body={"chat_template_kwargs": {"enable_thinking": True}}
.
(
--weight_calib_algorithm mse
is a small local addition to ModelOpt's
hf_ptq.py
that overrides the qformat's weight calibration to MSE;
fp8_pb_wo
's stock algorithm is
max
.)
About FP8
FP8 (E4M3 — 4 exponent bits, 3 mantissa bits, range ±448) stores each weight in a single byte.
fp8_pb_wo
("per-block weight-only") quantizes weights in
2D 128×128 blocks
, each with its own FP8 scale, and
does not quantize activations
— at runtime the block-scaled FP8 weights drive a block GEMM (DeepGEMM on Blackwell, with UE8M0 scale requant) against BF16 activations. Per-block scaling adapts to local weight magnitude far better than a single per-tensor scale, and
MSE calibration
sweeps each block's scale to minimize ‖W − dequant(quant(W))‖² instead of taking max-of-abs. The KV-cache is additionally stored in FP8 (E4M3) to halve KV memory.
Why weight-only on Gemma-4:
standard per-tensor
W8A8
FP8 (quantized activations, as NVIDIA ships for Llama/Nemotron) degrades sharply on gemma-4 — its attention residual stream has persistent per-channel activation outliers that a single per-tensor activation scale crushes, even within FP8's ±448 range. Leaving activations in BF16 (weight-only) sidesteps this entirely and is lossless.
About NVFP4 (sister checkpoint)
A companion
AxionML/Gemma-4-12B-NVFP4
ships a 4-bit variant following NVIDIA's dense-Gemma-4 recipe (
nvidia/Gemma-4-31B-IT-NVFP4
):
NVFP4 (E2M1 + FP8 16-element micro-block scales) on the MLP/FFN, attention kept BF16
, FP8 KV-cache, MSE-calibrated. NVFP4 requires Blackwell (native FP4 Tensor Cores); serve it with
--quantization modelopt_fp4
.
Accuracy
GSM8K (1319 questions,
sgl-eval
, greedy, served on SGLang):
Model
GSM8K
google/gemma-4-12B-it
(BF16)
0.9636
AxionML/Gemma-4-12B-FP8
(weight-only, MSE)
0.9666
AxionML/Gemma-4-12B-FP8 + MTP
(NEXTN)
0.9598
AxionML/Gemma-4-12B-NVFP4 (MLP-only, MSE)
0.9612
AxionML/Gemma-4-12B-NVFP4 + MTP (NEXTN)
0.9644
MTP (greedy, exact verify) is lossless within GSM8K run-to-run noise — accuracy holds
with and without
speculative decoding.
Performance (SPEED-Bench)
Latency/throughput measured with
NVIDIA AIPerf
on the
nvidia/SPEED-Bench
qualitative
split (all 11 domains, 880 prompts each issued once,
shuffle
/ seed 42), greedy, output capped at 512 tokens, OpenAI
chat
+ streaming, one Blackwell GPU, served on the SGLang branch below. Prompts are short (ISL ≈ 145, OSL ≈ 410 tokens). MTP uses the
google/gemma-4-12B-it-assistant
NEXTN draft.
Concurrency 1 — single-stream latency
(the low-latency serving regime):
Config
TTFT (ms)
ITL (ms)
tok/s/user
accept len
gemma-4-12B-it
BF16
19.4
6.47
154.6
—
FP8
28.7
5.91
169.3
—
FP8 + MTP
27.5
3.09
338.2
3.50
FP8 vs BF16:
1.10×
single-stream tokens/s (memory-bandwidth-bound — the 13 GB weight footprint wins; quant adds a little TTFT).
MTP on FP8:
2.00×
tokens/s, ITL
1.91×
lower (accept length 3.50 of 6 draft tokens).
FP8 + MTP vs BF16 baseline: ≈ 2.19×
single-stream tokens/s.
At saturation the GPU is compute-bound, so the
fp8_pb_wo
block-GEMM (with dequant) doesn't beat BF16 dense GEMM on aggregate throughput (0.90×), and MTP is roughly neutral (0.96×).
Takeaway:
FP8 — especially with MTP — pays off most in the
low-concurrency / latency-bound
regime; at saturation, throughput is comparable across formats.
SGLang support
Gemma 4 (including the encoder-free unified 12B) is supported on SGLang main. Serving this
fp8_pb_wo
checkpoint additionally needs the branch below, which adds: (1)
fp8_pb_wo
per-block weight-only FP8 to the ModelOpt FP8 path (the stock path is per-tensor only) plus Blackwell UE8M0 scale requant for the DeepGEMM block kernel; (2) remap of the
embed_vision.*
multimodal weight names emitted by a transformers≥5.10 ModelOpt re-export. It also fixes speculative decoding (NEXTN/MTP) on quantized targets: SGLang must
not
load ModelOpt's attention-projection scales (
self_attn.{k,v}_proj.{k,v}_scale
) as the RadixAttention KV-cache
{k,v}_scale
— gemma-4 caches K/V post-norm/post-RoPE, so those are the wrong descale factor and corrupt the spec verify forward; the KV scales correctly default to 1.0.
# Editable install of the branch
git clone https://github.com/bzhng-development/sglang.git
cd sglang && git checkout gemma4-modelopt-ptq
pip install -e python
# transformers with Gemma 4 (encoder-free unified) support
pip install 'git+https://github.com/huggingface/transformers.git@1423d22f7a3b62e8c70ad67b58ec25cd9b675897'
Serving needs the
SGLang branch
, so base it on a recent
SGLang nightly
image (
lmsysorg/sglang:nightly-dev-YYYYMMDD-<hash>
;
cu13
variants exist for CUDA-13 hosts). The nightly already installs SGLang as an
editable
install rooted at
/sgl-workspace/sglang
, so the command below simply swaps that directory for the branch checkout — no reinstall needed — then pins the matching transformers, fetches the checkpoint, and starts the server, which will then be
listening at
http://0.0.0.0:30000
(change
--port
to use a different port):
--network=host
publishes the server on the host's port 30000; alternatively drop it and use
-p 30000:30000
.
For
MTP / NEXTN
, append the speculative flags from the
Speculative decoding
section above to the
launch_server
line (
HF_TOKEN
is then required — the draft
google/gemma-4-12B-it-assistant
is gated).
The leading
cd /
matters: the image's default workdir
is
/sgl-workspace/sglang
, so
rm -rf
-ing it from inside that directory makes
git
fail with
"Unable to read current working directory."
Any newer
lmsysorg/sglang:nightly-dev-*
tag also works — each ships the same editable
/sgl-workspace/sglang
layout this relies on.
libnvidia-ml.so:
you
may or may not
need to mount the host NVML library — only if
nvidia-smi
inside the container reports a driver/library version mismatch. If so, add a mount matching your host driver (e.g.
580.82.07
):
The base model was trained on data that may contain toxic language and societal biases. The quantized model inherits these limitations and may generate inaccurate, biased, or offensive content. Quantization can introduce additional deviations from the base model's behavior. Please refer to the
original model card
for full details.
Base model
google/gemma-4-12B-it
is Google DeepMind's dense 11.95B-parameter Gemma 4 "Unified" (encoder-free) multimodal instruction-tuned model: text + image (+ audio) input, 256K context, hybrid sliding-window/global attention, configurable thinking mode, and native function calling. See the upstream card for full architecture, training data, evaluation, and responsible-AI details. This repository changes only the numeric precision of the weights — all capabilities, the chat template, and the tokenizer are inherited unchanged.
Runs of AxionML Gemma-4-12B-FP8 on huggingface.co
2.1K
Total runs
-6
24-hour runs
29
3-day runs
-18
7-day runs
1.1K
30-day runs
More Information About Gemma-4-12B-FP8 huggingface.co Model
Gemma-4-12B-FP8 huggingface.co is an AI model on huggingface.co that provides Gemma-4-12B-FP8's model effect (), which can be used instantly with this AxionML Gemma-4-12B-FP8 model. huggingface.co supports a free trial of the Gemma-4-12B-FP8 model, and also provides paid use of the Gemma-4-12B-FP8. Support call Gemma-4-12B-FP8 model through api, including Node.js, Python, http.
Gemma-4-12B-FP8 huggingface.co is an online trial and call api platform, which integrates Gemma-4-12B-FP8's modeling effects, including api services, and provides a free online trial of Gemma-4-12B-FP8, you can try Gemma-4-12B-FP8 online for free by clicking the link below.
AxionML Gemma-4-12B-FP8 online free url in huggingface.co:
Gemma-4-12B-FP8 is an open source model from GitHub that offers a free installation service, and any user can find Gemma-4-12B-FP8 on GitHub to install. At the same time, huggingface.co provides the effect of Gemma-4-12B-FP8 install, users can directly use Gemma-4-12B-FP8 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.