Repository navigation
Conversation
…#5765) Adds experimental_attention_variant="gdn2": channel-wise decay/erase/write gates on top of the existing Gated Delta Net (GDN) layer family, backed by fla.ops.gdn2.chunk.chunk_gdn2 (flash-linear-attention >= 0.5.1) with a torch-native deterministic-mode fallback. This is a hand-adapted port, not a literal cherry-pick of upstream commit 0c1fc4c (PR NVIDIA#5765): our common.py/gdn.py base already carry a later, independently-cherry-picked refactor (3549dc6, upstream PR NVIDIA#5843) that generalizes headwise/chunkwise context parallelism, selective recompute of the output norm, and the fused streamed pre-gated-delta-rule path -- none of which existed yet when 0c1fc4c was authored upstream. GatedDeltaNet2 is written against that refactored base (subclassing GatedDeltaNet to reuse its forward()/CP/recompute plumbing) rather than against 0c1fc4c's pre-refactor gdn2.py. Deliberately excluded: - Upstream PR NVIDIA#6645 ("Fused GDN attention support") and its revert NVIDIA#7326: NVIDIA#6645 was merged to upstream/main and then reverted for CI failures, so it is not part of main's current working state. - GDN2 chunkwise context parallelism and gdn_pre_gated_delta_rule_fusion: neither existed in upstream's original GDN2 commit; both are rejected with a clear assertion in _setup_variant_attrs rather than silently mishandled. - Dedicated GDN2 unit test coverage: upstream's test changes targeted the pre-refactor flat test_gated_delta_net.py, which our tree had already split into tests/unit_tests/ssm/gated_delta_net/{test_gdn.py,...}. Porting that coverage is left as a follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UawmJvYe7WkXApRw26ZFMd
Mergeable against |
|
Closing — GDN2 isn't adopted by any open-source model yet (no model attribution found upstream or in this repo; see discussion in this session). Nothing concrete to validate against right now. Can reopen and rebase if/when a model actually ships with it. Note: #110 (KDA) is unaffected — Kimi does use KDA, so that one stays open. Its branch ( |
Adds
experimental_attention_variant="gdn2": channel-wise decay/erase/write gates on top of the existing Gated Delta Net (GDN) layer family, backed byfla.ops.gdn2.chunk.chunk_gdn2(flash-linear-attention >= 0.5.1) with a torch-native deterministic-mode fallback.Not a literal cherry-pick
This is a hand-adapted port of upstream
0c1fc4c5c9(PR NVIDIA#5765), not a direct cherry-pick. Ourcommon.py/gdn.pybase already carries a later, independently-cherry-picked refactor (3549dc62a, upstream PR NVIDIA#5843) that generalizes headwise/chunkwise context parallelism, selective recompute of the output norm, and the fused streamed pre-gated-delta-rule path — none of which existed yet when0c1fc4c5c9was authored upstream.GatedDeltaNet2is written against that refactored base (subclassingGatedDeltaNetto reuse itsforward()/CP/recompute plumbing) rather than against0c1fc4c5c9's pre-refactorgdn2.py.Deliberately excluded
upstream/mainand then reverted for CI failures, so it is not part of main's current working state.gdn_pre_gated_delta_rule_fusion: neither existed in upstream's original GDN2 commit; both are rejected with a clear assertion in_setup_variant_attrsrather than silently mishandled.test_gated_delta_net.py, which our tree had already split intotests/unit_tests/ssm/gated_delta_net/{test_gdn.py,...}. Porting that coverage is left as a follow-up.Validation
Not yet run.
py_compileis clean on every touched file and the static cross-references (base-class method/attribute signatures, config field wiring) have been checked by hand, but this has not been executed — no unit tests, no training smoke test. Needs a GPU box withflash-linear-attention >= 0.5.1(fla.ops.gdn2) before merging.Series
Independent of #port/kda (opened separately), but
port/kdais stacked on top of this branch and will show this commit in its diff until this PR merges.🤖 Generated with Claude Code
https://claude.ai/code/session_01UawmJvYe7WkXApRw26ZFMd