gemma-4-31B-it · GGUF

The largest Gemma 4, a dense 31B model with image input and a 256K context.

GGUF builds of gemma-4-31B-it by Google for llama.cpp and SoAI, calibrated on real chat, code and tool calls.


At a glance

Text Images Audio Reasoning Tool calling Context
Yes Yes No Yes Yes 256K
Specification Details
Parameters 30.7B
Architecture Dense
Context window 262,144 tokens
Reasoning Configurable thinking, switched per request
Languages 35+ languages (pre-trained on 140+)
Made by Google

Choosing a file

Download Size Quality Best for
Q4_K_M 18.7 GB High Most machines, with the best quality for its size
Q8_0 32.6 GB Near-lossless Output closest to the original, when memory allows
mmproj (F16) 1.2 GB Add-on Needed only for image input

Q4_K_M suits most machines. It is about a third of the size of the original 16-bit weights and stays close to them in quality. If Q8_0 fits in your memory, it keeps output closest to the original. SoAI does not publish quants below 4 bits because their quality loss is rarely worth the saved space.

The model needs memory for the file and for the context, and the context part grows with the context length you set. llama.cpp can run the model on the GPU, on the CPU, or with its layers split between them.

Images need the mmproj-gemma-4-31B-it-f16.gguf add-on as well, loaded with --mmproj. llama-server -hf downloads it automatically.

Quick start

With llama.cpp, this command starts a local server with a built-in chat UI and an OpenAI-compatible API:

llama-server -hf SoAIHQ/gemma-4-31B-it-GGUF:Q4_K_M

Open http://localhost:8080 to chat, or send requests to the API:

curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
  "messages": [{"role": "user", "content": "Explain GGUF in one sentence."}],
  "chat_template_kwargs": {"enable_thinking": true}
}'
Download the files to a folder first
hf download SoAIHQ/gemma-4-31B-it-GGUF --include "gemma-4-31B-it-Q4_K_M.gguf" "mmproj-*" --local-dir gemma-4-31B-it-GGUF
llama-server -m gemma-4-31B-it-GGUF/gemma-4-31B-it-Q4_K_M.gguf \
  --mmproj gemma-4-31B-it-GGUF/mmproj-gemma-4-31B-it-f16.gguf

Recommended settings

Mode temperature top_p top_k
All tasks 1.0 0.95 64

Google recommends these values in the original model card. Google uses the same sampling settings for every task, with thinking on or off.

In llama-server, you set reasoning per request with "chat_template_kwargs": {"enable_thinking": true}.

How these files are made

Q4_K_M is quantized with an importance matrix (imatrix), which tells llama.cpp which weights affect the output most so it can store them with more precision. SoAI computes the imatrix from its own calibration corpus instead of generic web text, and formats every conversation in it with this model's chat template, including its native tool-call syntax. The model is therefore measured on the token patterns it sees in use: multi-turn chat in 21 languages, code edits in 22 programming languages, tool calls and their results, step-by-step math, and web prose.

Q8_0 is quantized without the imatrix, because llama.cpp's Q8_0 format does not use one.

Before any quantization, the build checks that the chat, thinking and tool-call markers are stored as special tokens and that the embedded chat template matches the original. A conversion that imports those markers as plain text breaks turns, thinking and tool calls without any error message, so the build stops instead of publishing the file.

The imatrix file is published in this repository, and the provenance table below pins the original revision and the llama.cpp commit, so you can rebuild these files yourself.

Calibration corpus sources
Source Revision License Records Used for
HuggingFaceFW/fineweb-2 af9c13333eb9 ODC-By 1.0 60 Multilingual web prose in the 21 SoAI UI languages
HuggingFaceFW/fineweb-edu 87f09149ef47 ODC-By 1.0 20 English educational prose
OpenAssistant/oasst2 179dd21fc551 Apache-2.0 70 Multi-turn, multilingual human conversations
CohereLabs/aya_dataset f9ea04583f02 Apache-2.0 60 Human-written instructions and answers in SoAI UI languages
glaiveai/glaive-function-calling-v2 8862406ff857 Apache-2.0 60 Tool definitions, tool calls and tool results
bigcode/commitpackft fc56fe33c030 MIT (dataset); permissively licensed source files 88 Code edits in 22 programming and config languages
openai/gsm8k 740312add88f MIT 40 Step-by-step math reasoning
All files and SHA-256 checksums
File Type Size SHA-256
gemma-4-31B-it-Q8_0.gguf Q8_0 32.6 GB aed6d3f5657b785d…
gemma-4-31B-it-Q4_K_M.gguf Q4_K_M 18.7 GB 6e5b6e6d35df85d4…
mmproj-gemma-4-31B-it-f16.gguf mmproj (F16) 1.2 GB 5f52c97e30bb5d56…
gemma-4-31B-it.imatrix imatrix 13.7 MB 5e84a508e008ff5a…

The full checksums are in SHA256SUMS.

Provenance

Item Details
Original model google/gemma-4-31B-it by Google, revision 842da3794e
Converted with llama.cpp v0.5.0, commit 7fe450e19
Importance matrix SoAI calibration corpus v1, rendered with this model's chat template and computed on the Q8_0 weights
Weights The original release, with no fine-tuning, merging or retraining. Only the storage format and numerical precision differ.
Built 2026-09-26

License and credits

These files are distributed under the original model's license (apache-2.0), and its full terms continue to apply. The license and the original model card also describe the model's capabilities, training data, benchmarks and limitations.

Google designed and trained the model, and SoAI only repackages the published weights. The conversion uses llama.cpp by Georgi Gerganov and the ggml contributors.

Run it with SoAI

Your models, your hardware, one software suite. Download SoAI for Windows, macOS, Linux or Android.

Packaged by SoAI.

Downloads last month
-
GGUF
Model size
31B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for SoAIHQ/gemma-4-31B-it-GGUF

Quantized
(319)
this model