text stringlengths 0 263 |
|---|
code_python pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.5 |
code_cpp pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.8 |
explain_concept pred= 192 draft= 0 acc= 0 rate=n/a tok/s=56.7 |
summarize pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.4 |
qa_factual pred= 192 draft= 0 acc= 0 rate=n/a tok/s=58.0 |
translation pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.7 |
creative_short pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.9 |
stepwise_math pred= 192 draft= 0 acc= 0 rate=n/a tok/s=57.7 |
long_code_review pred= 192 draft= 0 acc= 0 rate=n/a tok/s=58.5 |
Aggregate: { |
"n_requests": 9, |
"total_predicted": 1728, |
"total_draft": 0, |
"total_draft_accepted": 0, |
"aggregate_accept_rate": null, |
"wall_s_total": 33.38 |
} |
Wrote bench_base.json |
metric A B delta |
aggregate_accept_rate None 0.5619 |
total_predicted 1728 1728 +0 |
total_draft 0 1913 +1913 |
total_draft_accepted 0 1075 +1075 |
wall_s_total 33.38 28.27 -5.1100 |
prompt A B delta |
code_python 0.000 0.546 +0.546 |
code_cpp 0.000 0.370 +0.370 |
explain_concept 0.000 0.615 +0.615 |
summarize 0.000 0.661 +0.661 |
qa_factual 0.000 0.638 +0.638 |
translation 0.000 0.539 +0.539 |
creative_short 0.000 0.520 +0.520 |
stepwise_math 0.000 0.626 +0.626 |
long_code_review 0.000 0.623 +0.623 |
code_python pred= 192 draft= 216 acc= 118 rate=0.546 tok/s=69.8 |
code_cpp pred= 192 draft= 270 acc= 100 rate=0.370 tok/s=56.6 |
explain_concept pred= 192 draft= 200 acc= 123 rate=0.615 tok/s=74.2 |
summarize pred= 192 draft= 192 acc= 127 rate=0.661 tok/s=77.7 |
qa_factual pred= 192 draft= 196 acc= 125 rate=0.638 tok/s=75.5 |
translation pred= 192 draft= 219 acc= 118 rate=0.539 tok/s=68.8 |
creative_short pred= 192 draft= 223 acc= 116 rate=0.520 tok/s=67.7 |
stepwise_math pred= 192 draft= 198 acc= 124 rate=0.626 tok/s=75.1 |
long_code_review pred= 192 draft= 199 acc= 124 rate=0.623 tok/s=75.0 |
Aggregate: { |
"n_requests": 9, |
"total_predicted": 1728, |
"total_draft": 1913, |
"total_draft_accepted": 1075, |
"aggregate_accept_rate": 0.5619, |
"wall_s_total": 28.27 |
} |
Wrote bench_mtp.json |
=== CONTROL-ARCH A/B RESULT (hy_v3 merged-MTP arch, greedy top_k=1 temp=0) === |
prompt 0: DIVERGED (/tmp/ab_ctl/base_0.txt /tmp/ab_ctl/mtp_0.txt differ: byte 75, line 1; base=2075B mtp=1072B) |
prompt 1: DIVERGED (/tmp/ab_ctl/base_1.txt /tmp/ab_ctl/mtp_1.txt differ: byte 251, line 7; base=2059B mtp=1910B) |
prompt 2: DIVERGED (/tmp/ab_ctl/base_2.txt /tmp/ab_ctl/mtp_2.txt differ: byte 362, line 8; base=2041B mtp=2036B) |
prompt 3: DIVERGED (/tmp/ab_ctl/base_3.txt /tmp/ab_ctl/mtp_3.txt differ: byte 33, line 1; base=2206B mtp=2224B) |
prompt 4: DIVERGED (/tmp/ab_ctl/base_4.txt /tmp/ab_ctl/mtp_4.txt differ: byte 588, line 9; base=2156B mtp=2223B) |
--- mtp acceptance lines --- |
0.23.965.443 I slot print_timing: id 3 | task 0 | draft acceptance = 0.20726 ( 97 accepted / 468 generated), mean len = 1.62 |
0.29.441.630 I slot print_timing: id 3 | task 158 | draft acceptance = 0.40118 ( 272 accepted / 678 generated), mean len = 2.20 |
0.34.123.038 I slot print_timing: id 3 | task 387 | draft acceptance = 0.54401 ( 309 accepted / 568 generated), mean len = 2.63 |
0.39.399.935 I slot print_timing: id 3 | task 579 | draft acceptance = 0.43231 ( 281 accepted / 650 generated), mean len = 2.29 |
0.44.791.401 I slot print_timing: id 3 | task 799 | draft acceptance = 0.41654 ( 277 accepted / 665 generated), mean len = 2.25 |
--- mtp init check --- |
0.00.480.834 I srv load_model: loading model '/models/hy3-1M-MTP-IQ2_M.gguf' |
0.23.965.443 I slot print_timing: id 3 | task 0 | draft acceptance = 0.20726 ( 97 accepted / 468 generated), mean len = 1.62 |
0.29.441.630 I slot print_timing: id 3 | task 158 | draft acceptance = 0.40118 ( 272 accepted / 678 generated), mean len = 2.20 |
0.34.123.038 I slot print_timing: id 3 | task 387 | draft acceptance = 0.54401 ( 309 accepted / 568 generated), mean len = 2.63 |
0.39.399.935 I slot print_timing: id 3 | task 579 | draft acceptance = 0.43231 ( 281 accepted / 650 generated), mean len = 2.29 |
0.44.791.401 I slot print_timing: id 3 | task 799 | draft acceptance = 0.41654 ( 277 accepted / 665 generated), mean len = 2.25 |
The wind had a salt-thinned whistle that night, and the lamp in the tower needed no tending—just watching. Elias sat by the window of the lantern room, the glass trembling faintly in its frame, and looked down at the rocks where the tide was crawling in. |
He saw it because the moon was honest: a bottle, green and ribbed, rocking in the foam like a small, stubborn thing that refused to sink. |
He waited for the tide to bring it close, then took his oilskin coat and went down the iron stairs. The beach was cold. He waded to his knees and hooked the bottle with stiff fingers. |
Inside was a scroll of paper, sealed with wax the color of old blood. He uncurled it under the lamp. |
The handwriting was uneven, as if written in a hurry or by someone learning: |
*“If you are reading this, the sea has been kind. I am on the island that is not on any map. The trees here speak if you listen. Tell me what the light looks like from the other side. —M.”* |
Elias read it three times. He had kept this lighthouse for eleven years and had never heard of an unmapped island. He wrote back that same night: |
*“The light looks like a coin dropped into the dark. It does not reach far, but it does not stop. I am the only one here. The sea does not answer, but I do.”* |
He sealed it with the stub of red wax he found in the drawer, the one left by the keeper before him. |
He threw the bottle back the next morning, watching it shrink until it was only a glint. |
For weeks nothing came. Then one storm-tossed dawn, the same green bottle returned, this time with a second scroll folded inside the first. |
*“I heard you. The trees say you are lying about being the only one. They say you are not alone if you are listening. I am sending this into the current and trusting the water. —M.”* |
Elias laughed once, startled, and looked out at the gray heave of the ocean. |
GLM-5.2 (GLM_DSA) NextN/MTP for llama.cpp — validation & wiring audit
Reference evidence for the llama.cpp pull request adding NextN / multi-token-prediction (MTP) speculative decoding for the GLM_DSA architecture (GLM-5.2) as a --spec-type draft-mtp target.
This repository exists so reviewers can inspect the raw correctness and performance evidence directly, rather than taking summary numbers on faith. It contains: the operation-by-operation wiring audit against the vLLM reference, the benchmark scripts and their raw outputs, and the determinism control run.
- Hardware: dual Blackwell workstation — 2× RTX PRO 6000 Blackwell (96 GB each), CUDA 12.9, SM120a,
-sm layer. - Model: GLM-5.2 744B-A40B, IQ1_S (the quant that fits fully in VRAM on this rig).
- Benchmark format: am17an's
mtp-bench.py(9 fixed prompts; the in-tree house format).
1. Decode throughput — MTP vs baseline
Aggregate decode 57.7 → ~79 tok/s ≈ 1.37× greedy, across all nine task types. Every task speeds up; the lowest-acceptance task still matches baseline.
2. Per-position draft acceptance
Greedy, ungated (n_max=3, p_min=0): acceptance 0.834 / 0.653 / 0.494 across the three draft positions, mean accepted length 2.98 tokens. Healthy at all depths, so the framework defaults are the correct configuration for this model — no per-arch p_min override is proposed.
3. Acceptance by task
Aggregate greedy-ungated acceptance 0.6621 (3037 accepted / 4587 drafted over the 9-prompt suite).
4. Acceptance across stacks (context)
Metrics are not identical across stacks — each bar carries its own definition. This is context, not a like-for-like ranking. The vLLM figure is that stack's own published GLM-5 speculator number (per-token mean acceptance at k); ours is aggregate draft_n_accepted / draft_n; the field number is from a real 2-hour agentic coding session.
Numbers table
| Measurement | Condition | Draft acceptance | Notes |
|---|---|---|---|
| Baseline | no spec | — | 57.7 tok/s decode |
| MTP house bench | stochastic sampling, n_max=3, seed 42 |
0.5619 aggregate | mtp-bench.py as-is |
| MTP greedy ungated | temp 0, top_k 1, p_min 0 |
0.6621 aggregate | per-position 0.834 / 0.653 / 0.494, mean len 2.98 |
| MTP field | 2h agentic session, 264K ctx, q4_0 KV | 0.86207 | real Claude Code workload, zero server failures |
Determinism control (why greedy MTP-on ≠ MTP-off byte-for-byte)
Batched speculative verification evaluates N draft tokens' logits in one forward pass; its floating-point reduction order differs from sequential decode, flipping argmax at near-tie tokens. This is framework-level behavior, not specific to this port. The control/ directory holds an A/B on an already-merged draft-mtp architecture (hy_v3, greedy top_k=1 temp=0 seed=42, 5 prompts × 500 tokens): all five prompts diverge identically (first difference as early as byte 33), with the merged arch's own MTP genuinely engaged (acceptance 0.21–0.54). Quality-equivalent, high-acceptance, faster — never claimed byte-identical.
Wiring audit
wiring-audit.md — operation-by-operation comparison of the llama.cpp glm_dsa::graph_mtp graph against vLLM's GLM MTP reference (deepseek_mtp.py, which vLLM routes glm_moe_dsa through). 8 of 9 checklist items are exact matches (embedding, enorm/hnorm, concat order [embed, hidden], eh_proj, attention dims/ranks/scale, MoE gating, shared-head order, next-step hidden recycle). The one flagged divergence: the MTP layer runs dense MLA — matching llama.cpp's own GLM_DSA trunk — where vLLM uses the sparse DSA lightning indexer. This is a pre-existing whole-model design choice in llama.cpp, not an MTP wiring decision, and is disclosed in full.
Contents
charts/ the four figures above (PNG)
benchmarks/ mtp-bench.py, greedy-accept.py, and raw JSON + server-log outputs
control/ hy_v3 determinism A/B run (base vs MTP outputs + result)
wiring-audit.md the full vLLM-reference wiring audit
Reproduce
llama-server -m GLM-5.2-IQ1_S.gguf -ngl 99 -sm layer -c 32768 -np 1 -fa on --jinja [--spec-type draft-mtp]
python3 benchmarks/mtp-bench.py --url http://127.0.0.1:8080 --out bench.json
python3 benchmarks/greedy-accept.py http://127.0.0.1:8080 greedy.json # greedy, ungated
Contribution developed by @satindergrewal. Implementation assisted by an AI system (Anthropic Claude), reviewed and hardware-tested by the author. This repository is a validated reference for the corresponding llama.cpp PR.
- Downloads last month
- 55



