Downloads · 30 days
459K
4% of all-time downloads
RedHatAI/gemma-4-31B-it-FP8-block
gemma-4-31B-it-FP8-block is a image-text-to-text model from RedHatAI. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
<h1 align: center; style="display: flex; align-items: center; gap: 10px; margin: 0;" gemma-4-31B-it-FP8-block <img src="https://www.redhat.com/rhdc/managed-files/Catalog-Validatedmodel0.png" alt="Model Icon" width="40…
Downloads · 30 days
459K
4% of all-time downloads
All-time downloads
10.6M
Public
Parameters
31.3B
33.3 GB on disk
Likes
51
Trending 2
Click a slice to open those files.
.safetensors33.3 GB · 100%
How the weights are stored.
F8_E4M329.3B · 94%
From the Hugging Face model README
This model is a quantized version of google/gemma-4-31B-it. It was evaluated on several tasks to assess its quality in comparison to the unquantized model.
This model was obtained by quantizing the weights and activations of google/gemma-4-31B-it to FP8 data type, ready for inference with vLLM. This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%.
Weights are quantized using block-wise FP8 scaling (128×128 blocks), and activations are quantized dynamically per group (group_size=128). Only the weights and activations of the linear operators within transformer blocks are quantized using LLM Compressor. Vision tower, embedding, and output head layers are kept in their original precision.
This model can be deployed using vLLM. For detailed instructions including multi-GPU deployment, multimodal inference, thinking mode, function calling, and benchmarking, see the Gemma 4 vLLM usage guide.
vllm serve RedHatAI/gemma-4-31B-it-FP8-block \
--tensor-parallel-size 2 \
--max-model-len 32768 \
--gpu-memory-utilization 0.90 \
--enable-auto-tool-choice \
--reasoning-parser gemma4 \
--tool-call-parser gemma4 \
--chat-template examples/tool_chat_template_gemma4.jinja \
--limit-mm-per-prompt '{"image": 4, "audio": 1}' \
--async-scheduling
Tip: For text-only workloads, pass
--limit-mm-per-prompt '{"image": 0, "audio": 0}'to skip vision encoder memory allocation and free up GPU memory for a longer context window.
from openai import OpenAI
openai_api_key = "EMPTY"
openai_api_base = "http://<your-server-host>:8000/v1"
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
model = "RedHatAI/gemma-4-31B-it-FP8-block"
messages = [
{"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
]
outputs = client.chat.completions.create(
model=model,
messages=messages,
extra_body={"chat_template_kwargs": {"enable_thinking": True}},
)
generated_text = outputs.choices[0].message.content
print(generated_text)
This model was created by applying data-free FP8 block quantization with LLM Compressor, as presented in the code snippet below.
<details>from llmcompressor import model_free_ptq
MODEL_ID = "google/gemma-4-31B-it"
SAVE_DIR = MODEL_ID.split("/")[1] + "-FP8-block"
model_free_ptq(
model_stub=MODEL_ID,
save_directory=SAVE_DIR,
scheme="FP8_BLOCK",
ignore=["re:.*vision.*", "lm_head", "re:.*embed_tokens.*"],
max_workers=8,
device="cuda:0",
)
</details>
This model was evaluated on GSM8K Platinum, MMLU-Pro, IFEval, MATH-500, AIME 2025, GPQA Diamond, LiveCodeBench v6, and BFCLv4 (function calling) using lm-evaluation-harness, lighteval, and BFCL — all served with vLLM (OpenAI-compatible API). Accuracy results are reported both without and with thinking enabled; BFCLv4 was evaluated with thinking enabled. LiveCodeBench v6 was evaluated without thinking only.
The results were obtained using the following commands:
<details>Each benchmark was run 3 times with different random seeds (1234, 2345, 3456) and the scores were averaged; AIME 2025 used 8 seeds.
vLLM server (with thinking):
vllm serve RedHatAI/gemma-4-31B-it-FP8-block \
--served-model-name gemma-4-31b-it-FP8-block \
--max-model-len 32768 \
--gpu-memory-utilization 0.90 \
--language-model-only \
--enable-auto-tool-choice \
--reasoning-parser gemma4 \
--tool-call-parser gemma4 \
--chat-template examples/tool_chat_template_gemma4.jinja \
--async-scheduling \
--default-chat-template-kwargs '{"enable_thinking": true}'
Note: To reproduce the results without thinking, remove
--default-chat-template-kwargs '{"enable_thinking": true}'. To run without tool calling, remove--enable-auto-tool-choice,--tool-call-parser gemma4, and--reasoning-parser gemma4.
lm_eval --model local-chat-completions \
--tasks gsm8k_platinum_cot_llama \
--model_args "model=gemma-4-31b-it-FP8-block,max_length=32768,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
--num_fewshot 0 \
--apply_chat_template \
--output_path results_gsm8k_platinum.json \
--seed 1234 \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=1234"
lm_eval --model local-chat-completions \
--tasks mmlu_pro_chat \
--model_args "model=gemma-4-31b-it-FP8-block,max_length=32768,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
--num_fewshot 0 \
--apply_chat_template \
--output_path results_mmlu_pro.json \
--seed 1234 \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=1234"
lm_eval --model local-chat-completions \
--tasks ifeval \
--model_args "model=gemma-4-31b-it-FP8-block,max_length=32768,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
--num_fewshot 0 \
--apply_chat_template \
--output_path results_ifeval.json \
--seed 1234 \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=1234"
litellm_config.yaml:
model_parameters:
provider: hosted_vllm
model_name: hosted_vllm/gemma-4-31b-it-FP8-block
base_url: http://0.0.0.0:8000/v1
api_key: ''
timeout: 3600
concurrent_requests: 32
generation_parameters:
temperature: 1.0
max_new_tokens: 65536
top_p: 0.95
top_k: 64
seed: 1234
Run once per seed (changing seed in the config each time):
lighteval endpoint litellm litellm_config.yaml 'math_500|0' \
--output-dir results/ --save-details
lighteval endpoint litellm litellm_config.yaml 'aime25|0' \
--output-dir results/ --save-details
lighteval endpoint litellm litellm_config.yaml 'gpqa:diamond|0' \
--output-dir results/ --save-details
litellm_config.yaml:
model_parameters:
provider: hosted_vllm
model_name: hosted_vllm/gemma-4-31b-it-FP8-block
base_url: http://0.0.0.0:8000/v1
api_key: ''
timeout: 1200
concurrent_requests: 32
generation_parameters:
temperature: 1.0
max_new_tokens: 32768
top_p: 0.95
top_k: 64
seed: 1234
Run once per seed (using the vLLM server without --default-chat-template-kwargs):
lighteval endpoint litellm litellm_config.yaml 'lcb:codegeneration_v6|0' \
--output-dir results/ --save-details
BFCL requires the model to be registered in the leaderboard codebase before running evaluation.
Step 1 — Register the model in bfcl_eval/constants/model_config.py
Add the following entry to api_inference_model_map:
"gemma-4-31b-it-FP8-block": ModelConfig(
model_name="gemma-4-31b-it-FP8-block",
display_name="Gemma-4-31b-it-FP8-Block (FC)",
url="https://huggingface.co/RedHatAI/gemma-4-31B-it-FP8-block",
org="Google",
license="Apache 2.0",
model_handler=OpenAICompletionsHandler,
input_price=None,
output_price=None,
is_fc_model=True,
underscore_to_dot=True,
),
Step 2 — Add the key to bfcl_eval/constants/supported_models.py
Add "gemma-4-31b-it-FP8-block" to the SUPPORTED_MODELS list.
Step 3 — Start the vLLM server (use the command at the top of this section; the --served-model-name flag ensures BFCL can find the model by its registered slug).
Step 4 — Generate responses and evaluate
bfcl generate --model gemma-4-31b-it-FP8-block --test-category all
bfcl evaluate --model gemma-4-31b-it-FP8-block --test-category all
</details>