Repository navigation
qwen27 metal dflash2: opt-in adaptive drafter block for a lone stream - #4628
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/q27-adaptive-block
branch
from
November 22, 2026 15:55
64c42aa to
5774d7f
Compare
Open
1 task done
TF_Q27_DFLASH_ADAPTIVE_BLOCK=1 (default off) lets a lone stream's drafter block take 8 or 16 rows. It starts at 16, narrows to 8 after 8 consecutive rounds landing at most 4 tree drafts, and returns to 16 after a round landing 6 or more. Shared rounds keep 16. Only the drafter's proposal changes. The target still verifies every row and draws each token as before, so target tokens are unchanged. With the switch off, nothing writes the block.
ashhart
force-pushed
the
lead/q27-adaptive-block
branch
from
November 22, 2026 18:37
5774d7f to
3eec579
Compare
ashhart
added a commit
that referenced
this pull request
Nov 22, 2026
4 tasks done
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.
What this changes
Qwen3.8-27B on Metal drafts a lone stream with a 16-row DFlash2 block (
tree_block), while the drafter checkpoint's own block is 8.TF_Q27_DFLASH_ADAPTIVE_BLOCK=1(default off) lets a lone stream switch between 8 and 16 block rows by how deep its recent rounds landed: after a run of shallow rounds it drafts 8 rows, and a round landing 6 or more tokens returns it to 16 at once. New streams start at 16. Shared rounds are unchanged.Exactness
Only the drafter's block length changes, so only which rows the target is asked to verify can change. Every verified row goes through the same target path, and replies stay token-equal to main. With the switch off nothing changes.
Measured
Three M3 Ultras, Qwen3.8-27B MLX 4-bit with its DFlash2 drafter, base = this branch with the switch off, new = on, aggregate tok/s:
One-stream chat gains about 2.5% on every Mac; four streams are unchanged by design (the switch only touches lone streams) and their spread is run-to-run noise.
Tests
Host tests on the block rule over fixed round histories and the off path (
test-qwen27-startup-host) and on the switch's registration (test-environment-host);zig fmt,ast-checkand the lean check.