Skip to content

Add the missing router_logits_dtype for nemotron_h#32875

Closed
cjluo-nv wants to merge 1 commit intovllm-project:mainfrom
cjluo-nv:patch-1
Closed

Add the missing router_logits_dtype for nemotron_h#32875
cjluo-nv wants to merge 1 commit intovllm-project:mainfrom
cjluo-nv:patch-1

Conversation

@cjluo-nv
Copy link
Copy Markdown

@cjluo-nv cjluo-nv commented Jan 22, 2026

Purpose

Nemotron H uses FP32 linear for gate and the router logits are FP32 instead of the default BF16.

This fixes the error triggered

(EngineCore_DP2 pid=147)     return self.forward_impl_chunked(
(EngineCore_DP2 pid=147)            ^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP2 pid=147)   File "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/layers/fused_moe/layer.py", line 1780, in forward_impl_chunked
(EngineCore_DP2 pid=147)     assert self.batched_router_logits.dtype == full_router_logits.dtype
(EngineCore_DP2 pid=147)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Test Plan

Deploy nemotron nano v3 NVFP4 checkpoint and observe the error is gone

Test Result

The error is gone.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Nemotron H uses FP32 linear for gate and the router logits are FP32 instead of the default BF16.

This fixes the error triggered

```
(EngineCore_DP2 pid=147)     return self.forward_impl_chunked(
(EngineCore_DP2 pid=147)            ^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP2 pid=147)   File "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/layers/fused_moe/layer.py", line 1780, in forward_impl_chunked
(EngineCore_DP2 pid=147)     assert self.batched_router_logits.dtype == full_router_logits.dtype
(EngineCore_DP2 pid=147)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Signed-off-by: Chenjie Luo <108829653+cjluo-nv@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses a dtype mismatch in the Nemotron-H model's MoE layers. By explicitly setting router_logits_dtype to self.gate.params_dtype (which is torch.float32), it ensures that the internal router logits buffer in SharedFusedMoE has the same data type as the computed router logits, thus fixing the assertion error. The change is minimal, targeted, and well-justified by the PR description. The code quality is excellent, and I have no further recommendations.

@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@cjluo-nv
Copy link
Copy Markdown
Author

covered by #32669

@cjluo-nv cjluo-nv closed this Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant