Skip to content

feat(gallery): add Gemma 4 llama.cpp MTP variants; fix gemmable-4-12b-mtp#10876

Merged
mudler merged 1 commit into
masterfrom
feat/gemma4-llamacpp-mtp
Jul 17, 2026
Merged

feat(gallery): add Gemma 4 llama.cpp MTP variants; fix gemmable-4-12b-mtp#10876
mudler merged 1 commit into
masterfrom
feat/gemma4-llamacpp-mtp

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

What

Wire up native llama.cpp Multi-Token Prediction (MTP) speculative decoding for the official Gemma 4 models in the gallery.

Google shipped the Gemma 4 MTP drafter heads and llama.cpp merged native support in ggml-org/llama.cpp#23398 (merged 2026-06-07). LocalAI's pinned llama.cpp is well past that merge and the config plumbing (draft_model + core/config/mtp.go) already exists, but no official Gemma 4 entry used it.

Added (dense sizes, unsloth-sourced: target UD-Q4_K_XL + mtp-*.gguf drafter + BF16 mmproj)

  • gemma-4-e2b-it-qat-mtp
  • gemma-4-e4b-it-qat-mtp
  • gemma-4-12b-it-qat-mtp
  • gemma-4-31b-it-qat-mtp

These replace the previously commented-out/disabled attempts. Those were disabled because the Janvitos/boxwrench drafter GGUFs declared architecture gemma4_assistant (underscore), which stock llama.cpp rejects. The unsloth drafters use the upstream gemma4-assistant (hyphen) spelling that mtp.go's isDraftOnlyAssistantArch expects, so they load without any backend patch (verified by GGUF header inspection).

The 26B-A4B MoE is intentionally omitted — the upstream PR reports no meaningful MTP speedup for it.

Fixed: gemmable-4-12b-mtp

It loaded the draft-only -mtp GGUF as the main model with no draft_model set (a draft-only head cannot run standalone). Now it loads the target as the model, wires the drafter via draft_model, enables spec_type:draft-mtp, and downloads both files.

Verification

  • All sha256 pins taken from the HuggingFace API lfs.oid (reliable content hash even for Xet-backed repos).
  • Drafter architectures confirmed as gemma4-assistant (hyphen) via GGUF header range-fetch.
  • gallery/index.yaml parses; all new entries resolve model/draft/mmproj/files correctly.

Caveats

  • Not runtime smoke-tested (no GPU in the authoring environment). Verification covered arch spelling, sha256, schema, and backend option parsing.
  • Community notes flag a llama.cpp MTP regression window around builds b9702/b9717 (good at b9553) worth checking against the current pin before relying on this in production.

🤖 Generated with Claude Code

…-mtp

Google shipped the Gemma 4 MTP drafter heads and llama.cpp merged native
support in ggml-org/llama.cpp#23398. LocalAI's pinned llama.cpp already
carries it, and the config plumbing (draft_model + core/config/mtp.go)
was built for exactly this path, but no official Gemma 4 gallery entry
wired it up.

Add llama.cpp draft-mtp speculative-decoding variants for the dense
sizes, sourced from the unsloth QAT GGUF repos (target UD-Q4_K_XL +
mtp-*.gguf drafter + BF16 mmproj):

  - gemma-4-e2b-it-qat-mtp
  - gemma-4-e4b-it-qat-mtp
  - gemma-4-12b-it-qat-mtp
  - gemma-4-31b-it-qat-mtp

These replace the previously commented-out attempts, which were disabled
because the Janvitos/boxwrench drafter GGUFs declared the architecture as
`gemma4_assistant` (underscore) and failed to load on stock llama.cpp.
The unsloth drafters use the upstream `gemma4-assistant` (hyphen) spelling
that mtp.go's isDraftOnlyAssistantArch expects, so they load without any
backend patch. The 26B-A4B MoE is intentionally omitted (the upstream PR
reports no meaningful MTP speedup for it).

Also fix gemmable-4-12b-mtp: it loaded the draft-only `-mtp` GGUF as the
main model with no draft_model set, which cannot run standalone. It now
loads the target as the model, wires the drafter via draft_model, enables
spec_type:draft-mtp, and downloads both files.

All sha256 pins were taken from the HuggingFace API lfs.oid (reliable
content hash even for Xet-backed repos).

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-8 [Claude Code]
@mudler
mudler merged commit 0bd7a29 into master Jul 17, 2026
22 checks passed
@mudler
mudler deleted the feat/gemma4-llamacpp-mtp branch July 17, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants