Add native DSpark speculative decoding - #1914
Draft
Blaizzy wants to merge 3 commits into
Draft
Conversation
Blaizzy
force-pushed
the
pc/dspark-qwen38
branch
from
August 20, 2026 19:45
1c9771f to
952ed60
Compare
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.
Summary
RadixArk/Qwen3.8-27B-DSpark--draft-kind dsparkplus load-time--draft-bitsquantizationRoot cause and memory fix
Qwen3.5/3.8 previously coupled hidden-layer capture with Gated DeltaNet rollback capture. DSpark prefill only needs five hidden-state taps, but a 1k prompt retained per-token rollback intermediates across all 48 linear-attention layers. This could require more than 150 GB before other activations and caused unchunked prefill to be killed.
This change separates hidden capture from rollback-state capture. Rollback intermediates are now retained only for short speculative verification rounds. It also explicitly collects and clears the dense BF16 drafter tensors after load-time quantization.
Impact
On an Apple M5 Max with 48 GB unified memory, using Qwen3.8-27B-4bit with a fixed three-proposal DSpark block:
The quantized drafter's live parameter footprint is about 0.765 GB after reclaiming the dense load-time copy.
Validation
162 passed, 1 deselectedinmlx_vlm/tests/test_speculative.py31 passedtargeted server and prompt testsgit diff --checkpassedThe deselected speculative test is the existing exact-BF16 quantized-linear equality check; it remains unrelated to DSpark and differs only in numerical accumulation.