Instructions to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Anbeeld/gemma-4-31B-it-DFlash-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Anbeeld/gemma-4-31B-it-DFlash-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Anbeeld/gemma-4-31B-it-DFlash-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 Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
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 Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
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 Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
Use Docker
docker model run hf.co/Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Anbeeld/gemma-4-31B-it-DFlash-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": "Anbeeld/gemma-4-31B-it-DFlash-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
- SGLang
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Anbeeld/gemma-4-31B-it-DFlash-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anbeeld/gemma-4-31B-it-DFlash-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Anbeeld/gemma-4-31B-it-DFlash-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anbeeld/gemma-4-31B-it-DFlash-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with Ollama:
ollama run hf.co/Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
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": "Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with Docker Model Runner:
docker model run hf.co/Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
- Lemonade
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-4-31B-it-DFlash-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Anbeeld/gemma-4-31B-it-DFlash-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 Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
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 Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Anbeeld/gemma-4-31B-it-DFlash-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M
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 "Anbeeld/gemma-4-31B-it-DFlash-GGUF:Q4_K_M" \ --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 DFlash GGUF
GGUF quantizations of z-lab DFlash draft model for Gemma 4 31B IT.
Use with BeeLlama.cpp, a llama.cpp fork with advanced quantization features.
gemma-4-31B-it-DFlash
DFlash is a speculative decoding method that uses a lightweight block diffusion model to draft multiple tokens in parallel. This is the drafter model, which must be paired with google/gemma-4-31B-it.
Quick Start
Installation
vLLM: until Gemma4 DFlash support is merged, install vLLM from PR #41703:
uv pip install -U --torch-backend=auto \
"vllm @ git+https://github.com/vllm-project/vllm.git@refs/pull/41703/head"
SGLang:
uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/23000/head#subdirectory=python"
Launch Server
vLLM:
vllm serve google/gemma-4-31B-it \
--speculative-config '{"method": "dflash", "model": "z-lab/gemma-4-31B-it-DFlash", "num_speculative_tokens": 15, "attention_backend": "flash_attn"}' \
--attention-backend triton_attn \
--max-num-batched-tokens 32768 \
--trust-remote-code
SGLang:
# Optional: enable schedule overlapping (experimental, may not be stable)
# export SGLANG_ENABLE_SPEC_V2=1
# export SGLANG_ENABLE_DFLASH_SPEC_V2=1
# export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
python -m sglang.launch_server \
--model-path google/gemma-4-31B-it \
--speculative-algorithm DFLASH \
--speculative-draft-model-path z-lab/gemma-4-31B-it-DFlash \
--speculative-num-draft-tokens 16 \
--tp-size 1 \
--attention-backend triton \
--speculative-draft-attention-backend fa4 \
--trust-remote-code
Usage
For vLLM, use port 8000. For SGLang, use port 30000.
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="google/gemma-4-31B-it",
messages=[{"role": "user", "content": "Write a quicksort in Python."}],
max_tokens=4096,
temperature=0.0,
extra_body={"chat_template_kwargs": {"enable_thinking": True}},
)
print(response.choices[0].message.content)
Benchmark Results
Setup: Single NVIDIA B300 GPU per server/run, vLLM, thinking enabled, max output length 4096, greedy decoding.
Throughput and Speedup
DFlash achieves up to 5.8x speedup at concurrency 1.
Generated tokens/sec (speedup vs. autoregressive baseline)
Block Size = 16
| Task | Concurrency | AR | DFlash |
|---|---|---|---|
| Math500 | 1 | 77 | 447 (5.8x) |
| 8 | 511 | 2650 (5.2x) | |
| 32 | 1308 | 4962 (3.8x) | |
| GSM8K | 1 | 78 | 408 (5.3x) |
| 8 | 520 | 2321 (4.5x) | |
| 32 | 1382 | 4447 (3.2x) | |
| HumanEval | 1 | 76 | 420 (5.6x) |
| 8 | 494 | 2389 (4.8x) | |
| 32 | 1145 | 4139 (3.6x) | |
| MBPP | 1 | 79 | 343 (4.4x) |
| 8 | 535 | 2036 (3.8x) | |
| 32 | 1389 | 3636 (2.6x) | |
| MT-Bench | 1 | 79 | 236 (3.0x) |
| 8 | 503 | 1334 (2.7x) | |
| 32 | 1177 | 2257 (1.9x) |
Acceptance Length
| Task | c1 | c8 | c32 |
|---|---|---|---|
| Math500 | 8.59 | 8.59 | 8.62 |
| GSM8K | 7.53 | 7.50 | 7.52 |
| HumanEval | 8.00 | 7.89 | 7.96 |
| MBPP | 6.13 | 6.13 | 6.14 |
| MT-Bench | 4.23 | 4.19 | 4.19 |
Acknowledgements
Special thanks to David Wang for his outstanding engineering support on this project. We are also grateful to Modal, InnoMatrix, and Yotta Labs for providing the compute resources used to train this draft model.
Citation
If you find DFlash useful, please cite our work. To share feedback on DFlash or request new model support, please fill out this form: DFlash Feedback.
@article{chen2026dflash,
title = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
author = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
journal = {arXiv preprint arXiv:2602.06036},
year = {2026}
}
- Downloads last month
- 5,372
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit
Model tree for Anbeeld/gemma-4-31B-it-DFlash-GGUF
Base model
z-lab/gemma-4-31B-it-DFlash