draft: sliding window attention for Qwen3.6 draft model#129
Draft
howard0su wants to merge 1 commit intoLuce-Org:mainfrom
Draft
draft: sliding window attention for Qwen3.6 draft model#129howard0su wants to merge 1 commit intoLuce-Org:mainfrom
howard0su wants to merge 1 commit intoLuce-Org:mainfrom
Conversation
Implement per-layer K/V truncation in the draft graph for SWA layers (Qwen3.6 pattern: layers 0..n-2 use sliding window, last layer full). When --draft-swa=<window> is set and ctx_len > window, SWA layers: - Window target_feat to last <window> positions via ggml_view_3d - Adjust positions_k to start from the window offset - Use eff_total_k = window + q_len for K/V reshape This follows the same K/V truncation approach the target model uses for fa_window, avoiding the broken attn_mask approach from PR Luce-Org#94. Also raises the effective DRAFT_CTX_MAX when SWA is enabled so that ctx_len can exceed the window size and SWA truncation can activate. Usage: --draft-swa=2048 or DFLASH27B_DRAFT_SWA=2048 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
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.

Implement per-layer K/V truncation in the draft graph for SWA layers (Qwen3.6 pattern: layers 0..n-2 use sliding window, last layer full, while Qwen3.5 draft model use all full layers).
When --draft-swa= is set and ctx_len > window, SWA layers:
Also raises the effective DRAFT_CTX_MAX when SWA is enabled so that ctx_len can exceed the window size and SWA truncation can activate.
Usage: --draft-swa=2048 or DFLASH27B_DRAFT_SWA=2048
Benchmark (RTX 2080 Ti, Qwen3.6-27B Q4_K_M + DFlash draft)
Significant AL and throughput improvement at 6K–16K context. No regression on short prompts (HumanEval bench: identical AL at 5.47).