[GDN] Add configurable output gate activation - #1182
Open
alifurkanstahl wants to merge 2 commits into
Open
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.
Summary
Add configurable output-gate activation to
GatedDeltaNet.GatedDeltaNetpreviously used the default SiLU/Swish activation ofFusedRMSNormGated. This PR exposes that choice through a newoutput_gate_activationoption supportingswish,silu, andsigmoid.The option is wired through
GatedDeltaNetConfig→GatedDeltaNetBlock→GatedDeltaNet.This removes the hard-coded output-gate activation from native GatedDeltaNet and allows callers to select sigmoid gating when required by a model architecture.
The default remains
swish, so existing callers and checkpoints are unaffected. No Gated Delta Rule kernel or recurrence is changed.Test plan
Hardware: NVIDIA RTX 5060 Ti
Dependent test files identified with:
Full dependent suite:
Additional targeted validation:
python -m pytest tests/layers/test_gated_deltanet_output_gate.py -v— 8 passedpython -m pytest tests/layers/test_gated_deltanet.py -v— 5 passedpython -m pytest tests/layers -k "gated_deltanet or gdn" -v— 14 passed, 42 deselectedpython -m pytest tests/modules/test_layernorm_gated.py -k "not large_batch" -v— 12 passed, 2 deselectedpre-commit run --all-files— passedgit diff --check— cleanThe new tests cover the default activation, sigmoid/SILU wiring, config serialization, state-dict compatibility, validation, positional config compatibility, and sigmoid forward/backward execution through the native
GatedDeltaNetlayer.Benchmark / NCU (kernel changes only)
N/A — no kernel code changed. This only selects an activation already supported by
FusedRMSNormGated.Breaking changes
None. New optional configuration/constructor argument; the default remains
swishand existing state dicts are unchanged.Checklist