Add challenge 84: SwiGLU MLP Block (Medium)#221
Open
claude[bot] wants to merge 2 commits intomainfrom
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix overlapping text in SVG: separate gate/up branch labels, add tensor shape annotations at each stage, color-code converging arrows. Convert example from <pre> to LaTeX bmatrix with proper math notation for each intermediate computation step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
kunal-mansukhani
approved these changes
Mar 27, 2026
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
output = (SiLU(x × W_gate) ⊙ (x × W_up)) × W_downsilu(x1)*x2) — this challenge includes all three matrix multiplications and is a self-contained inference building blockrun_challenge.pyWhy this challenge is interesting
Solvers must implement three chained matrix multiplications with a gated nonlinearity in between. The GPU programming challenge is:
[M, d_ffn]efficiently (memory bandwidth)M=512, d_model=4096, d_ffn=14336Checklist
challenge.html
<p>(problem description)<h2>sections: Implementation Requirements, Example, Constraintsgenerate_example_test()(identity-like matrices, output ≈ [[0.7311, 0], [0, 0.7311]])<pre>consistently (1D/sequential data)M = 512, d_model = 4,096, d_ffn = 14,336challenge.py
class ChallengeinheritsChallengeBase__init__with name, atol, rtol, num_gpus, access_tierreference_implhas assertions on shape, dtype, devicegenerate_functional_testreturns 10 cases: edge (1, 2 rows), zero, power-of-2 (16×32, 64×64), non-power-of-2 (30, 100, 255), realistic (128×256, 256×512)generate_performance_testfits 5× in 16GB VRAM (weights ≈ 670MB × 5 = 3.4GB)Starter files
.cu,.pytorch.py,.triton.py,.jax.py,.cute.py,.mojo# return output tensor directlyGeneral
84_swiglu_mlp_blockpre-commit run --all-files🤖 Generated with Claude Code