Repository navigation
[PEFT] feat: reduce LoRA sequence-parallel activation memory - #4581
Conversation
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Signed-off-by: Chen Cui <chcui@nvidia.com>
Light Code ReviewClean implementation with thorough fallback guards and good test coverage. Observations
No critical bugs or logic errors found. The eligibility gates are conservative and well-tested. The TE integration (toggling Suggested test casesNo perf tests impacted. |
Signed-off-by: Chen Cui <chcui@nvidia.com>
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/nvskills-ci |
Signed-off-by: nvskills-svc-account <svc-nvskills-signing@nvidia.com>
|
/ok to test 323fc4c |
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/nvskills-ci |
|
/ok to test 4026628 |
Signed-off-by: nvskills-svc-account <svc-nvskills-signing@nvidia.com>
|
/ok to test eacb624 |
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/ok to test 337243e |
|
/nvskills-ci |
…NeMo#4581) Signed-off-by: Chen Cui <chcui@nvidia.com> Signed-off-by: nvskills-svc-account <svc-nvskills-signing@nvidia.com> Co-authored-by: nvskills-svc-account <svc-nvskills-signing@nvidia.com>
What changed
LoRA(sequence_parallel_input_regather=True).Why
The existing LoRA sequence-parallel path gathers the full LayerNorm output before LoRA-A. Because LoRA-A is trainable, autograd retains that full gathered activation until backward, materially increasing peak memory.
With this option, the full LoRA-A input is gathered temporarily in forward and released after the LoRA-A computation. Megatron-Core retains only the local
S / TPshard, issues an asynchronous all-gather during backward for the LoRA-A weight gradient, overlaps that communication with dgrad compute, and uses its existing reduce-scatter/wgrad scheduling. It adds no custom autograd and does not modify the Megatron-Core submodule.Scope and compatibility
Validation
uv run --no-sync pre-commit run --all-filesmain_gradparityReal-model H100 training measurements using real checkpoints and SQuAD:
All measured training runs had finite losses with zero skipped or NaN iterations.