examples/qwen3: add SwiGLU MLP component with equivalence tests and microbenchmark#267
Open
chhwang wants to merge 1 commit into
Open
examples/qwen3: add SwiGLU MLP component with equivalence tests and microbenchmark#267chhwang wants to merge 1 commit into
chhwang wants to merge 1 commit into
Conversation
…ith SiLU·gate, equivalence test vs torch reference, microbenchmark
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.
examples/qwen3: add SwiGLU MLP component with equivalence tests and microbenchmark
Q5 of the Qwen3-on-ARK component build-out. Three new files, no existing
files modified.
ark_mlp.py—ark_swiglu_mlp()performs gate/up/down projections viatorch.matmuland the SiLU·gate activation viaF.silu(gate) * up.ARK-native
ark_silu_gate(composedark.sigmoid+ark.mul) is retaineddormant: the upstream composed-graph planner bug that crashed Q4 at 4-D
shapes also crashes at the MLP intermediate shape
(2048, 12288). Outputwrapped in
ark.copyfor.eval()API consistency.test_mlp.py— 7 pytest cases gated withskipif(not cuda):test_silu_gate(intermediate activation),test_mlp_small(B=1, S=16),test_mlp_prefill(B=1, S=128),test_mlp_decode(B=1, S=1),test_mlp_batch(B=2, S=16),test_mlp_output_shape, andtest_ark_silu_gate_large_xfail(subprocess spike at(2048, 12288)documenting the upstream bug). Tolerance: atol/rtol=5e-3.
bench_mlp.py— microbenchmark comparing torch eagerSwiGLUMLPvsark_swiglu_mlpat Qwen3-8B shapes (S=2048 prefill, S=1 decode). Bannerlabels output "torch-only (ARK silu·gate deferred to upstream fix / Q10)."
Follows Q4 patterns: torch fallback for crashed ARK ops, small-config tests,
subprocess-isolated xfail for bug documentation.