apple envy moe implementation - #4695
Open
entrpn wants to merge 1 commit into
Open
Conversation
entrpn
requested review from
NuojCheng,
RissyRan,
abhinavclemson,
aireenmei,
bvandermoon,
gagika,
gobbleturk,
huytransformer,
igorts-git,
jiangjy1982,
parambole,
richjames0,
shralex,
shuningjin and
xibinliu
as code owners
July 31, 2026 19:29
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
entrpn
requested review from
A9isha,
SurbhiJainUSC,
darisoy,
dipannita08,
hengtaoguo,
khatwanimohit and
vipannalla
as code owners
July 31, 2026 19:29
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
abhinavclemson
approved these changes
Jul 31, 2026
hengtaoguo
approved these changes
Jul 31, 2026
hengtaoguo
left a comment
Collaborator
There was a problem hiding this comment.
Could you update the PR description? Thanks!
RissyRan
approved these changes
Jul 31, 2026
shuningjin
approved these changes
Jul 31, 2026
Collaborator
|
Is this a new PR? Could you link to the old one for future reference for review comments? |
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.
Description
Implements Apple Envy MoE model as described here
Tests
Envy MoE Parameter Equivalence Report
This report compares the parameter structures of Apple's Envy Switch-Base model between AXLearn and MaxText to verify architectural correctness.
1. Parameter Shape Mapping
Here is the direct mapping of parameter tensors for the 12-layer Switch-Base model (6 repeat blocks of Alternating Dense and Sparse MoE layers):
decoder/emb/token_emb/weight[32768, 1536]token_embedder/embedding(32768, 1536)logits_via_embedding: true)decoder/output_norm/scale[1536]decoder_norm/scale(1536,)self_attention/norm/scale(6, 1536)pre_self_attention_layer_norm/scale(1536, 6)self_attention/attention/i_proj/i_proj/qkv_proj/weight(6, 1536, 36, 128)-
query/kernel(1536, 6, 12, 128)-
key/kernel(1536, 6, 12, 128)-
value/kernel(1536, 6, 12, 128)AXLearn groups QKV along the projection axis:
attention/scale_query/norm/scale(6, 128)attention/scale_key/norm/scale(6, 128)query_norm/scale(128, 6)key_norm/scale(128, 6)self_attention/attention/o_proj/weight(6, 1536, 12, 128)out/kernel(12, 6, 128, 1536)feed_forward/prenorm/scale(6, 1536)post_self_attention_layer_norm/scale(1536, 6)feed_forward/postnorm/scale(6, 1536)post_ffw_norm/scale(1536, 6)use_post_ffw_norm: true)feed_forward/linear1_0/weight(6, 1536, 6144)feed_forward/linear1_1/weight(6, 1536, 6144)feed_forward/linear2/weight(6, 6144, 1536)wi_0/kernel(1536, 6, 6144)wi_1/kernel(1536, 6, 6144)wo/kernel(6144, 6, 1536)feed_forward/prenorm/scale(6, 1536)post_self_attention_layer_norm/scale(1536, 6)feed_forward/postnorm/scale(6, 1536)post_ffw_norm/scale(1536, 6)use_post_ffw_norm: true)feed_forward/gate_weight(6, 1536, 128)MoeBlock_0/gate/kernel(1536, 6, 128)feed_forward/wi_0_weight(6, 128, 1536, 6144)feed_forward/wi_1_weight(6, 128, 1536, 6144)feed_forward/wo_weight(6, 128, 6144, 1536)MoeBlock_0/wi_0(128, 6, 1536, 6144)MoeBlock_0/wi_1(128, 6, 1536, 6144)MoeBlock_0/wo(128, 6, 6144, 1536)2. Parameter Counts Analysis
22,077,958,656(22.07B)22,077,958,656(22.07B)0parameters (100% exact match)Key Configurations Enabled:
logits_via_embedding: true: Shares the token embedding parameters with the output logits projection.use_post_ffw_norm: true: Activates the post-FFN normalization layer (post_ffw_normin MaxText, mapping topostnormin AXLearn'shybridnormFFN structure).Ran test:
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.