feat(qwen38): add opt-in adaptive depth for native MTP - #347
Open
davidtai wants to merge 62 commits into
Open
Conversation
added 10 commits
August 25, 2026 12:43
Contributor
Author
|
Sorry, sol randomly openned two prs. This is the definitive one. |
davidtai
marked this pull request as draft
August 26, 2026 00:53
added 16 commits
August 25, 2026 19:57
added 28 commits
August 25, 2026 22:15
davidtai
marked this pull request as ready for review
August 28, 2026 00:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This receipt replaces the earlier campaign. Every measured candidate uses MLX and Metal 0.32.2. The thinking matrices use a 1,024-token same-prompt conditioner, the Qwen thinking template, temperature 1.0, top-p 0.95, top-k 20, seed 42, and exactly 1,024 generated tokens. The x-axis is input-prefill length—not output length.
The optimized fixed-K3 lane uses the matched optimized route and remains pinned at K=3 without executing adaptive depth. Adaptive BF16 and Adaptive Q4 use the same workload-specific optimized profile plus the existing
--adaptive-policy position_ematoggle. The v2.9.2 lane is exact sourcebbc67427e88288001e4b90ecb44708dc0222154cwith only MLX/Metal upgraded. DFlash2 is exact source9a6f48e69f9c8c6932d0f005c364844b2bf33e9c.Every current native lane other than v2.9.2 uses a measured optimized shared profile. Low uses
r20_kv_only_history+r53_command_buffers+r08_device_draft+r10_compact_vocab+r21_qk_rms_rope+r24_eval_ladder+r26_prefill_ladder_3; xhigh usesr20_kv_only_history+r24_eval_ladder+r26_prefill_ladder_3+r50_wired_residency+r53_command_buffers. Fixed K3 uses the applicable shared profile withoutr11; Adaptive BF16 addsr11_position_ema; Adaptive Q4 addsr11_position_ema+r17_q4_mtp_block. DFlash2 uses its separate PR335 optimized comparator path.The custom Q4 head is retained for further benchmarking but is not published: it wins low at 1K and 16K, then loses low at 64K and 128K and loses three of four xhigh rows. That matched evidence does not justify a supported artifact yet.
Winner highlights use lowest wall time at each input/prefill size. The charts still plot decode tok/s; their gold outline marks the wall-time winner.
100-token temperature-zero vanity prompt
No conditioner or prefill-generation pass is used. All five candidates stop naturally at the same 102-token output.
Thinking=low — 1,024 output tokens
Thinking=xhigh — 1,024 output tokens
DFlash2 is intentionally measured only at the 1K-input xhigh row.
128K adaptive-depth telemetry
Attempted and accepted shares are speculative decode-cycle shares derived from the recorded schedule events; they are not shares of wall time. Fixed K3 is excluded because it remains pinned at depth 3 and never executes the adaptive policy.
Thinking=low
Thinking=xhigh
Reproducibility
qwen38-native-mtp-four-series-data.jsonis the canonical source for every number in these tables and both charts. The JSON records the SHA-256 identity of every aggregate receipt. The chart bars carry the exact canonical decode value indata-value, and the focused test mechanically compares every plotted bar with the JSON row.