Skip to content

Conversation

@CodersAcademy006
Copy link
Contributor

This PR updates compute_routing_scores_for_aux_loss to perform sigmoid routing score calculations in float32, matching the existing behavior of the softmax path.

Fixes #2741

Currently, the softmax routing path explicitly casts to float32 to avoid underflow/overflow in BF16/FP16. However, the sigmoid path performs operations in the input dtype.

While sigmoid is bounded [0, 1], the subsequent normalization (scores / sum) involves accumulation that can suffer from precision loss in BF16, especially with a large number of experts. This change aligns both methods to use high-precision accumulation for auxiliary loss stability.

@CodersAcademy006 CodersAcademy006 requested review from a team as code owners December 26, 2025 11:46
@copy-pr-bot
Copy link

copy-pr-bot bot commented Dec 26, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaox12 yaox12 added the Expert Review Apply this label to indicate that your PR is ready for expert review. label Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request Expert Review Apply this label to indicate that your PR is ready for expert review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QUESTION] MoE score precision

2 participants