Add MoE router similarity and expert fraction distillation metrics#4037
Open
JamesDeng42 wants to merge 1 commit into
Open
Add MoE router similarity and expert fraction distillation metrics#4037JamesDeng42 wants to merge 1 commit into
JamesDeng42 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
c2c649d to
63b6123
Compare
63b6123 to
da39f7c
Compare
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
This PR introduces new metrics for evaluating the quality of Mixture-of-Experts (MoE) distillation. When distilling an MoE teacher into an MoE student, it is critical to understand not just the KL divergence of the final logits, but whether the student's routing decisions align with the teacher's, and how evenly the tokens are distributed across experts.
You can also provide a comma-separated list. If you don't want to close a bug but
simply to reference it, use BUGS, e.g.:
BUGS: b/123456
Key Features:
distill/layer_0_router_similarity_top1).
Tests
Added test_router_similarity_metrics to verify that Top-1 and Top-K similarity ratios correctly ignore padded tokens (pad_id=0) and broadcast properly.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.