Repository navigation
feat: make native LoRA refit the vLLM default - #3964
Conversation
2690e01 to
cf14810
Compare
fujial-code
left a comment
There was a problem hiding this comment.
No action needed — the own-PR self-review found no blocking or actionable issues at the final head.
Self-review completed for commit cf148103094f6449dd9a838d9550d22c0694c47c using the repository’s /review-pr-team workflow.
The config-convention issue identified during the first pass has been resolved: lora_refit_mode is now required, accessed directly, documented, and tested to fail loudly when missing.
The review covered configuration and algorithm wiring, DTensor A/B export, CUDA-IPC and collective receive paths, vLLM adapter installation and replacement, request propagation, test coverage, configuration parity, and design boundaries. No blocking correctness, security, API, test, documentation, or design findings remain.
Before moving the PR out of Draft, CI:L2 and a matched Nemotron Nano native-vs-merged GPU regression should still be completed, including multi-step gen_kl and basic refit latency/memory checks.
Generated by Codex using the repository’s /review-pr-team workflow.
|
/ok to test cf14810 |
cf14810 to
dfb8fa7
Compare
fujial-code
left a comment
There was a problem hiding this comment.
Actionability: no additional code changes are requested by this self-review.
Self-review completed for commit 5f42cb8b using the repository's /review-pr-team workflow, including independent RL correctness, bug, test, configuration, design, comment, and devil's-advocate passes.
The review covered configuration materialization across GRPO/PPO/distillation/SingleController, DTensor A/B selection, producer dispatch, CUDA-IPC and collective buffer ownership, vLLM adapter creation/replacement and module mapping, LoRARequest propagation through both synchronous generation entry points, unsupported-mode rejection, merged opt-in behavior, documentation, and regression coverage.
The initial review's configuration finding is resolved: lora_refit_mode is explicit for LoRA configurations, validated centrally, documented, and tested to fail loudly when missing. The final devil's-advocate pass also found a stale unit-test call that omitted the newly required collective-refit argument; commit 5f42cb8b fixes that call and a repository-wide search found no equivalent omission. No additional high-confidence correctness, race, API, security, documentation, or test-design blockers remain in the NeMo-RL patch itself.
Static validation passed on the latest-main head: Ruff format/lint for all changed Python files, Python compilation, and git diff --check. The strict matched 50-step A/B completed without OOM, NaN, traceback, or refit failure: native mean/max/final gen_kl_error was 0.002468 / 0.0056 / 0.0021, while merged was 0.019636 / 0.1766 / 0.0157.
The native-LoRA implementation does not depend on Automodel #3845. The matched Nano validation used a Nemotron-specific FP32 load contract; #3845 tracks that model-loading correctness issue independently and is not a merge prerequisite for this PR. Repository CI and the normal maintainer review remain the release gates.
Generated by Codex using the repository's /review-pr-team workflow.
yuki-97
left a comment
There was a problem hiding this comment.
Thanks for this — native A/B refit is a really nice feature. It LGTM.
Scope: full pass at 5f42cb8 — config/schema wiring, the DTensor A/B export, the vLLM adapter install path, docs, and test coverage.
Checked:
- Support matrix — every shipped YAML that reaches
lora_cfg.enabled/megatron_cfg.peft.enabled, resolved throughdefaults:inheritance, plus which line rejects each unsupported cell and how late. - Upstream — the vLLM calls against the pinned v0.25.1 source (
LoRARequest,LoRAModel.from_lora_tensors,PEFTHelper.from_dict, add/remove/activate sequencing), and the LoRA scaling contract against the pinned Automodel. - Reachability — dead and redundant branches, and the reverse direction: which new guards can never fire.
- Coverage — the nightly and functional LoRA recipes, and which refit mode each one actually resolves to.
- Docs — every surface describing the mechanism this PR changes, including files the diff does not touch.
The comments below fall into three themes:
- Default config — flipping the exemplar default to
nativechanges what the shipped recipes, the functional drivers and the non-vLLM backends resolve to; several of them need an explicit mode orforce_hfto keep working. - Config validation — where the checks belong, which of them are backend-independent, and the required-key regression on
lora_refit_mode. - Docs — the LoRA guide describes native's supported set more narrowly than the code enforces it, never says which rollout backend it needs or that Megatron LoRA has to opt out, and the GRPO guide still carries the old merge-weight description.
The remainder are one no-op context manager and a duplicated staging copy.
e42c0ac to
f627798
Compare
f627798 to
1cd104b
Compare
|
/ok to test 1cd104b |
|
/ok to test 9d986d9 |
9d986d9 to
85789b3
Compare
@fujial-code, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 85789b3 |
|
/ok to test 08ad010 |
|
/ok to test 38cc7d3 |
38cc7d3 to
32153e1
Compare
|
/ok to test 32153e1 |
@fujial-code, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 7468117 |
|
/ok to test 3408543 |
yuki-97
left a comment
There was a problem hiding this comment.
Merge blockers — please rebase on main and resolve conflicts.
Thanks for resolving the comments from the previous review.
Scope: fix commits 69689df through 3408543, checked against the open threads from the previous review, plus a scan of the changed files for new issues.
Checked:
- Activation checkpointing — native refit canonicalizes trainable names, and L1 AutoModel runs grpo_automodel_lora.sh on native with AC on.
- vLLM 0.29 — get_rename_mapper is on the native path that L1 run exercised; no get_unstacked_mapper call remains.
- Refit-mode tests — the new dispatch and setup-ordering tests run the production code and fail if the branch or the order changes.
- Draft model after the rebase — the merged path still forwards draft_model, and native with speculative decoding is rejected at setup.
Remaining comments are on:
- The merged nightly's gen_kl_error gates, which predate #4810, and a run of the native Qwen3-8B nightly.
- Native refit silently dropping lm_head from the trained modules for every model.
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
Signed-off-by: fujial-code <[email protected]>
3408543 to
342a2f8
Compare
|
/ok to test 342a2f8 |
What does this PR do?
Makes vLLM native LoRA adapter refit the correctness-first default for supported Automodel LoRA policies, while preserving the previous merged full-state refit implementation as an explicit opt-in.
Native refit (default)
The native path:
LoRARequeston every synchronous generation call;Native refit works with both HF-native and custom Automodel model implementations. It does not require
automodel_kwargs.force_hf: true; an individual recipe may still selectforce_hffor unrelated model-loading or parallelization compatibility.Merged refit (explicit opt-in)
The existing merged behavior remains available without changing its implementation:
This path continues to materialize the full policy state, including
W + scale * B @ A, and sends it through the previous full-weight refit flow. Megatron LoRA recipes explicitly select this compatibility path.Issues
Closes #3696
Usage
Native refit is selected by the shared exemplar configuration for supported Automodel + synchronous vLLM LoRA jobs:
Unsupported native combinations fail during setup with guidance to use
merged. Current exclusions include Megatron LoRA, asynchronous or HTTP-served vLLM, speculative decoding, quantized rollout models, custom refit transports, DoRA, MoE rank scaling, and policies with dynamically updated MoE router bias.Validation
Strict matched 50-step Nemotron Nano V3 A/B
Both arms used:
1814c6c9) withforce_hf: false;The only intentional variable was
policy.generation.lora_refit_mode.train/gen_kl_errorBoth runs completed 50/50 steps and wrote
step_50checkpoints without OOM, NaN/Inf, traceback, or refit failure. The native run stayed in the expected approximately 0.002 KL band, while the unchanged merged path showed the previously observed step-dependent mismatch.Additional checks on the current rebased head:
git diff --check;Before your PR is "Ready for review"
Pre checks: