Skip to content

Moe gemma4 changes - #1217

Open
tchawada wants to merge 4 commits into
quic:mainfrom
tchawada:moe_gemma4_changes
Open

Moe gemma4 changes#1217
tchawada wants to merge 4 commits into
quic:mainfrom
tchawada:moe_gemma4_changes

Conversation

@tchawada

Copy link
Copy Markdown
Contributor

Optimized the moe MLP block by processing only the top-K selected experts for each token. The implementation gathers expert-specific projection weights (gate, up, and down), performs batched matrix multiplications across all (token, expert) pairs, applies the gated activation (act_fn(gate) * up), and combines expert outputs using router-provided top-K weights.
Changes are suggested by Mrunal Kshirsagar.

tchawada added 2 commits July 27, 2026 10:44
Signed-off-by: Tanisha Chawada <tchawada@qti.qualcomm.com>
Signed-off-by: Tanisha Chawada <tchawada@qti.qualcomm.com>
@quic-hemagnih
quic-hemagnih requested a review from vbaddi July 27, 2026 05:29

@ochougul ochougul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is accuracy verified? can you paste the result of a test that matches tokens between pt/ort/qaic ?

Comment thread QEfficient/transformers/models/gemma4/modeling_gemma4.py
tchawada added 2 commits July 27, 2026 16:45
Signed-off-by: Tanisha Chawada <tchawada@qti.qualcomm.com>
Signed-off-by: Tanisha Chawada <tchawada@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants