[GH-ISSUE #17] Potential Normalization Issue in Expert Relevance Score Calculation #14

Closed
opened 2026-10-26 21:06:44 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @HowardZorn on GitHub (Apr 24, 2025).
Original GitHub issue: https://github.com/deepseek-ai/ESFT/issues/17

Hi,

I noticed there appears to be a discrepancy between the paper and the implementation regarding the normalization of expert relevance scores. In the paper, the average gate score $g_i^l$​ and token selection ratio r_i^l​ are normalized by the number of tokens:

g^l_i = \frac{1}{N_s} \sum_{j = 1}^{N_s} \frac{1}{L_j} \sum_{k = 1}^{L_j} g^l_{i,k}, 
r^l_i = \frac{1}{N_s} \sum_{j = 1}^{N_s} \frac{1}{L_j} \sum_{k = 1}^{L_j} \frac{\mathbb{1}(g^l_{i,k}>0)}{K},

However, these scores seem to be normalized along the layers instead in this repository.

github.com/deepseek-ai/ESFT@579a7711e4/scripts/expert/generate_expert_config.py (L15-L40)

I wanted to bring this to your attention as it might be an unintentional inconsistency. Could you kindly verify whether this is the intended behavior?

I hope this message finds you well.

Fw[a]rd.

Originally created by @HowardZorn on GitHub (Apr 24, 2025). Original GitHub issue: https://github.com/deepseek-ai/ESFT/issues/17 Hi, I noticed there appears to be a discrepancy between the paper and the implementation regarding the normalization of expert relevance scores. In the paper, the average gate score $g_i^l$​ and token selection ratio $r_i^l​$ are normalized by the number of tokens: $$g^l_i = \frac{1}{N_s} \sum_{j = 1}^{N_s} \frac{1}{L_j} \sum_{k = 1}^{L_j} g^l_{i,k}, $$ $$r^l_i = \frac{1}{N_s} \sum_{j = 1}^{N_s} \frac{1}{L_j} \sum_{k = 1}^{L_j} \frac{\mathbb{1}(g^l_{i,k}>0)}{K},$$ However, these scores seem to be normalized along the layers instead in this repository. https://github.com/deepseek-ai/ESFT/blob/579a7711e4b332b4c57b47e378a0cf240d85caa6/scripts/expert/generate_expert_config.py#L15-L40 I wanted to bring this to your attention as it might be an unintentional inconsistency. Could you kindly verify whether this is the intended behavior? I hope this message finds you well. Fw[a]rd.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/ESFT#14
No description provided.