Repository navigation
fix(mistral): honor sliding-window attention - #912
Open
taking-lying-flat wants to merge 1 commit into
Open
taking-lying-flat wants to merge 1 commit into
taking-lying-flat wants to merge 1 commit into
Conversation
taking-lying-flat
marked this pull request as ready for review
November 16, 2026 01:51
KarrAcaRn
pushed a commit
to KarrAcaRn/FreeToken-ByAI
that referenced
this pull request
Nov 21, 2026
KarrAcaRn
pushed a commit
to KarrAcaRn/FreeToken-ByAI
that referenced
this pull request
Nov 21, 2026
Batch 2026-11-21 (2): FlashML-org#912 FlashML-org#910 FlashML-org#907 FlashML-org#905 FlashML-org#888 adopted. Assisted-by: Claude Opus 5.5
This branch has not been deployed
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.
Mistral-7B-v0.1declaressliding_window=4096, but the Mistral config parser drops it and the attention forward call passes no window specification. Both prefill and decode therefore use full causal attention. At query position 4096, token 0 is still visible even though it should already be outside the window.Preserve a positive window as an SWA group covering all Mistral layers, and pass it through
AttentionSpecto the existing attention kernels.Declaring that group also selects
HybridSWAKVCache, which currently requires both full-attention and SWA layers. Allow a pure-SWA model by retaining an empty full-attention slab for the existing page geometry and rebuild logic; it allocates no full-attention KV data. Without this adjustment, fixing the configuration would make cache construction fail.For pure-SWA pools with fixed window capacity (
naiveor an explicit SWA capacity), the remaining per-page cost is only the slot mapping. Automatic sizing would otherwise spend the remaining memory on mappings without increasing KV capacity. Cap that logical page count atmax_running_req * ceil(max_seq_len / page_size), while honoring explicit page counts. This cap is limited to automatic sizing in those fixed-capacity, pure-SWA cases.