SAVRN
Search Contact SAVRN

Open-weight model · Any to any

gemma-4-12B-it-FP8-Dynamic

by Red Hat AI RedHatAI/gemma-4-12B-it-FP8-Dynamic

FP8-dynamic quantized variant of gemma-4-12B-it.

Parameters13B
Context262,144
Weights15.0 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads435k

Runs On

What it takes to serve gemma-4-12B-it-FP8-Dynamic (13B parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 25.9 GB 31.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 13.0 GB 15.6 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 6.5 GB 7.8 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By Red Hat AI, published under apache-2.0, revision 2083adceb2a3.

FP8-dynamic quantized variant of gemma-4-12B-it.

Read Red Hat AI's full model card

FP8 Quantized RedHatAI/gemma-4-12B-it-FP8

This is a preliminary version (and subject to change) of FP8_Dynamic quantized google/gemma-4-12B-it model. The model has both weights and activations quantized to FP8_Dynamic format with vllm-project/llm-compressor.

It is compatible and tested against vllm nightly.

Creation Script

Run this script with this LLM Compressor PR and latest transformers to quantize the model using iMatrix quantization

import torch
from compressed_tensors.offload import dispatch_model
from compressed_tensors.quantization import preset_name_to_scheme
from datasets import load_dataset
from transformers import AutoModelForImageTextToText, AutoProcessor

from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import QuantizationModifier
from llmcompressor.modifiers.transform.imatrix import IMatrixGatherer

MODEL_ID = "google/gemma-4-12B-it"
model = AutoModelForImageTextToText.from_pretrained(MODEL_ID, dtype="auto")
processor = AutoProcessor.from_pretrained(MODEL_ID)

DATASET_ID = "neuralmagic/calibration"
NUM_CALIBRATION_SAMPLES = 256
MAX_SEQUENCE_LENGTH = 2048

ds = load_dataset(DATASET_ID, name="LLM", split=f"train[:{NUM_CALIBRATION_SAMPLES}]")


def preprocess_function(example):
    messages = []
    for message in example["messages"]:
        messages.append(
            {
                "role": message["role"],
                "content": [{"type": "text", "text": message["content"]}],
            }
        )

    return processor.apply_chat_template(
        messages,
        return_tensors="pt",
        padding=False,
        truncation=True,
        max_length=MAX_SEQUENCE_LENGTH,
        tokenize=True,
        add_special_tokens=False,
        return_dict=True,
        add_generation_prompt=False,
    )


ds = ds.map(preprocess_function, batched=False, remove_columns=ds.column_names)


def data_collator(batch):
    assert len(batch) == 1
    return {
        key: (
            torch.tensor(value)
            if key != "pixel_values"
            else torch.tensor(value, dtype=torch.bfloat16).squeeze(0)
        )
        for key, value in batch[0].items()
    }


scheme = preset_name_to_scheme("FP8_DYNAMIC", ["Linear"])
scheme.weights.observer = "imatrix_mse"

recipe = [
    IMatrixGatherer(
        ignore=[
            "lm_head",
            "re:.*embed_vision.*",
            "re:.*embed_audio.*",
            "re:.*vision_embedder.*",
        ],
    ),
    QuantizationModifier(
        config_groups={"group_0": scheme},
        ignore=[
            "lm_head",
            "re:.*embed_vision.*",
            "re:.*embed_audio.*",
            "re:.*vision_embedder.*",
        ],
    ),
]

oneshot(
    model=model,
    recipe=recipe,
    dataset=ds,
    max_seq_length=MAX_SEQUENCE_LENGTH,
    num_calibration_samples=NUM_CALIBRATION_SAMPLES,
    data_collator=data_collator,
)

print("\n\n")
print("========== SAMPLE GENERATION ==============")
dispatch_model(model)
input_ids = torch.tensor(
    [[
        2, 105, 2364, 107, 818, 3282, 506, 7217, 563, 3730, 563,
        1547, 106, 107, 105, 4368, 107
    ]]
).to(model.device)
output = model.generate(
    input_ids,
    max_new_tokens=100,
)
print(processor.tokenizer.decode(output[0]))
print("==========================================\n\n")

SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-FP8_Dynamic-iMatrix"
model.save_pretrained(SAVE_DIR, save_compressed=True)
processor.save_pretrained(SAVE_DIR)

# Patch config: transformers renames checkpoint keys on load (vision_embedder ->
# embed_vision), but save_pretrained reverts them. The ignore list in config.json
# uses HF names (embed_vision) while safetensors keys use checkpoint names
# (vision_embedder), so vllm can't match them. Add the checkpoint name explicitly.
import json as _json
_cfg_path = SAVE_DIR + "/config.json"
with open(_cfg_path) as _f:
    _cfg = _json.load(_f)
_qcfg = _cfg.get("quantization_config")
if _qcfg:
    _ign = _qcfg.setdefault("ignore", [])
    if "model.vision_embedder.patch_dense" not in _ign:
        _ign.append("model.vision_embedder.patch_dense")
        with open(_cfg_path, "w") as _f:
            _json.dump(_cfg, _f, indent=2)
        print("Patched config.json: added vision_embedder.patch_dense to ignore list")


Preliminary Evaluations

1) GSM8K Platinum 2) Wikitext PPL

lm_eval --model vllm \
  --model_args "pretrained=RedHatAI/gemma-4-12B-it-FP8_Dynamic,dtype=auto,max_model_len=$MAX_MODEL_LEN,add_bos_token=True,gpu_memory_utilization=0.85" \
  --tasks gsm8k_platinum --num_fewshot 5 --apply_chat_template --batch_size auto

lm_eval --model vllm \
  --model_args "pretrained=RedHatAI/gemma-4-12B-it-FP8_Dynamic,dtype=auto,max_model_len=$MAX_MODEL_LEN,add_bos_token=True,gpu_memory_utilization=0.85" \
  --tasks wikitext --num_fewshot 0 --apply_chat_template --batch_size auto

Evals: | model_name | flexible-extract | strict-match | bits_per_byte | byte_ppl | |---------------|------------------|--------------|---------------|----------| | baseline-bf16 | 0.9082 | 0.8958 | 1.9125 | 3.7645 | | FP8-RTN | 0.9115 | 0.8999 | 1.9368 | 3.8285 | | FP8-iMatrix | 0.9198 | 0.9032 | 1.9056 | 3.7465 | | FP8-GPTQ | 0.9098 | 0.8950 | 1.9357 | 3.8257 |

Recovery | model_name | flexible-extract | strict-match | bits_per_byte | byte_ppl | |---|---|---|---|---| | FP8-iMatrix | 100.17% | 100.83% | 100.36% | 100.48% |

Configuration

Architecture
Gemma4UnifiedForConditionalGeneration
Context length (tokens)
262,144
Layers
48
Hidden size
3,840
Feed-forward size
15,360
Attention heads
16
Key/value heads
8
Head dimension
256
Vocabulary size
262,144
Sliding window (tokens)
1,024
Model type
gemma4_unified
Quantization
compressed-tensors

Identity and Version

Repository
RedHatAI/gemma-4-12B-it-FP8-Dynamic
Publisher
Red Hat AI
Task
Any to any
Modality
Multimodal
Library
transformers
Parameters
13B parameters
Languages
Not stated by the source
Revision
2083adceb2a3df0465e6021e08a7196d21dbbb44
First published
2026-06-08
Last updated
2026-09-15

Files and Weights

10 files, 15.1 GB in total. The weights are 1 file totalling 15.0 GB in safetensors.

Weights1 file · 15.0 GB
Configuration4 files · 8.7 KB
Tokenizer2 files · 32.2 MB
Documentation1 file · 6.5 KB
Other1 file · 18.7 KB
Repository1 file · 1.6 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights15.0 GB 6b2564e7b716
config.jsonConfiguration5.8 KB
generation_config.jsonConfiguration255 B
processor_config.jsonConfiguration1.4 KB
recipe.yamlConfiguration1.2 KB
README.mdDocumentation6.5 KB
chat_template.jinjaOther18.7 KB
.gitattributesRepository1.6 KB
tokenizer.jsonTokenizer32.2 MB cc8d3a0ce364
tokenizer_config.jsonTokenizer2.7 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
15.0 GB
Download from Red Hat AI

Released by Red Hat AI through its official repository on Hugging Face. Read the license.

Built From

Memory Requirements

PrecisionWeights in memory
As published15.0 GB
16-bit25.9 GB
8-bit13.0 GB
4-bit6.5 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About gemma-4-12B-it-FP8-Dynamic

How much GPU memory does gemma-4-12B-it-FP8-Dynamic need?

About 31.1 GB at 16-bit and 7.8 GB at 4-bit: the weights (13B parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run gemma-4-12B-it-FP8-Dynamic on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use gemma-4-12B-it-FP8-Dynamic commercially?

Yes. gemma-4-12B-it-FP8-Dynamic is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

What is gemma-4-12B-it-FP8-Dynamic's context length?

262,144 tokens, from the maximum position embeddings in its published configuration.

Similar Models

Model · Any to any

gemma-4-12B-it-AWQ-INT4

Cyankiwi

Gemma is a family of open models built by Google DeepMind. Gemma 4 models are multimodal, handling text and image input (with audio supported on E2B, E4B, and 12B) and generating text output. This release includes open-weights models in both pre-trained and instruction-tuned variants. Gemma 4 features a context window of up to 256K tokens and maintains multilingual support in over 140 languages. Featuring both Dense and Mixture-of-Experts (MoE) architectures, Gemma 4 is well-suited for tasks like text generation, coding, and reasoning. The models are available in five distinct sizes: E2B, E4B, 12B, 26B A4B, and 31B. Their diverse sizes make them deployable in environments ranging from…

Open weights apache-2.0 12.6B parameters 131,072 tokens transformers

Gemma is a family of open models built by Google DeepMind. Gemma 4 models are multimodal, handling text and image input (with audio supported on E2B, E4B, and 12B) and generating text output. This release includes open-weights models in both pre-trained and instruction-tuned variants. Gemma 4 features a context window of up to 256K tokens and maintains multilingual support in over 140 languages. Featuring both Dense and Mixture-of-Experts (MoE) architectures, Gemma 4 is well-suited for tasks like text generation, coding, and reasoning. The models are available in five distinct sizes: E2B, E4B, 12B, 26B A4B, and 31B. Their diverse sizes make them deployable in environments ranging from…

Open weights apache-2.0 12.6B parameters 131,072 tokens transformers

Model · Any to any

gemma-4-12B-it-qat-w4a16-ct

Google

Gemma is a family of open models built by Google DeepMind. Gemma 4 models are multimodal, handling text and image input (with audio supported on E2B, E4B, and 12B) and generating text output. This release includes open-weights models in both pre-trained and instruction-tuned variants. Gemma 4 features a context window of up to 256K tokens and maintains multilingual support in over 140 languages. Featuring both Dense and Mixture-of-Experts (MoE) architectures, Gemma 4 is well-suited for tasks like text generation, coding, and reasoning. The models are available in five distinct sizes: E2B, E4B, 12B, 26B A4B, and 31B. Their diverse sizes make them deployable in environments ranging from…

Open weights apache-2.0 13.3B parameters 262,144 tokens transformers

Model · Any to any

gemma-4-12B-it-FP8-dynamic

Thor Lin

Self-quantized FP8 (dynamic) of google/gemma-4-12B-it — Google's encoder-free omni model (text + image + audio + video). Quantized and benchmarked on an NVIDIA DGX Spark (GB10, sm121a). TL;DR: 13 GB on disk (from 23 GB BF16), 15.9 tok/s on a GB10 via vLLM, all four modalities intact. Data-free — no calibration needed. If you want the smallest + fastest build, see the sibling NVFP4 weight-only repo. FP8 is the conservative choice (dynamic activations, no calibration, widest kernel support). I scored all three formats on MMLU (English, 57 subjects) and TMMLU+ (Traditional Chinese, 66 subjects) with lm-evaluation-harness, 5-shot, chat template applied, limit=30 (N ≈ 1,710 EN / 1,980 TC, ±~1.0…

Open weights apache-2.0 12B parameters 131,072 tokens transformers

Model · Any to any

gemma-4-12B-it

Google

Gemma is a family of open models built by Google DeepMind. Gemma 4 models are multimodal, handling text and image input (with audio supported on E2B, E4B, and 12B) and generating text output. This release includes open-weights models in both pre-trained and instruction-tuned variants. Gemma 4 features a context window of up to 256K tokens and maintains multilingual support in over 140 languages. Featuring both Dense and Mixture-of-Experts (MoE) architectures, Gemma 4 is well-suited for tasks like text generation, coding, and reasoning. The models are available in five distinct sizes: E2B, E4B, 12B, 26B A4B, and 31B. Their diverse sizes make them deployable in environments ranging from…

Open weights apache-2.0 12B parameters 262,144 tokens transformers

LM Studio Community models highlights program. Highlighting new & noteworthy models by the community. Join the conversation on Discord. 4-bit quantized version of gemma-4-12B-it using MLX, optimized for Apple Silicon. Special thanks to the Apple Machine Learning Research team for creating MLX. LM Studio is not the creator, originator, or owner of any Model featured in the Community Model Program. Each Community Model is created and provided by third parties. LM Studio does not endorse, support, represent or guarantee the completeness, truthfulness, accuracy, or reliability of any Community Model. You understand that Community Models can produce content that might be offensive, harmful…

Open weights apache-2.0 12B parameters 262,144 tokens transformers