gemma-4-31B-it-FP8-block
This repository contains RedHatAI/gemma-4-31B-it-FP8-block together with a Furiosa Executable Bundle (FXB) for running it on FuriosaAI RNGD with Furiosa-LLM. The same model also runs on other frameworks (such as vLLM, SGLang, and Transformers); for usage with those, see the upstream RedHatAI/gemma-4-31B-it-FP8-block model card.
Overview
Gemma 4 31B is a dense multimodal model from Google. It combines a vision encoder with a transformer decoder that interleaves sliding-window and full-attention layers. Its chat template supports optional reasoning and tool (function) calling. This Red Hat AI build applies FP8 block quantization to the text transformer's linear layers. Its intended use is the same as the upstream RedHatAI/gemma-4-31B-it-FP8-block, released under the Apache 2.0 License.
- Architecture: Gemma 4 (dense)
- Input / Output: Image + Text / Text
- Supported Inference Engine: Furiosa LLM
- Supported Hardware: FuriosaAI RNGD
Quantization
The upstream Red Hat AI build statically quantizes the weights of linear operators in the text transformer to FP8 with 128×128 blocks. Their input activations are quantized dynamically to FP8 at runtime in groups of 128 values, without offline calibration. The vision tower, embeddings, output head, and KV cache stay in 16-bit precision.
Features
- Hybrid thinking. The chat template honors
enable_thinkingand defaults it tofalse. Furiosa-LLM'sgemma4reasoning parser returns enabled reasoning in a separate response field. - Vision-language architecture. The model accepts image and text input.
- Tool calling. The model has a native tool-call format supported by Furiosa-LLM's
gemma4tool-call parser.
Parallelism Strategy
On RNGD, gemma-4-31B-it-FP8-block runs with a tensor-parallel size of 32 PEs, which maps to four RNGD cards (8 PEs per card).
Usage
To run this model with Furiosa-LLM, follow the example commands below after installing Furiosa-LLM and its prerequisites.
Launch the server
Serve the model by passing its furiosa-ai/<repo> identifier:
# Launch the server, listening on port 8000 by default
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4
Gemma 4 runs in non-reasoning mode by default. Keeping the gemma4
reasoning parser enabled lets the server return reasoning in a separate field
when thinking is enabled (see Advanced Usage).
To also enable tool (function) calling, add automatic tool choice and the
gemma4 tool-call parser:
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4 \
--enable-auto-tool-choice \
--tool-call-parser gemma4
When the server is ready, you will see:
INFO: Started server process [27507]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Basic Usage
The server exposes an OpenAI-compatible API. You can send a text-only request with
curl:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "furiosa-ai/gemma-4-31B-it-FP8-block",
"messages": [{"role": "user", "content": "What is the capital of France?"}]
}' \
| python -m json.tool
To ask about an image, pass an image_url content part in the message:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "furiosa-ai/gemma-4-31B-it-FP8-block",
"messages": [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}},
{"type": "text", "text": "What animal is on the candy?"}
]
}]
}' \
| python -m json.tool
The image_url.url field accepts a remote http:///https:// URL, an inline
base64 data: URL, or a local file:// path (the last requires the
--allowed-local-media-path flag described under Advanced Usage).
Once thinking is enabled (see Advanced Usage), Gemma 4 returns reasoning separately from the final answer:
response.choices[].message.reasoning(non-streaming)response.choices[].delta.reasoning(streaming)
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="furiosa-ai/gemma-4-31B-it-FP8-block",
messages=[{"role": "user", "content": "How many r's are in 'strawberry'?"}],
extra_body={"chat_template_kwargs": {"enable_thinking": True}},
)
print("Reasoning:", response.choices[0].message.reasoning)
print("Answer:", response.choices[0].message.content)
Note: The
reasoningfield is not part of the OpenAI API specification but is a widely followed convention (the OpenAI Agents SDK, vLLM, and others). It appears only in responses that contain reasoning content; accessing it otherwise raises anAttributeError.
Advanced Usage
Multimodal serving options. This example allows local images under
/srv/media, restricts remote image fetches to cdn.example.com, and limits
each request to four images:
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4 \
--enable-auto-tool-choice \
--tool-call-parser gemma4 \
--allowed-local-media-path /srv/media \
--allowed-media-domains cdn.example.com \
--image-limit-per-prompt 4
See Server Options in the Vision-Language Models guide for the full option reference and defaults.
Image processing options. This example sets a 10-second HTTP image-fetch
timeout and sets Gemma 4's image-token limit to 280 with max_soft_tokens:
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4 \
--media-io-kwargs '{"image": {"timeout": 10}}' \
--mm-processor-kwargs '{"max_soft_tokens": 280}'
For supported values, sizing behavior, and per-request overrides, see Multimodal Options in the Vision-Language Models guide.
Enabling reasoning. Gemma 4 runs in non-reasoning mode by default. Enable
reasoning for a single request by passing enable_thinking through
chat_template_kwargs, as shown under Basic Usage. With
--reasoning-parser gemma4, the chain of thought is returned separately from
the final answer.
To make every request reason, launch the server with
--default-chat-template-kwargs (a request can still override the default):
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4 \
--default-chat-template-kwargs '{"enable_thinking": true}'
Preserving reasoning in tool-call conversations. The chat template also
supports preserve_thinking, which defaults to false. Set it to true to
retain reasoning from earlier assistant tool-call messages when rendering a
multi-turn agent conversation. It does not enable reasoning by itself:
response = client.chat.completions.create(
model="furiosa-ai/gemma-4-31B-it-FP8-block",
messages=messages,
tools=tools,
extra_body={
"chat_template_kwargs": {
"enable_thinking": True,
"preserve_thinking": True,
}
},
)
To apply both options by default for every request, use:
furiosa-llm serve furiosa-ai/gemma-4-31B-it-FP8-block \
--reasoning-parser gemma4 \
--enable-auto-tool-choice \
--tool-call-parser gemma4 \
--default-chat-template-kwargs '{"enable_thinking": true, "preserve_thinking": true}'
Tool calling. With the server launched using
--enable-auto-tool-choice --tool-call-parser gemma4 (see
Launch the server), pass tools in the request and let the
model decide when to call them. See the
Tool Calling guide
for a complete client example and details on tool-choice options.
Learn more
- Vision-Language Models — image input formats and multimodal server options
- Tool Calling — parsers, tool-choice options, and examples
- Furiosa-LLM Server (
furiosa-llm serve) — full OpenAI-compatible API reference and serving options - RedHatAI/gemma-4-31B-it-FP8-block — upstream quantized model card
- google/gemma-4-31B-it — base model card