Instructions to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4 # Run inference directly in the terminal: llama cli -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4 # Run inference directly in the terminal: llama cli -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4 # Run inference directly in the terminal: ./llama-cli -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4 # Run inference directly in the terminal: ./build/bin/llama-cli -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Use Docker
docker model run hf.co/BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
- LM Studio
- Jan
- vLLM
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
- Ollama
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with Ollama:
ollama run hf.co/BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
- Unsloth Desktop
- Pi
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with Docker Model Runner:
docker model run hf.co/BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
- Lemonade
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Run and chat with the model
lemonade run user.gemma-4-31B-it-qat-NVFP4-GGUF-NVFP4
List all available models
lemonade list
- Hermes Agent
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Gemma 4 31B IT β NVFP4-MSE Blackwell GGUF
A family of three GGUF files of Gemma 4 31B IT, converted from melcheikh/gemma-4-31B-it-qat-NVFP4-mse-Blackwell β a QAT checkpoint where every transformer weight is natively NVFP4 (NVIDIA's FP4 format, MSE per-block scaling + FP8 activation scale sweep via ModelOpt 0.44.0).
ORIGβ the source-preserving conversion: native NVFP4 on all 410 projection tensors + BF16 token embedding (the one tensor excluded from QAT). Highest fidelity.Q8_0-embdβ same NVFP4 backbone, token embedding quantized to Q8_0. The balanced choice.Q4_K-embdβ same NVFP4 backbone, token embedding quantized to Q4_K. Smallest.
The NVFP4 backbone is byte-identical across all three files (410/410 per-tensor SHA-256). The files differ only in token_embd.weight β which, since Gemma 4 ties embeddings to the LM head, is also output.weight. No other tensor varies.
Vision works. Gemma 4 31B is a native VLM (images and video). No mmproj is shipped here β pair with any Gemma 4 31B mmproj, e.g. mmproj-BF16.gguf from unsloth/gemma-4-31B-it-qat-GGUF (the vision tower is untouched by QAT in both models). MTP speculative decoding works β the model has been tested with unsloth's mtp-gemma-4-31B-it-Q4_0.gguf draft head.
The three files
| File | Size | token_embd (= tied LM head) |
Backbone |
|---|---|---|---|
gemma-4-31B-it-qat-NVFP4-ORIG.gguf |
19.31 GB | BF16 |
NVFP4 (410 tensors, byte-identical) |
gemma-4-31B-it-qat-NVFP4-Q8_0-embd.gguf |
17.99 GB | Q8_0 |
NVFP4 (410 tensors, byte-identical) |
gemma-4-31B-it-qat-NVFP4-Q4_K-embd.gguf |
17.29 GB | Q4_K |
NVFP4 (410 tensors, byte-identical) |
Tensor layout (1,653 tensors per file)
| GGML type | Tensors | Size | Component |
|---|---|---|---|
NVFP4 |
410 | 16.47 GB | all 60 layers Γ (attn_q/k/v/output + ffn_gate/up/down) |
BF16 / Q8_0 / Q4_K |
1 | 2.82 / 1.50 / 0.79 GB | token_embd (= tied LM head) |
F32 |
1,242 | 0.01 GB | norms, q/k-norms, layer output scales, NVFP4 block scales, rope freqs |
Lineage
- Google β gemma-4-31B-it-qat-q4_0-unquantized (Gemma terms): the QAT-trained q4_0 checkpoint.
- melcheikh β gemma-4-31B-it-qat-NVFP4-mse-Blackwell: NVIDIA ModelOpt 0.44.0 NVFP4 QAT with MSE per-block weight scaling (
--qformat nvfp4_mse) plus an FP8 activation scale sweep, calibrated on cnn_dailymail (512 samples).lm_headand the vision tower excluded from quantization. This is the checkpoint converted here β the NVFP4 tensors are preserved natively (GGML type 40), never dequantized or re-quantized. - This repo β the GGUF conversion and the embedding tier ladder.
How this was made
# 1. Source-preserving conversion (everything already NVFP4 in the checkpoint)
python3 convert_hf_to_gguf.py <checkpoint> --outfile gemma-4-31B-it-qat-NVFP4-ORIG.gguf --outtype auto
# 2. Tiers: llama-quantize with per-tensor overrides pinning the NVFP4 backbone (verbatim copy),
# only the token embedding is re-quantized.
# overrides-nvfp4-backbone.txt (regex, matches all 410 projections):
# blk\.[0-9]+\.attn_(q|k|v|output)\.weight=nvfp4
# blk\.[0-9]+\.ffn_(gate|up|down)\.weight=nvfp4
llama-quantize --tensor-type-file overrides-nvfp4-backbone.txt \
--token-embedding-type Q8_0 \
gemma-4-31B-it-qat-NVFP4-ORIG.gguf \
gemma-4-31B-it-qat-NVFP4-Q8_0-embd.gguf Q4_K
# (repeat with --token-embedding-type Q4_K for the Q4_K-embd tier)
The chat template is Google's current (updated) Gemma 4 template. general.quantization_version = 2, native context length 262,144.
Verified: 410/410 NVFP4 tensors SHA-256 byte-identical across all three files.
Serving
Requires a Blackwell GPU (sm_100/sm_120) for native FP4 β llama.cpp with BLACKWELL_NATIVE_FP4 support. Non-Blackwell devices will not get the point of this format.
llama-server \
-m gemma-4-31B-it-qat-NVFP4-Q4_K-embd.gguf \
--mmproj mmproj-BF16.gguf \
-md mtp-gemma-4-31B-it-Q4_0.gguf \ # optional MTP draft (unsloth)
--spec-type draft-mtp --spec-draft-n-max 3 \
--spec-draft-type-k q4_0 --spec-draft-type-v q4_0 --draft-p-min 0.0 \
-c 81920 --temp 0 -ngl 999 --parallel 1 -fa on -t 8 \
-b 512 -ub 512 -ctk q8_0 -ctv q8_0 \
--jinja
Measured on a single RTX PRO 4000 Blackwell SFF (24 GiB), SPEED-Bench throughput_16k / high_entropy, osl 1024, temperature 0, identical server flags (MTP draft n-max 2, -c 81920, q8_0 KV cache, text-only):
| Model file | Prompt processing t/s (16k prompt) |
|---|---|
gemma-4-31B-it-qat-UD-Q4_K_XL.gguf (unsloth, Q4_K_XL) |
662.6 |
gemma-4-31B-it-qat-NVFP4-Q8_0-embd.gguf |
958.9 |
gemma-4-31B-it-qat-NVFP4-Q4_K-embd.gguf |
943.9 |
On native FP4 hardware the NVFP4 backbone processes 16k prompts ~45% faster than the Q4_K_XL quantization of the same model.
Honest trade-off notes
- The backbone is QAT-trained NVFP4 β this is not a PTQ round trip; the 4-bit weights were trained by the checkpoint authors, and this conversion preserves them exactly.
- The embedding tiers are PTQ on one tensor.
token_embd(and therefore the tied LM head) is the only tensor excluded from QAT in the source. Quantizing it to Q8_0/Q4_K is a small, local fidelity loss vsORIGβ Q8_0 is closer to BF16 than Q4_K is. If output quality matters more than ~2 GB, useORIG; if footprint matters,Q4_K-embdcosts 2.0 GB vsORIG. - Vision β the vision tower was untouched by QAT; any Gemma 4 31B mmproj works (unsloth's
mmproj-BF16.ggufis the same unquantized tower).
Attribution & license
This is a derivative work β no training or fine-tuning happened here. Credit belongs to:
- Google for the base model and QAT training.
- NVIDIA for ModelOpt and the NVFP4-MSE method.
- melcheikh for the NVFP4-MSE Blackwell checkpoint converted here.
Gemma 4 models are released by Google under the Apache 2.0 license β see the Gemma 4 license. These files are derivatives of Apache-2.0 artifacts and are distributed under the same Apache 2.0 terms.
SHA-256
34195d8261c853a9baaa89f59787abcae36c12455c5b5809c16083395e4524a4 gemma-4-31B-it-qat-NVFP4-ORIG.gguf
af8617be45d407f185e7a78252903f9d02917b71adab6657625c4714334b9e0f gemma-4-31B-it-qat-NVFP4-Q8_0-embd.gguf
60bca34fa5e5c9281e06a265c5b90ed9f522c3ce2c5a837f651a4690de032510 gemma-4-31B-it-qat-NVFP4-Q4_K-embd.gguf
- Downloads last month
- 763
4-bit
8-bit
Model tree for BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF
Base model
google/gemma-4-31B
docker model run hf.co/BroLaurens/gemma-4-31B-it-qat-NVFP4-GGUF:NVFP4