-
Notifications
You must be signed in to change notification settings - Fork 582
add glm5.2 indexshare #4832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
add glm5.2 indexshare #4832
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fd0e960
feat(glm5.2): add native cross-layer IndexShare and checkpoint conver…
notabee 97318ff
refactor(glm5): isolate GLM decoder layers into models/glm5.py and re…
notabee 874baa2
fix(config): add glm5.2-744b to ModelName Literal in types.py
notabee c984596
fix(glm5): register DecoderBlockType.GLM5 in get_norm_layer, decoder …
notabee 4c2cf74
fix(conversion): transparently resolve missing indexer keys on shared…
notabee 9fc3767
fix(utils): export get_donor_layer_idx in index_share_utils.py
notabee 71a1f3f
fix(conversion): dynamically find matching indexer donor layers from …
notabee 5bdce25
feat(tests): add GLM-5.2 end-to-end conversion and execution test scr…
notabee 3bc1393
feat(glm5.2): explicitly pass IndexShare configuration in test script
notabee 325e42f
feat(eval): add GLM-5.2 sanity evaluation and prompt generation script
notabee 5d47740
feat(xprof): add named scopes glm_full_layer_indexer and glm_shared_l…
notabee edd4688
fix(glm5): initialize default is_shared_layer and served_group_size f…
notabee a5b64e6
feat(glm5.2): enable IndexShare carry in scanned layers execution
notabee 00eb672
fix(profiler): block until ready on active profiled steps to capture …
notabee ecc8152
fix(indexshare): provide invariant concrete dummy tensor structure fo…
notabee 64bc8e5
fix(decoder): fix indentation of scanned use_index_share execution block
notabee 171a6ba
fix(mla): call correct mla_query_projection method
notabee aae73ee
fix(mla): use jax.lax.cond for scanned indexer conditional execution
notabee e55e0a7
fix(indexshare): match exact dummy indexer mask and score shapes and …
notabee 6a07b6e
chore: remove scratch script from repository
notabee b8b5183
fix(glm5.2): address review comments for indexshare and checkpoint co…
notabee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # model config for GLM-5.2 - 744B (Mixture of Experts with Cross-Layer IndexShare) | ||
|
|
||
| base_emb_dim: 6144 | ||
| base_num_query_heads: 64 | ||
| base_num_kv_heads: 64 | ||
| base_mlp_dim: 12288 | ||
| base_moe_mlp_dim: 2048 | ||
|
|
||
| base_num_decoder_layers: 78 | ||
|
|
||
| first_num_dense_layers: 3 | ||
| mlp_activations: ["silu","linear"] | ||
| vocab_size: 154880 | ||
| enable_dropout: false | ||
| logits_via_embedding: false | ||
| normalization_layer_epsilon: 1.0e-5 | ||
| num_experts: 256 | ||
| num_experts_per_tok: 8 | ||
| shared_experts: 1 | ||
| routed_scaling_factor: 2.5 | ||
| routed_score_func: "sigmoid" | ||
| routed_bias: true | ||
| norm_topk_prob: true | ||
| decoder_block: "glm5" | ||
| dtype: "bfloat16" | ||
| weight_dtype: "bfloat16" | ||
|
|
||
| # Multi-head Latent Attention (MLA) | ||
| attention_type: "mla" | ||
| attention: "dot_product" | ||
| q_lora_rank: 2048 | ||
| kv_lora_rank: 512 | ||
| qk_nope_head_dim: 192 | ||
| qk_rope_head_dim: 64 | ||
| v_head_dim: 256 | ||
|
|
||
| # RoPE | ||
| mscale: 1.0 | ||
| rope_type: "default" | ||
| rope_max_timescale: 1000000 # "rope_theta": 1000000 | ||
| max_position_embeddings: 202752 | ||
| rope_interleave: true | ||
|
|
||
| # Indexer for Dynamic Sparse Attention (DSA) | ||
| use_indexer: true | ||
| indexer_n_heads: 32 | ||
| indexer_head_dim: 128 | ||
| indexer_topk: 2048 | ||
|
|
||
| # GLM-5.2 Cross-Layer IndexCache / IndexShare | ||
| use_index_share: true | ||
| index_share_pattern: "FSSS" | ||
| prune_shared_indexers: true |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.