Instructions to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cortexist/gemma-4-12B-it-assistant-MTP-GGUF", filename="gemma-4-12B-it-assistant-MTP-F16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16 # Run inference directly in the terminal: llama-cli -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16 # Run inference directly in the terminal: llama-cli -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
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 cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16 # Run inference directly in the terminal: ./llama-cli -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
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 cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
Use Docker
docker model run hf.co/cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
- LM Studio
- Jan
- vLLM
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cortexist/gemma-4-12B-it-assistant-MTP-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cortexist/gemma-4-12B-it-assistant-MTP-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
- Ollama
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with Ollama:
ollama run hf.co/cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
- Unsloth Studio
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for cortexist/gemma-4-12B-it-assistant-MTP-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for cortexist/gemma-4-12B-it-assistant-MTP-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for cortexist/gemma-4-12B-it-assistant-MTP-GGUF to start chatting
- Docker Model Runner
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with Docker Model Runner:
docker model run hf.co/cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
- Lemonade
How to use cortexist/gemma-4-12B-it-assistant-MTP-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cortexist/gemma-4-12B-it-assistant-MTP-GGUF:F16
Run and chat with the model
lemonade run user.gemma-4-12B-it-assistant-MTP-GGUF-F16
List all available models
lemonade list
output = llm(
"Once upon a time,",
max_tokens=512,
echo=True
)
print(output)Gemma 4 12B β MTP Assistant (speculative drafter) Β· GGUF
GGUF builds of google/gemma-4-12B-it-assistant β the Multi-Token Prediction (MTP) draft head for Gemma 4 12B β for use as a speculative-decoding drafter in the cortexist/llama.cpp fork.
β οΈ This is not a standalone model. It is a small draft head that must be loaded alongside the Gemma 4 12B target model. On its own it produces nothing useful. Paired with the target it does lossless speculative decoding β the greedy output is byte-for-byte identical to running the target alone, just faster when the target's decode is memory-bandwidth-bound.
Files
| File | Precision | Size | Notes |
|---|---|---|---|
gemma-4-12B-it-assistant-MTP-Q4_K_M.gguf |
Q4_K_M | ~0.31 GB | token_embd Q6_K, rest Q4_K β recommended |
gemma-4-12B-it-assistant-MTP-F16.gguf |
F16 | ~0.82 GB | full-precision conversion |
Acceptance is essentially identical between the two quants (the head only proposes token ids the target then verifies), so Q4_K_M is the practical choice.
Requirements
- The cortexist/llama.cpp fork. Upstream llama.cpp does not currently support this head (the converter for the
gemma4_unified_assistantcheckpoint and thegemma4_assistantruntime graph live in the fork). - A Gemma 4 12B target GGUF β e.g. your own conversion of
google/gemma-4-12B-it. The drafter's backbone width (3840) must match the target's embedding length.
Usage
./build/bin/llama-server \
-m gemma-4-12B-it-Q4_K_M.gguf \
-md gemma-4-12B-it-assistant-MTP-Q4_K_M.gguf \
--spec-type draft-mtp --spec-draft-block-size 2 \
-ngl 99 -ngld 99 -fa on \
-ctk f16 -ctv f16 -ctkd f16 -ctvd f16 \
-c 4096 --host 0.0.0.0 --port 8080
-md/--model-draftpoints at the drafter (mainline-style;--mtp-headis an accepted alias).--spec-type draft-mtpenables the MTP path;--spec-draft-block-size Bmakes the head draftB β 1tokens per round (B = 2 is the sweet spot β see below).- Works the same in
llama-cliandllama-speculative-simple.
How it works
The drafter is a small 4-layer, query-only transformer that cross-attends the target model's own KV cache and seeds from the target's last backbone hidden state. Each round it proposes B β 1 tokens; the target verifies them in a single batched forward pass and accepts the longest correct prefix. Because the target does the accepting, output is identical to non-speculative greedy decoding β speculation only changes speed, never content.
Benchmarks β when does MTP actually help?
Speculative decoding pays off only when the target's verify step is memory-bandwidth-bound, so batching the drafted tokens through it is nearly free. On a fast, compute-bound GPU there's no spare bandwidth to exploit and the extra draft + wider-verify compute is a net cost. The 12B drafter shows this split cleanly.
Methodology: scripts/bench-gemma4-mtp.sh from the fork β Gemma 4 12B Q4_K_M target + this drafter, B = 2, -fa on, -ngl 99, 3 prompts Γ 256 tokens, greedy (temperature 0, deterministic), throughput and acceptance read from the server's own timings. "Baseline" = target with no draft head loaded.
Jetson Orin NX (bandwidth-bound β MTP wins)
| KV cache | Baseline tk/s | MTP tk/s | Speedup | Draft accept |
|---|---|---|---|---|
| f16 | 7.53 | 9.89 | 1.31Γ | 74.8% |
| turbo3 | 7.24 | 8.17 | 1.13Γ | 72.0% |
NVIDIA RTX A5000 (compute-bound β MTP loses)
| KV cache | Baseline tk/s | MTP tk/s | Speedup | Draft accept |
|---|---|---|---|---|
| f16 | 66.5 | 61.7 | 0.93Γ | 75.6% |
| turbo3 | 58.2 | 47.8 | 0.82Γ | 74.4% |
Takeaways
- On the edge (Orin NX), MTP is a real ~1.31Γ win β and
f16KV + MTP is the best config. - On a fast desktop GPU (A5000), MTP is a net loss (0.93Γ): the 12B decode is already compute-bound, so the draft/verify overhead isn't repaid.
- Draft acceptance is ~72β76% on both machines β acceptance is a property of the model + prompt, independent of hardware. Only the throughput payoff flips sign.
turbo3KV helps MTP less thanf16(and is even slightly slower at the baseline at this context length): its win is KV-cache VRAM at long context, while its per-step dequant adds compute β counterproductive on an already compute-bound verify. Useturbo3to fit long context, not to go faster.
If you're deploying on a bandwidth-bound edge device, enable MTP. On a high-end discrete GPU that isn't bandwidth-starved on a model this size, plain decoding is simpler and faster.
Conversion
Converted from the official google/gemma-4-12B-it-assistant safetensors with the fork's convert_hf_to_gguf.py (registered as Gemma4UnifiedAssistantForCausalLM β gemma4_assistant arch), then llama-quantize for Q4_K_M.
License
These are derivative GGUF builds of google/gemma-4-12B-it-assistant. Use is governed by the Gemma 4 license / Terms of Use. All credit for the underlying model belongs to Google DeepMind; cortexist only performed the GGUF conversion/quantization and benchmarking.
- Downloads last month
- 1,234
4-bit
16-bit
Model tree for cortexist/gemma-4-12B-it-assistant-MTP-GGUF
Base model
google/gemma-4-12B-it-assistant
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cortexist/gemma-4-12B-it-assistant-MTP-GGUF", filename="", )