Add configurable GQA and MLA sliding-window draft layers - #767
Draft
maocheng23 wants to merge 2 commits into
Draft
Add configurable GQA and MLA sliding-window draft layers#767maocheng23 wants to merge 2 commits into
maocheng23 wants to merge 2 commits into
Conversation
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.
Dependency
This is a stacked draft on #758. The first commit is the generic MLA support from that PR; after #758 merges, this PR will contain only the SWA configuration delta.
Summary
dflash_config.attention_modeas the backward-compatible uniform GQA/MHA/MLA shorthanddflash_config.attention_modesfor per-layer GQA/MHA/MLA selectionlayer_types/attention_modescontractlayer_typescontinues to selectfull_attentionorsliding_attention; the projection list is paired with it by layer index. The GQA and MLA parameterizations follow the standard layouts used by TorchSpec, while SpecForge's existing DFlash mask and objective interfaces remain unchanged.Example
{ "num_hidden_layers": 4, "layer_types": [ "sliding_attention", "sliding_attention", "full_attention", "full_attention" ], "use_sliding_window": true, "sliding_window": 2048, "dflash_config": { "attention_modes": ["gqa", "mla", "gqa", "mla"] } }Validation