Skip to content

[GDN] Add configurable output gate activation - #1182

Open
alifurkanstahl wants to merge 2 commits into
fla-org:mainfrom
alifurkanstahl:gdn-output-gate
Open

[GDN] Add configurable output gate activation#1182
alifurkanstahl wants to merge 2 commits into
fla-org:mainfrom
alifurkanstahl:gdn-output-gate

Conversation

@alifurkanstahl

@alifurkanstahl alifurkanstahl commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Add configurable output-gate activation to GatedDeltaNet.

GatedDeltaNet previously used the default SiLU/Swish activation of FusedRMSNormGated. This PR exposes that choice through a new output_gate_activation option supporting swish, silu, and sigmoid.

The option is wired through GatedDeltaNetConfigGatedDeltaNetBlockGatedDeltaNet.

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:

python scripts/find_dependent_tests.py fla/layers/gated_deltanet.py
python scripts/find_dependent_tests.py fla/models/gated_deltanet

Full dependent suite:

python -m pytest \
  tests/layers/test_attn_varlen_pack_layout.py \
  tests/layers/test_gated_deltanet.py \
  tests/layers/test_gated_deltanet_output_gate.py \
  tests/layers/test_layer_cache_layer_idx.py \
  tests/models/test_hybrid_attention.py \
  tests/models/test_modeling_gated_deltanet.py \
  tests/models/test_modeling_yoco.py \
  -q
  • 284 passed in 1100.08s

Additional targeted validation:

  • python -m pytest tests/layers/test_gated_deltanet_output_gate.py -v — 8 passed
  • python -m pytest tests/layers/test_gated_deltanet.py -v — 5 passed
  • python -m pytest tests/layers -k "gated_deltanet or gdn" -v — 14 passed, 42 deselected
  • python -m pytest tests/modules/test_layernorm_gated.py -k "not large_batch" -v — 12 passed, 2 deselected
  • pre-commit run --all-files — passed
  • git diff --check — clean

The 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 GatedDeltaNet layer.

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 swish and existing state dicts are unchanged.

Checklist

  • I have read CONTRIBUTING.md and follow its conventions (code style, docstrings, commit prefixes).
  • I have read AGENTS.md and, where my change matches its scope, the relevant skill under .agents/skills.
  • Dependent tests pass locally or in CI, and new behavior is covered by tests where applicable (tick as N/A for changes with no testable code, e.g. docs-only).
  • Kernel changes include same-hardware before/after benchmark numbers, dense + varlen where applicable (N/A — no kernel code changed).
  • This PR is minor/cosmetic-only (typo, formatting, style-only tweaks) — tick only if it is, and justify below.

@zhiyuan1i zhiyuan1i added enhancement New feature or request minor Low-value-density change (typo/docs/small validation), batch-process labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Low-value-density change (typo/docs/small validation), batch-process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants