[Bugfix] Restore unloaded FP8 scale params during layerwise reload - #45835
Closed
aoshen02 wants to merge 1 commit into
Closed
[Bugfix] Restore unloaded FP8 scale params during layerwise reload#45835aoshen02 wants to merge 1 commit into
aoshen02 wants to merge 1 commit into
Conversation
When external weight sync (e.g. from RL training frameworks) provides FP8 weights without scale_inv tensors, layerwise reload leaves these scale parameters as uninitialized torch.empty (NaN). The subsequent process_weights_after_loading reads the NaN scales and passes them to the MoE kernel, producing all-NaN inference output. Fix: after replaying buffered weights, check for parameters that were not loaded during this reload cycle. If they contain NaN and we have previously saved kernel tensors (from before reload), restore the valid scale values. This ensures process_weights_after_loading always sees valid scales regardless of what the external weight provider sends. Affects: FP8 blockwise MoE models (e.g. Qwen3-30B-A3B-FP8) when used with RL frameworks that sync trainer weights to vLLM via start_weight_update / update_weights APIs. Related: #41670 Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: aoshen02 <aoshen@inferact.ai>
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.
Summary
scale_invtensors during layerwise reloadRoot cause
When RL training frameworks sync FP8 MoE weights to vLLM via
start_weight_update/update_weights, they may send only the weight data withoutscale_invtensors. During layerwise reload:materialize_layerallocates scale params astorch.empty(contains NaN)process_weights_after_loadingreads NaN scales and passes them to the MoE kernelThe fix checks for unloaded parameters after replay. If they contain NaN and previously saved kernel tensors exist (from before reload), it restores the valid scale values.
Not duplicating existing PRs
Test plan
start_weight_update+update_weightswith weights only (no scale_inv), verify NaN before fixAI assistance disclosure
This fix was developed with AI assistance (Claude). The human submitter has reviewed all changed lines and understands the fix end-to-end.
Related: #41670