Repository navigation
fix(graph): apply SIGMOID/TANH activations in MoE layer - #736
Merged
jakmro merged 1 commit intoJun 22, 2026
Merged
Conversation
The MoE layer's activation switch only handled GELU, GELU_ERF, RELU and SILU, with SIGMOID and TANH silently falling through to the SILU default. Both activations are valid `Activation` enum values accepted by the `moe_layer` builder and both kernels (cactus_sigmoid_f16 / cactus_tanh_f16) already exist, so a graph built with either produced wrong results. Add the two missing cases and a regression test that runs an identity-weight single-expert MoE layer for every activation and checks the output matches the corresponding standalone activation kernel. Signed-off-by: yus100 <90424373+yus100@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thanks for this, i have assigned a reviewer. |
Contributor
|
nice work stanley |
Contributor
Author
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.
The MoE layer ignored the
SIGMOIDandTANHactivations. Both are valid options on themoe_layerbuilder, but the activation switch had no cases for them, so they silently fell back to SILU and produced wrong results.This adds the two missing cases (the kernels
cactus_sigmoid_f16andcactus_tanh_f16already existed). I also added a test for the MoE layer, which previously had none — it runs each activation through a tiny identity-weight MoE and checks the output matches the standalone activation kernel.Confirmed the test fails before the fix and passes after. Run it with
cactus test graph --suite nn.