Repository navigation
[TRTLLM-14497][feat] Add BF16/FP8 refit for qwen3.5_397b - #16642
Conversation
WalkthroughChangesPartial weight updates
Kernel input alignment
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant WorkerExtension
participant ModelLoader
participant Qwen3_5MoeHfWeightMapper
participant Qwen3_5VLModel
WorkerExtension->>ModelLoader: begin_update_weights()
WorkerExtension->>Qwen3_5VLModel: load_weights(..., allow_partial_loading=True)
Qwen3_5VLModel->>Qwen3_5MoeHfWeightMapper: preprocess_weights(..., allow_partial_loading=True)
Qwen3_5MoeHfWeightMapper->>Qwen3_5MoeHfWeightMapper: stage split projection tensors
WorkerExtension->>ModelLoader: finalize_update_weights()
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unittest/_torch/modeling/test_qwen3_5_partial_loading.py (1)
66-113: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCoverage looks solid for the ready/waiting staging paths. Optional follow-up: add a small case asserting
finalize_update_weights()raisesRuntimeErrorwhen a group is left incomplete (e.g., onlyqkv.weightstaged), and one for the duplicate-weightRuntimeErrorpath in_stage_partial_split_projections, to lock in the error contracts.As per path instructions (act as a QA engineer reviewing test changes and coverage), current coverage is sufficient for the happy paths but the negative/error paths of the new lifecycle are untested.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unittest/_torch/modeling/test_qwen3_5_partial_loading.py` around lines 66 - 113, Add negative-path tests for the partial projection lifecycle: verify finalize_update_weights() raises RuntimeError when only qkv.weight is staged, and verify _stage_partial_split_projections raises RuntimeError when a duplicate weight is staged. Keep the existing ready/waiting coverage unchanged and assert the documented error contracts.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unittest/_torch/modeling/test_qwen3_5_partial_loading.py`:
- Around line 66-113: Add negative-path tests for the partial projection
lifecycle: verify finalize_update_weights() raises RuntimeError when only
qkv.weight is staged, and verify _stage_partial_split_projections raises
RuntimeError when a duplicate weight is staged. Keep the existing ready/waiting
coverage unchanged and assert the documented error contracts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 16c13fb3-a4f4-4131-b593-5de6af450abe
📒 Files selected for processing (11)
tensorrt_llm/_torch/models/checkpoints/base_weight_mapper.pytensorrt_llm/_torch/models/checkpoints/hf/qwen3_5_weight_mapper.pytensorrt_llm/_torch/models/checkpoints/hf/qwen3_next_weight_mapper.pytensorrt_llm/_torch/models/modeling_qwen3_5.pytensorrt_llm/_torch/models/modeling_qwen3_next.pytensorrt_llm/_torch/models/modeling_qwen3vl.pytensorrt_llm/_torch/modules/fla/fused_sigmoid_gating_recurrent.pytensorrt_llm/_torch/pyexecutor/model_loader.pytensorrt_llm/llmapi/rlhf_utils.pytests/unittest/_torch/modeling/test_qwen3_5_partial_loading.pytests/unittest/_torch/ray_orchestrator/multi_gpu/test_llm_update_weights_multi_gpu.py
983e7ff to
328b49b
Compare
328b49b to
2364c76
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #62581 [ run ] triggered by Bot. Commit: |
|
/bot kill |
|
PR_Github #62587 [ kill ] triggered by Bot. Commit: |
|
PR_Github/16642-0f6ab1e #62581 was force-killed by a newer pipeline run. |
|
PR_Github #62587 [ kill ] completed with state |
dpitman-nvda
left a comment
There was a problem hiding this comment.
Approval for infra
Signed-off-by: Erin Ho <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #62624 [ run ] triggered by Bot. Commit: |
BowenFu
left a comment
There was a problem hiding this comment.
Reviewed the current head. The incremental refit lifecycle and Qwen3.5 BF16/FP8 checkpoint paths look sound for the targeted MLPerf workflow.
|
PR_Github #62624 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #62778 [ run ] triggered by Bot. Commit: |
|
PR_Github #62778 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #63081 [ run ] triggered by Bot. Commit: |
|
PR_Github #63082 [ run ] triggered by Bot. Commit: |
|
PR_Github #63081 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #63087 [ run ] triggered by Bot. Commit: |
|
PR_Github #63082 [ run ] completed with state |
|
PR_Github #63087 [ run ] completed with state |
Signed-off-by: Erin Ho <[email protected]>
Summary by CodeRabbit
New Features
Bug Fixes
Tests
This change enables incremental BF16 weight refit for the Qwen3.5-397B rollout model.
NeMo-RL transfers a model update through multiple size-bounded buckets, so related Gated
DeltaNet projections_Q/K/V/Z and B/A_may arrive in separate reload() calls. Qwen3.5 must
retain incomplete projection groups across calls, fuse them only when complete, and
validate the complete update before post-load transformations run. The implementation
introduces explicit begin/finalize/abort lifecycle boundaries and preserves in-place
parameter storage required by CUDA Graph replay.
The model-specific behavior is isolated to Qwen3_5MoeHfWeightMapper. The MLPerf 397B
model is currently the only model requiring this cross-bucket staging because of its
Qwen3.5 Gated DeltaNet projection layout and BF16 MoE representation. Other weight
mappers inherit no-op lifecycle methods, so their successful loading and refit behavior
is unchanged. The generic RLHF worker owns the lifecycle calls because only the transport
layer knows the first bucket, finalization boundary, and failure boundary; placing a
397B-specific type check there would couple generic update infrastructure to one model.
The change also fixes a TP8 alignment issue for a small GDN tensor view that can begin on
a 16-byte boundary on odd TP shards, while the CuTe kernel requires 32-byte alignment.
Aligned configurations retain the existing zero-copy path.
Validation covers reduced-depth, production-width Qwen3.5-397B BF16 refit with warm CUDA-
graph execution and post-refit Hugging Face reference-logit comparison:
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.