Repository navigation
Add KPool DSA indexer, NoPE MLA support, and FP8 precision controls for the indexer and MLA attention - #7522
Merged
Merged
Conversation
This was referenced Sep 20, 2026
Merged
HollowMan6
marked this pull request as ready for review
September 20, 2026 00:30
HollowMan6
force-pushed
the
kpool-dsa
branch
from
September 20, 2026 13:51
70caa8c to
2d22683
Compare
This was referenced Sep 20, 2026
Open
HollowMan6
force-pushed
the
kpool-dsa
branch
from
September 22, 2026 11:09
2d22683 to
cf1e921
Compare
buptzyb
reviewed
Sep 22, 2026
buptzyb
left a comment
Contributor
There was a problem hiding this comment.
I think we have to make sure our changes don't break existing models' behaviors. Thanks!
HollowMan6
force-pushed
the
kpool-dsa
branch
2 times, most recently
from
September 22, 2026 19:32
0f82d38 to
3dcc142
Compare
6 of 7 tasks
Contributor
|
/ok to test 073bf15 |
guihong-nv
approved these changes
Oct 12, 2026
Contributor
Author
|
@guihong-nv Fixed the deterministic lint, would you mind retriggering the CI? Thanks! |
Member
|
/ok to test c6deff8 |
Signed-off-by: Hollow Man <hollowman@opensuse.org> Add configurable MLA and DSA indexer quantization policies Make MLA and DSA indexer precision behavior explicit while preserving existing defaults. - Add opt-in quantization control for absorbed MLA projections. - Add independent controls for DSA query/key projections and KPool scoring. - Centralize MLA precision handling across initialization and forward passes. - Validate the unsupported combination of KPool selection and indexer loss. - Remove duplicate sequence-parallel top-k slicing. - Keep linear_weights_proj on the generic path for clean rebasing onto NVIDIA#6842. Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Contributor
|
/ok to test 0e92955 |
14 tasks
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38671332311 |
3 tasks done
4 of 7 tasks
This was referenced Oct 21, 2026
5 of 6 tasks
This branch was previously 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.
What does this PR do?
Add KPool (pooled-key) DSA indexer support, NoPE support for the DSA indexer and absorbed MLA, and opt-in precision controls for matching serving-time precision under FP8 training.
This PR uses the following configuration flags:
dsa_indexer_qk_proj_disable_quantizationdsa_indexer_kpool_use_quantizationmla_proj_disable_quantizationThe DSA weights projection remains on its generic path. Its precision is controlled separately by the weights-projection options introduced by #6842; this PR does not force it to FP32 or unconditionally disable its quantization.
Changes
dsa_indexer_kpool > 1: compress keys in groups ofkpooltokens using a BF16 per-token compression gate and an FP32 per-slot positional bias. Pool selection is performed over compressed keys and expanded back to token indices.dsa_indexer_kpool_always_select_tailappends each query's incomplete causal pool. Packed THD inputs restart pooling at document boundaries. The fused cuDNN DSA path is bypassed for KPool.dsa_indexer_kpool_use_quantization: optionally emulate the serving indexer's quantized KPool scoring inputs. When disabled, KPool scoring uses the unquantized configured dtype.dsa_indexer_qk_proj_disable_quantization: optionally keeps the DSA indexer's query/key projection initialization and GEMMs unquantized, typically in BF16. This flag does not control the weights projection.NoPE support:
qk_pos_emb_head_dim == 0is supported byDSAIndexerandAbsorbedMLAwithout constructing or applying rotary embeddings.mla_proj_disable_quantization: optionally keeps absorbed-MLA projections (q_down,q_up,kv_down, and output projection) unquantized. Core-attention precision is unchanged.Motivation
The actor and rollout implementations must use matching precision for modules whose outputs affect discrete DSA top-k selection or MLA attention scores. These flags allow model bridges to explicitly reproduce the serving precision split while leaving unrelated projections and the rest of the model on their normal quantization path.
Relationship to other PRs
Testing
Relevant tests cover:
Example:
Issue tracking
For PRs from open-source community contributors:
Linked issue: Related to #6392
Contribution process
Pre-checks
jit_fuser/torch.compile, CUDA extension, TE or external-library dispatch, or a scatter/index accumulation), I have added or updated its bit-exact determinism test and registered it intests/unit_tests/determinism/kernels/manifest.py(guide)Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.