Repository navigation
Add MTP for GLM-5.3-Flash - #27917
timkhronos wants to merge 31 commits into
Conversation
…ed up long context decode, fla, and slight MTP improvements.
|
Spent a few hours benchmarking this branch on a 4-GPU box and figured the numbers might be useful. Thanks for the MTP work — the long-context decode fix in d2fc716 made a big difference. Benchmarks 4× 48GB Ampere, -sm layer -fa on, UD-IQ4_XS:
Cold prefill on an actual 45k prompt comes out around 492 t/s. The -d numbers are marginal cost at full depth, so they read much lower than what you see prefilling a growing context. For comparison, the same benchmark on #27773 and on Unsloth's glm5next/upstream gives 13.8–14.0 t/s at 32k versus your 22.3. Prefill is identical across all three, so d2fc716 looks decode-specific. MTP came out slower for me, which surprised me. With --spec-type draft-mtp: 19.0 t/s at --spec-draft-n-max 1 (77.6% acceptance) and 16.4 at 3 (58.5%), against 25.0 with no speculation. Everything was in VRAM, so I assume the draft overhead only pays for itself when each target pass is expensive enough — which would match your CPU-offload setup. One other thing worth knowing: --override-kv glm5next.attention.indexer.top_k=int:1024 gets about +7.5% decode with no measurable prefill change. Fits the idea that prefill is dominated by the indexer scoring pass rather than attention over the selected keys. Investigation and write-up done with Claude Opus 5. |
Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
85aafaf to
9ed11f1
Compare
|
@timkhronos just a heads up that after merging Hy4-preview support global tensor map now contains HC tensors (same that you wanted to add), so you can add your maping entries there, also looks like there are some other conflicts to solve (in the MTP PR). |
|
Cross-ref: #27773 / timkhronos#11 (k-pool softmax gridDim.y fix at 262k context). CC @timkhronos |
…, final numbers
|
Needs rebase now that glm5-next landed. |
…port; ci : fix windows/macos/rocm builds
|
Crash report: abort in draft-mtp path on long prompts (~18K tokens) — ROCm/gfx906, 5× MI50 Thanks for this PR — short-form results are excellent on my hardware (detailed below). Sharing a reproducible crash in the hope it helps. Environment: llama.cpp built from this PR head (HIP backend, What works: short prompts + 256-token generations are stable and fast. Measured vs. 11.7 t/s undrafted baseline:
What crashes: any request with a long prompt (~18K tokens in our repro) aborts the server during decode, at both Stack trace (tail): Repro: build PR head for HIP/gfx906 → llama-server with the flags above → send a chat completion whose prompt is ≥ ~16-18K tokens. Happy to run patched builds or provide fuller logs/core details if useful — this is a standing 5×MI50 test rig. |
…, final numbers
- llama-arch.cpp: drop the duplicated GLM5_NEXT case - llama-context.cpp: GLM MTP index-share entry points are inert (upstream GLM5-Next has no MTP yet; the follow-up is PR ggml-org#27917) - speculative.cpp: index-share helpers take common_batch and return false - common.cpp: moe-mode file path with the path-returning fs_get_cache_directory()
Overview
Adds the NextN draft head for GLM-5.3-Flash
Builds on #27773, which does convert the Nextn tensors, but leaves them unused.
Additional information
Enable
--spec-type draft-mtpfor glm5-next.Also implements index_share_for_mtp_iteration which is true in the GLM 5.3 Flash config. The draft head computes its indexer selection once, then reuses it across each call, instead of rebuilding.
Measured draft acceptance rate with the layer quantized to Q4 (I will also test with Q8):
On my heavily CPU offloaded setup, with draft max 3 I am getting roughly 15-30% speedup with MTP enabled.
Requirements