Views
No views yet
llama.cpp. Pairing this head with the full model lets the target
model draft several tokens per step and verify them in a single forward pass — accelerating
token generation with no change to output (speculative decoding is lossless).--spec-draft-model alongside the full Gemma 4 26B A4B QAT model.unsloth/gemma-4-26B-A4B-it-qat-GGUF → UD-Q4_K_XL, with the
exact llama-server configuration shown under Usage below, same build and same prompt, only the MTP
head toggled.| Config | Decode (mean) | Prefill (mean) | VRAM | Draft acceptance |
|---|---|---|---|---|
| Target only (no MTP) | 199.8 tok/s | 10,568 tok/s | 23.5 GB | — |
| Target + this MTP head | 282.3 tok/s | 10,236 tok/s | 25.3 GB | 78–92% |
| Δ | +41% | ~flat | +1.8 GB |
llama-server v129; the full config under Usage; native /completion,
fixed 3,000-token prompt, n_predict 512, ignore_eos, cache_prompt:false, 3 reps + warmup.llama.cpp build with Gemma 4 MTP support — PR #23398
/ commit 04eb4c4 or later (tested on build 9e3b928, llama-server version 129).unsloth/gemma-4-26B-A4B-it-qat-GGUF
(the UD-Q4_K_XL quant was used here). This head is only a draft for that model and does nothing on its own.unsloth/gemma-4-26B-A4B-it-qat-GGUF
(file gemma-4-26B-A4B-it-qat-UD-Q4_K_XL.gguf):1hf download unsloth/gemma-4-26B-A4B-it-qat-GGUF gemma-4-26B-A4B-it-qat-UD-Q4_K_XL.gguf --local-dir .
2hf download superbonyx/gemma-4-26B-A4B-it-qat-assistant-MTP-Q8_0.gguf gemma-4-26B-A4B-it-qat-assistant-MTP-Q8_0.gguf --local-dir .1llama-server \
2 -m gemma-4-26B-A4B-it-qat-UD-Q4_K_XL.gguf \
3 --spec-type draft-mtp \
4 --spec-draft-model gemma-4-26B-A4B-it-qat-assistant-MTP-Q8_0.gguf \
5 --spec-draft-n-max 3 \
6 --draft-p-min 0.75 \
7 -ngl 99 -fa on--spec-type draft-mtp tells llama.cpp to treat the head as an MTP draft (required).--spec-draft-n-max 3 — draft tokens per step.--draft-p-min 0.75 — only accept a drafted token when the head's probability ≥ 0.75 (greedy gate).Note: the older--mtp-model/--mtp-draft-nflag names do not exist; MTP is wired through the speculative-decoding subsystem (--spec-type/--spec-draft-*).
llama-server invocation (and environment) that produced the Benchmark numbers
above — included so the results are reproducible. Several flags are specific to the test box and
can be changed or dropped (see the notes below the block).1# pin to a single GPU (box-specific: index of the target GPU in PCI order)
2export CUDA_DEVICE_ORDER=PCI_BUS_ID
3export CUDA_VISIBLE_DEVICES=1
4
5llama-server \
6 -m gemma-4-26B-A4B-it-qat-UD-Q4_K_XL.gguf \
7 --mmproj mmproj-F16.gguf \
8 --chat-template-file gemma-4-chat_template.jinja \
9 -a gemma4 \
10 --jinja \
11 --reasoning on \
12 --reasoning-budget 32000 \
13 -c 262144 \
14 -ngl 99 \
15 -fa on \
16 -ctk q8_0 -ctv q8_0 \
17 --ctx-checkpoints 0 \
18 --spec-type draft-mtp \
19 --spec-draft-model gemma-4-26B-A4B-it-qat-assistant-MTP-Q8_0.gguf \
20 --spec-draft-n-max 3 \
21 --draft-p-min 0.75 \
22 -sm none -mg 0 \
23 --temp 0.9 --top-k 20 --min-p 0.1 --top-p 1.0 --repeat-penalty 1.0 \
24 --parallel 1 \
25 --host 127.0.0.1 --port 8082--spec-type draft-mtp,
--spec-draft-model …, --spec-draft-n-max 3, --draft-p-min 0.75.--jinja + --chat-template-file (official Gemma 4 template; optional if the
GGUF's embedded one works), --reasoning on --reasoning-budget 32000 (thinking), and the
--temp/--top-k/--min-p/--top-p/--repeat-penalty defaults (clients can override per request).-c 262144 (256K context) is affordable only because of -ctk q8_0 -ctv q8_0
(q8 KV cache) and Gemma's sliding-window attention — lower -c if you're VRAM-limited.--mmproj mmproj-F16.gguf enables image input (Gemma 4 is a VLM); drop it for text-only.CUDA_DEVICE_ORDER / CUDA_VISIBLE_DEVICES and
-sm none -mg 0 select/pin one GPU; --host/--port are local.--ctx-checkpoints 0 dodges an SWA-checkpoint crash seen on this build; omit it
on patched builds.1# from the source bf16 safetensors, with current-master llama.cpp
2python convert_hf_to_gguf.py google/gemma-4-26B-A4B-it-qat-q4_0-unquantized-assistant \
3 --outfile gemma-4-26B-A4B-it-qat-assistant-MTP-Q8_0.gguf --outtype q8_0llama.cpp via PR #23398,
which registers the architecture as gemma4-assistant (hyphen) and expects nextn_predict_layers
plus nextn.pre_projection / nextn.post_projection tensors.gemma4_assistant (underscore) with a different tensor/hparam
schema, and they fail to load on current builds with:error loading model: unknown model architecture: 'gemma4_assistant'convert_hf_to_gguf.py (see
Conversion above), so it has the correct gemma4-assistant arch and nextn_* tensors
and loads on up-to-date llama.cpp.| value | |
|---|---|
| Architecture | gemma4-assistant |
| Quant | Q8_0 (general.file_type = 7) |
| Tensors | 49 (23× Q8_0 weights, 26× F32 norms/scales) |
| Size | ~462 MB |
| Source | google/gemma-4-26B-A4B-it-qat-q4_0-unquantized-assistant (bf16 safetensors) |
gemma-4-26B-A4B-it-qat-q4_0-unquantized-assistant
(Apache-2.0). As a derivative of Gemma 4, use is also subject to Google's
Gemma Terms of Use. Only the quantization (bf16 → Q8_0) and GGUF
packaging were performed here; no weights were retrained or modified.