This repository contains google/gemma-4-31B-it (dense 31B) exported to OpenVINO IR format with INT4 weight compression, ready to serve via OpenVINO Model Server (OVMS) 2026.3 as an OpenAI-compatible endpoint.
Validated on: Intel Arc Pro B60 (24 GB), Ubuntu 24.04, OVMS 2026.3.0 native CLI binary.
Read this before you deploy: this model must be served with OVMS's legacy VLM pipeline, not VLM_CB (continuous batching / paged attention). VLM_CB produces corrupted output for this model — see Known Challenges for how this was isolated. This is not a quantization bug; the INT4 export itself is clean.
Model Files
File
Size
Description
openvino_language_model.bin
~16 GB
INT4 (asymmetric) language model weights
openvino_vision_embeddings_model.bin
~551 MB
SigLIP2 vision encoder (unused for text-only inference, present because Gemma 4 is architecturally a VLM)
openvino_text_embeddings_model.bin
~1.4 GB
Text embedding model
openvino_tokenizer.xml/.bin
~17 MB
OV tokenizer
openvino_detokenizer.xml/.bin
~4.3 MB
OV detokenizer
graph.pbtxt
~1 KB
OVMS MediaPipe pipeline config (legacy VLM, not VLM_CB)
Quantization parameters:INT4_ASYM, group_size=128, ratio=1.0 (no mixed precision).
Quick Start
Prerequisites
OVMS 2026.3 native CLI binary (tarball, not a Docker image — see below)
Intel GPU with Level Zero / OpenCL drivers installed
At least 18 GB GPU VRAM (Arc Pro B60 or equivalent)
/dev/dri render device accessible
Python 3.12 with the pyovms extension on PYTHONPATH (bundled with the OVMS tarball)
1exportPYTHONPATH=~/ovms_2026.3/ovms/lib/python:$PYTHONPATH23~/ovms_2026.3/ovms/bin/ovms \4 --config_path ~/ovms_models/config.json \5 --rest_port 9001\6 --allowed_local_media_path ~/ovms_models \7 --allowed_media_domains all \8 --log_level INFO
The PYTHONPATH export is required — without it, OVMS's Python-Mediapipe backend can't find its bundled pyovms extension module and the server will not come up.
CPU-only fallback: change device: "GPU" to device: "CPU" in graph.pbtxt, then drop --device/--group-add if you're also using Docker.
Step 5 — Wait for the model to load
curl -s http://localhost:9001/v3/models
Wait for google/gemma-4-31B-it to show up in the response.
A benchmark script is included in this repo (benchmark_gemma4.py) that runs a fixed set of prompts, reports tokens/sec, and flags known corruption signatures (useful as a regression check after any OVMS/optimum-intel upgrade):
This deployment went through a fairly involved debugging process. Summarized here so you don't have to repeat it:
INT4 corruption (red herring). Early attempts at exporting this model with INT4 compression (various group-size/ratio/symmetric combinations, across multiple optimum-intel branches) produced output that looked corrupted — garbled sub-tokens collapsing into repeated-token loops after roughly 100 tokens of otherwise coherent generation. This pattern held across CPU and GPU, across export methods, and across several quantization recipes, strongly suggesting an INT4-specific bug.
The actual root cause: OVMS's continuous-batching pipeline, not quantization. The same INT4 export produces clean output when tested directly via optimum-intel in Python and clean output when served through OVMS's legacy VLM pipeline — but corrupts when served through VLM_CB (continuous batching / paged attention), even with identical weights. This isolates the bug to VLM_CB's interaction with Gemma 4's hybrid attention head dimensions (256 sliding-window / 512 global) — likely a similar issue to one that required mainline vLLM to force a specific attention backend for this same model.
Gemma 4 is registered strictly as a VLM task, even for text-only use — exports must use --task image-text-to-text (direct optimum-cli) or --pipeline_type VLM/VLM_CB (export_model.py); text-generation-with-past is rejected outright.
Dependency conflicts are the biggest time sink.optimum-intel's Gemma 4 support currently lives on a fork (rkazants/optimum-intel@support_gemma_4), not mainline, and it has a narrow compatible window with transformers/safetensors/optimum-onnx versions. Installing OVMS's own export_model.pyrequirements.txt will silently install a differentoptimum-intel on top of the fork. Install requirements.txt first (full dependency resolution), then the fork second, unconstrained — this way the fork wins the conflict and pulls in compatible dependency versions.
OVMS's native GGUF loader does not support this model. If you already have a GGUF quant of Gemma 4 (e.g. from Unsloth), OVMS's built-in --pull --gguf_filename path will reject it — its recognized-architecture list includes gemma3 but not gemma4 as of this OVMS version. Use the IR export path in this repo instead.
Do not substitute --pipeline_type VLM_CB here — see Known Challenges.
Troubleshooting
Symptom
Cause
Fix
ModuleNotFoundError: No module named 'pyovms'
OVMS's Python-Mediapipe backend can't find its bundled extension module.
export PYTHONPATH=<ovms_dir>/ovms/lib/python:$PYTHONPATH before starting ovms.
KeyError: 'gemma4' in transformers
Active transformers version doesn't recognize the gemma4 model_type.
Install a transformers version with gemma4 support (5.13.0 confirmed working).
ValueError: ... only supports the tasks image-text-to-text for gemma4
This optimum-intel branch registers Gemma 4 strictly as a VLM task.
Use --task image-text-to-text or --pipeline_type VLM/VLM_CB, never text-generation-with-past.
ModuleNotFoundError: No module named 'optimum.exporters.onnx'
The optimum-onnx package got uninstalled or never installed.
pip install --no-deps optimum-onnx
ImportError: safetensors>=0.8.0 is required ... found safetensors==0.7.0
Version constraint wasn't quoted in shell, or --no-deps skipped the bump.
pip install "safetensors>=0.8.0" — quote it, or > gets parsed as a shell redirect.
Clean output via raw Python, corrupted via OVMS serving
VLM_CB pipeline bug with this model's hybrid attention heads.
Export and serve with --pipeline_type VLM (legacy) instead.
Invalid request URL
Using /v1/ instead of /v3/.
Change URL to /v3/chat/completions.
Hardware Requirements
Component
Minimum
Tested
GPU VRAM
18 GB
Intel Arc Pro B60 (24 GB)
System RAM
32 GB
256 GB
Storage
25 GB free
NVMe SSD
OS
Ubuntu 22.04+
Ubuntu 24.04
Driver
Intel GPU driver with Level Zero
Latest production
Known Limitations
No continuous batching. The legacy VLM pipeline serves one request at a time; this configuration is validated for single-request serving only. Concurrent throughput is unvalidated.
VLM_CB should not be used with this model until the underlying paged-attention issue with Gemma 4's hybrid head dimensions is fixed upstream in OpenVINO GenAI.
Vision tower is present (SigLIP2) but unexercised by the text-only testing in this repo — image+text inference is architecturally supported but not validated here.
License
Gemma model weights are subject to the Gemma Terms of Use. This repository contains only the OpenVINO-converted weights with no modifications to model parameters.