Read the equation
The adjusted expert scores outside the selected groups are masked to negative infinity. Top-k then returns eight expert indices among the 128 eligible entries. The group restriction means this is generally different from simply choosing the globally largest eight scores.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| topk_idx | Eight chosen expert indices per token |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
5. group_idx = topk(group_scores, k=4) -> (T, 4)
Only 4 of 8 groups survive; the other 4 (128 experts) are masked to -inf.
6. topk_idx = topk( masked scores_for_choice , k=8 ) -> (T, 8)
The 8 experts are chosen among the 128 that remain.
7. topk_weight = scores.gather(1, topk_idx)
*** Weights are gathered from `scores` - the PRE-bias sigmoid - while theExact original notation
topk_idx = topk( masked scores_for_choice , k=8 ) -> (T, 8)
Related builds
Sources & provenance
topk_idx = topk( masked scores_for_choice , k=8 ) -> (T, 8)
topk_idx = topk( masked scores_for_choice , k=8 ) -> (T, 8)