Text Generation
Transformers
GGUF
gemma4
gemma-4-31b-it
nvfp4
modelopt
vllm
quantized
nvidia
lighthouse
Eval Results (legacy)
conversational
Instructions to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-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 CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4 # Run inference directly in the terminal: llama cli -hf CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4 # Run inference directly in the terminal: llama cli -hf CISCai/gemma-4-31B-it-NVFP4-turbo-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 CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4 # Run inference directly in the terminal: ./llama-cli -hf CISCai/gemma-4-31B-it-NVFP4-turbo-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 CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4 # Run inference directly in the terminal: ./build/bin/llama-cli -hf CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
Use Docker
docker model run hf.co/CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
- LM Studio
- Jan
- vLLM
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CISCai/gemma-4-31B-it-NVFP4-turbo-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": "CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
- SGLang
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-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 "CISCai/gemma-4-31B-it-NVFP4-turbo-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": "CISCai/gemma-4-31B-it-NVFP4-turbo-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 "CISCai/gemma-4-31B-it-NVFP4-turbo-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": "CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with Ollama:
ollama run hf.co/CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
- Unsloth Desktop
- Pi
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf CISCai/gemma-4-31B-it-NVFP4-turbo-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": "CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with Docker Model Runner:
docker model run hf.co/CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
- Lemonade
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
Run and chat with the model
lemonade run user.gemma-4-31B-it-NVFP4-turbo-GGUF-NVFP4
List all available models
lemonade list
- Hermes Agent
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-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 CISCai/gemma-4-31B-it-NVFP4-turbo-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 CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF:NVFP4
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf CISCai/gemma-4-31B-it-NVFP4-turbo-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 "CISCai/gemma-4-31B-it-NVFP4-turbo-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"
| license: apache-2.0 | |
| license_link: https://ai.google.dev/gemma/docs/gemma_4_license | |
| library_name: transformers | |
| base_model: | |
| - LilaRest/gemma-4-31B-it-NVFP4-turbo | |
| pipeline_tag: text-generation | |
| tags: | |
| - gemma4 | |
| - gemma-4-31b-it | |
| - nvfp4 | |
| - modelopt | |
| - vllm | |
| - quantized | |
| - nvidia | |
| - lighthouse | |
| model-index: | |
| - name: gemma-4-31B-it-NVFP4-turbo | |
| results: | |
| - task: | |
| type: text-generation | |
| dataset: | |
| name: GPQA Diamond | |
| type: Idavidrein/gpqa | |
| config: gpqa_diamond | |
| metrics: | |
| - name: Accuracy | |
| type: accuracy | |
| value: 72.73 | |
| - task: | |
| type: text-generation | |
| dataset: | |
| name: MMLU Pro | |
| type: TIGER-Lab/MMLU-Pro | |
| metrics: | |
| - name: Accuracy | |
| type: accuracy | |
| value: 83.93 | |
| <div align="center"> | |
| <img src="https://huggingface.co/LilaRest/gemma-4-31B-it-NVFP4-turbo/resolve/main/banner.png"> | |
| </div> | |
| <h1 align="center">⚡ Gemma 4 31B IT NVFP4 <i>Turbo</i> GGUF</h1> | |
| Requires [ggml-org/llama.cpp#21971](https://github.com/ggml-org/llama.cpp/pull/21971) | |
| A repackaged [nvidia/Gemma-4-31B-IT-NVFP4](https://huggingface.co/nvidia/Gemma-4-31B-IT-NVFP4) that is **68% smaller** in GPU memory and **~2.5× faster** than the [base model](https://huggingface.co/google/gemma-4-31B-it), while retaining **nearly identical quality** (1-3% loss). Fits on a *single* RTX 5090 (🎉). | |
| ## Approach | |
| Three changes were made: | |
| 1. **Quantized** all self-attention weights from BF16 → FP4 (RTN, group_size=16, matching modelopt NVFP4 format) | |
| 2. **Updated** architecture to `Gemma4ForCausalLM` and quantization config accordingly | |
| 3. **Stripped** the vision and audio encoder | |
| Everything else is untouched — MLP layers keep NVIDIA's calibrated FP4, `embed_tokens` stays BF16, all norms preserved, so we retain all the [nvidia/Gemma-4-31B-IT-NVFP4](https://huggingface.co/nvidia/Gemma-4-31B-IT-NVFP4) optimizations. | |
| #### Why RTN didn't hurt quality | |
| RTN (Round-To-Nearest) is the simplest quantization method — no calibration data, fully reproducible. It worked here because: | |
| - FP4 with group_size=16 and per-group scaling preserves relative weight distributions well | |
| - Self-attention weights tend to be normally distributed near zero, where the FP4 grid has finest resolution (0, 0.5, 1.0, 1.5) | |
| - MLP layers (more sensitive to quantization) keep NVIDIA's calibrated FP4 | |
| - `embed_tokens` stays BF16, preventing noise from propagating through all layers | |
| ## License | |
| Apache 2.0 — same as the [base model](https://ai.google.dev/gemma/docs/gemma_4_license). | |
| ## Credits | |
| - [Google DeepMind](https://deepmind.google/models/gemma/) for Gemma 4 | |
| - [NVIDIA](https://huggingface.co/nvidia/Gemma-4-31B-IT-NVFP4) for the modelopt NVFP4 checkpoint | |