[main] [DeepSeek-v4] Hybrid Attention with CSA and HCA - #4867
Conversation
cuichenx
left a comment
There was a problem hiding this comment.
should we onboard the dev branch unit tests to this PR as well?
| """ | ||
| static_inputs = super().get_layer_static_inputs(seq_length, micro_batch_size) | ||
| hs = static_inputs["hidden_states"] | ||
| n = self.config.num_residual_streams |
There was a problem hiding this comment.
Is mHC meant to be included in this PR? I believe this arg is not yet on the main branch. The PR description also doesn't mention mHC
| '"[0,0,4,128,4,128]" or "([0]+[4,128]*2)*3". ' | ||
| 'Each value is the compression ratio for the corresponding ' | ||
| 'transformer layer (valid values: 0, 4, 128). ' | ||
| 'The list length must equal num_layers.') |
There was a problem hiding this comment.
there are a few more CSA arguments not exposed here. is that intentional?
|
Recording the replacement plan for the DeepSeek-V4 HybridModel recut: this historical PR is no longer an active merge path. The authoritative guide is DeepSeek-V4 HybridModel merge plan #5795. The retained functionality is being reconstructed as:
GPTModel experimental specs and wiring are outside the frozen HybridModel-only scope. The original work remains linked from #5795 for provenance and credit. This PR will stay open as a draft reference, and the |
What does this PR do ?
dev PR: #4458
Add DeepSeek-v4 Hybrid Attention with CSA and HCA.
We reuse some arguments from DSA to avoid duplication.
DeepSeek-V4 training has several phases, and here are the setting examples (use DSv4-Flash size):
--experimental-attention-variant dsv4_hybrid--csa-window-size 128--csa-compress-ratios ([0,0,4]+[128,4]*20+[0])--csa-compress-rotary-base: 40000--dsa-indexer-n-heads 64--dsa-indexer-head-dim 128--dsa-indexer-topk 512--csa-dense-mode--experimental-attention-variant dsv4_hybrid--csa-window-size 128--csa-compress-ratios ([0,0,4]+[128,4]*20+[0])--csa-compress-rotary-base: 40000--dsa-indexer-n-heads 64--dsa-indexer-head-dim 128--dsa-indexer-topk 512--experimental-attention-variant dsv4_hybrid--csa-window-size 128--csa-compress-ratios ([0,0,4]+[128,4]*20+[0])--csa-compress-rotary-base: 40000--dsa-indexer-n-heads 64--dsa-indexer-head-dim 128--dsa-indexer-topk 512--dsa-indexer-use-sparse-lossIssue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
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.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.