Views
No views yet
google/gemma-4-26B-A4B-it using Google's official MTP drafter (gemma-4-26B-A4B-it-assistant), packaged for llama.cpp and LM Studio.| File | Role | Size |
|---|---|---|
gemma-4-26B-A4B-it-Q8_0.gguf | target (26B-A4B MoE, 128 experts) | 26 GB |
gemma-4-26B-A4B-it-assistant-Q2_K.gguf | drafter (recommended) | 278 MB |
gemma-4-26B-A4B-it-assistant-Q4_K_M.gguf | drafter (balanced) | 310 MB |
gemma-4-26B-A4B-it-assistant-Q8_0.gguf | drafter (high-precision) | 440 MB |
gemma-4-26B-A4B-it-assistant-F16.gguf | drafter (reference) | 816 MB |
unsloth/gemma-4-26B-A4B-it-GGUF (Unsloth Dynamic 2.0 quant, Apache-2.0). Drafter built from google/gemma-4-26B-A4B-it-assistant via llama.cpp PR #23398 (am17an, WIP).gemma4-mtp branch — Gemma-4 MTP not yet merged to master.1git clone -b gemma4-mtp https://github.com/am17an/llama.cpp
2cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF
3cmake --build llama.cpp/build -j --target llama-server llama-quantize1llama-server \
2 -m gemma-4-26B-A4B-it-Q8_0.gguf \
3 -md gemma-4-26B-A4B-it-assistant-Q2_K.gguf \
4 --spec-type draft-mtp --spec-draft-n-max 3 \
5 -ngl 99 -c 8192 -fa on \
6 --host 0.0.0.0 --port 80801llama-server \
2 -hf ironbcc/gemma-4-26B-A4B-it-MTP-GGUF \
3 -hfd ironbcc/gemma-4-26B-A4B-it-MTP-GGUF:Q2_K \
4 --spec-type draft-mtp --spec-draft-n-max 3 -ngl 99 -fa ondraft-mtp for Gemma-4 — track upstream merge.)1{
2 "messages": [{"role": "user", "content": "Your prompt"}],
3 "temperature": 1.0, "top_p": 0.95, "top_k": 64,
4 "chat_template_kwargs": {"enable_thinking": false}
5}enable_thinking: false skips <|channel>thought block. +12% throughput, +9 pp accept rate, direct answer.
For reasoning tasks (math, code review), enable thinking — slower but better.| Config | tok/s | Accept |
|---|---|---|
| baseline (no MTP) | 92.5 | — |
| MTP Q8_0 drafter | 121.7 | 65.9% |
| MTP Q4_K_M drafter | 127.9 | 67.7% |
| MTP Q2_K drafter | 131.2 | 70.3% |
| MTP + thinking off | 143.2 | 74.6% |
/api/v1/models for model validation, which llama-server doesn't expose. A 60-line Python shim adapts it.mtp-server.sh1#!/usr/bin/env bash
2set -euo pipefail
3GGUF=~/gemma4-build/gguf
4LLAMA=~/gemma4-build/llama.cpp/build/bin/llama-server
5exec "$LLAMA" \
6 -m "$GGUF/gemma-4-26B-A4B-it-Q8_0.gguf" \
7 -md "$GGUF/gemma-4-26B-A4B-it-assistant-Q2_K.gguf" \
8 --spec-type draft-mtp --spec-draft-n-max 3 \
9 -ngl 99 -c 262144 -fa on \
10 --host 127.0.0.1 --port 8080 \
11 --alias "gemma-4-26B-A4B-it-MTP"-c 262144 = full 256K context (Gemma-4 max). RSS ~31 GB at boot, grows w/ usage. Drop to -c 65536 if low-memory.lmstudio-shim.py1#!/usr/bin/env python3
2"""Reverse proxy adapting llama-server to LM Studio's native API for Hermes."""
3import http.server, json, socketserver, urllib.request, urllib.error, os
4UPSTREAM = os.environ.get("UPSTREAM", "http://127.0.0.1:8080")
5PORT = int(os.environ.get("PORT", "8081"))
6
7class H(http.server.BaseHTTPRequestHandler):
8 def log_message(self, *a): pass
9
10 def _proxy(self, method):
11 body = self.rfile.read(int(self.headers.get("Content-Length") or 0)) or None
12 req = urllib.request.Request(UPSTREAM + self.path, data=body, method=method)
13 for k, v in self.headers.items():
14 if k.lower() not in ("host", "content-length", "transfer-encoding"):
15 req.add_header(k, v)
16 try:
17 r = urllib.request.urlopen(req, timeout=600)
18 self.send_response(r.status)
19 data = r.read()
20 for k, v in r.headers.items():
21 if k.lower() not in ("transfer-encoding", "connection", "content-length"):
22 self.send_header(k, v)
23 self.send_header("Content-Length", str(len(data)))
24 self.end_headers()
25 self.wfile.write(data)
26 except urllib.error.HTTPError as e:
27 body = e.read()
28 self.send_response(e.code)
29 self.send_header("Content-Length", str(len(body)))
30 self.end_headers()
31 self.wfile.write(body)
32
33 def _synth_models(self):
34 with urllib.request.urlopen(UPSTREAM + "/v1/models", timeout=5) as r:
35 src = json.loads(r.read())
36 out = []
37 for m in src.get("data", []):
38 meta = m.get("meta", {}) or {}
39 out.append({
40 "id": m["id"], "type": "llm", "publisher": "ironbcc",
41 "arch": "gemma4", "compatibility_type": "gguf",
42 "quantization": "Q8_0", "state": "loaded",
43 "max_context_length": meta.get("n_ctx_train", 8192),
44 "loaded_context_length": meta.get("n_ctx", 8192),
45 "capabilities": {
46 "reasoning": {"allowed_options": ["off", "low", "medium", "high"]},
47 "chat": True, "tool_use": True,
48 },
49 })
50 r = json.dumps({"object": "list", "data": out, "models": out}).encode()
51 self.send_response(200)
52 self.send_header("Content-Type", "application/json")
53 self.send_header("Content-Length", str(len(r)))
54 self.end_headers()
55 self.wfile.write(r)
56
57 def do_GET(self):
58 if self.path.startswith("/api/v1/models"): return self._synth_models()
59 self._proxy("GET")
60 def do_POST(self):
61 if self.path.startswith("/api/v1/models/load"):
62 r = b'{"ok": true, "already_loaded": true}'
63 self.send_response(200); self.send_header("Content-Length", str(len(r)))
64 self.end_headers(); self.wfile.write(r); return
65 self._proxy("POST")
66 def do_DELETE(self): self._proxy("DELETE")
67 def do_PUT(self): self._proxy("PUT")
68
69class S(socketserver.ThreadingMixIn, http.server.HTTPServer):
70 daemon_threads = True; allow_reuse_address = True
71
72if __name__ == "__main__":
73 print(f"lmstudio-shim :{PORT} -> {UPSTREAM}", flush=True)
74 S(("127.0.0.1", PORT), H).serve_forever()GET /api/v1/models from llama-server's /v1/models, no-ops POST /api/v1/models/load, proxies everything else.1nohup ./mtp-server.sh >/tmp/mtp-srv.log 2>&1 & disown
2nohup python3 ./lmstudio-shim.py >/tmp/mtp-shim.log 2>&1 & disown1curl -s http://127.0.0.1:8081/api/v1/models | jq '.models[].id'
2# -> "gemma-4-26B-A4B-it-MTP"~/.hermes/config.yaml1model_aliases:
2 gemma-4-mtp: { model: gemma-4-26B-A4B-it-MTP, provider: lmstudio, base_url: http://127.0.0.1:8081/v1 }1model:
2 default: gemma-4-26B-A4B-it-MTP
3 provider: lmstudio
4 base_url: http://127.0.0.1:8081/v1hermes --model gemma-4-mtp:8081/api/v1/models for validation → shim returns LM Studio shape with our model id → Hermes accepts → chat goes to :8081/v1/chat/completions → shim proxies to llama-server on :8080.pkill -f "llama-server|lmstudio-shim"google/gemma-4-26B-A4B-it — base model, Google.google/gemma-4-26B-A4B-it-assistant — MTP drafter, Google.unsloth/gemma-4-26B-A4B-it-GGUF — target Q8_0, Unsloth (Dynamic 2.0 quant).