Commit c98a34e
committed
feat: implement DeepSeek-V4 compressed attention layers (HCA, CSA, LightningIndexer)
Implement compressed attention mechanisms and indexer modules for DeepSeek-V4 integration into MaxText:
- CSACompressor & HCACompressor: Long-range attention compressors supporting causal block bias and YaRN frequency scaling decoupling.
- LightningIndexer: Memory-efficient indexer module implementing sentinel masking and dynamic RoPE scaling.
- Configuration: Register attention compression hyperparameters (compress_ratios, index_head_dim, sliding_window) in types.py and base.yml.
- Parity verification: Extended unit test suite (deepseek_v4_vs_reference_test.py) validating attention compression parity against PyTorch reference implementations at atol=1e-5, rtol=1e-5.1 parent c92f2e0 commit c98a34e
4 files changed
Lines changed: 1501 additions & 26 deletions
File tree
- src/maxtext
- configs
- layers
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
408 | 418 | | |
409 | 419 | | |
410 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
621 | 637 | | |
622 | 638 | | |
623 | 639 | | |
| |||
2224 | 2240 | | |
2225 | 2241 | | |
2226 | 2242 | | |
| 2243 | + | |
2227 | 2244 | | |
2228 | 2245 | | |
2229 | 2246 | | |
| |||
0 commit comments