Skip to content

[multi-lora v2 1/7] LoRA model extension and slot actor - #2840

Merged
yueming-yuan merged 1 commit into
mainfrom
yueming/lora-slot-executor
Sep 16, 2026
Merged

yueming-yuan merged 1 commit into
mainfrom
yueming/lora-slot-executor

Conversation

@yueming-yuan

@yueming-yuan yueming-yuan commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Co-authored with @yushengsu-thu.

Expose command-level training on MultiLoRATrainRayActor in megatron_utils/lora/actor.py: forward_backward accumulates gradients across calls; optim_step(adam_params_by_slot) steps only the requested slots; forward_only_logprobs scores tokens; and load_slot / unload_slot manage slot weights, gradients, and optimizer state.

lora/model.py extends the shared model execution through run_forward_backward, which shares run_forward_backward_pass and setup_train_iteration_config with the existing training path. Adam parameters are applied per request. Successful steps and nonfinite-gradient skips return per-slot outcomes; unknown preparation, optimizer, and collective failures propagate to the existing TrainerCell failure boundary. Slot optimizer construction isolates the base optimizer factory while preserving LayerWise wrapping and FP32 state. The command dispatcher requires one live trainer cell. Existing optimizer tests cover nonfinite skips and propagation of unknown execution failures.

Slot optimizer construction passes the model chunks to LayerWiseDistributedOptimizer so equal-size adapter parameters use Megatron's rank-independent ownership tie-breaker.

Multi-LoRA pool initialization returns the model with no pool optimizer or scheduler. Only per-slot optimizers own training state; scheduler construction is skipped at this layer.

Stacked on #2839.

The multi-LoRA actor inherits the common initialization lifecycle and owns the slot optimizer registry. MegatronTrainRayActor._init_training_state() initializes the ordinary weight updater; the multi-LoRA override initializes slot state. The worker spec selects the subclass only for Megatron multi-LoRA actor workers. Full-model, single-LoRA, FSDP, and critic selection remain unchanged.

Validation:

  • pre-commit run --all-files and the incremental git diff --check passed on this component head.
  • Cascade verification checks that moved methods retain their behavior and that the final trees match the reviewed code. Formatting is committed separately.
  • No new test files were added. The existing worker-class selection test now covers the multi-LoRA actor and preserves the critic's backend selection.
  • Fresh CPU/GPU CI is pending. Combined validation and limitations are recorded on [DO NOT MERGE] stacked multi-lora full PR #2846 and Unify HF snapshot and checkpoint writing #3198.

ci-megatron-pr: 73b54618f7e58e0f25f619bcfecbe2640765475a
ci-sglang-pr: 02b5e123c490c988d21526d0dd7837fefdd0e1da

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 39c2bdd to 45af3dd Compare August 31, 2026 22:58
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from be5c361 to d771af3 Compare August 31, 2026 23:51
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch 4 times, most recently from 1e74a23 to 66df86e Compare September 1, 2026 03:40
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from e39c600 to ea9558c Compare September 1, 2026 05:27
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 66df86e to 32dce20 Compare September 1, 2026 05:27
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from ea9558c to 5c2180e Compare September 1, 2026 19:29
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch 2 times, most recently from d945039 to 1904fbd Compare September 1, 2026 20:31
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from b44046d to 5e06b46 Compare September 2, 2026 22:04
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 1904fbd to 02b28fe Compare September 2, 2026 22:04
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from 5e06b46 to f7337fe Compare September 4, 2026 08:55
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 02b28fe to d27005a Compare September 4, 2026 08:56
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from f7337fe to b39a37f Compare September 4, 2026 09:00
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from d27005a to 02a00ff Compare September 4, 2026 09:00
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from b39a37f to f877f6b Compare September 4, 2026 09:06
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 02a00ff to cd9b495 Compare September 4, 2026 09:06
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from f877f6b to c600910 Compare September 7, 2026 06:34
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from cd9b495 to fc90082 Compare September 7, 2026 06:34
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from c600910 to a8c5d92 Compare September 7, 2026 06:53
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from fc90082 to 49a5912 Compare September 7, 2026 06:53
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from a8c5d92 to fdb1654 Compare September 7, 2026 19:29
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 49a5912 to a6389d2 Compare September 7, 2026 19:29
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from fdb1654 to f4a913c Compare September 9, 2026 05:47
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch 5 times, most recently from 4854a3c to cde2ba3 Compare September 9, 2026 23:12
@yueming-yuan yueming-yuan changed the title [multi-lora v2 1/6] Multi-LoRA slot executor [multi-lora v2 1/7] Multi-LoRA slot executor Sep 9, 2026
@yueming-yuan
yueming-yuan force-pushed the yueming/remove-multi-lora-v1 branch from a37a8da to b6d331f Compare September 10, 2026 21:32
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch 2 times, most recently from 591ceb8 to dc23025 Compare September 14, 2026 21:41
@yueming-yuan yueming-yuan changed the title [multi-lora v2 1/7] Multi-LoRA slot executor [multi-lora v2 1/7] LoRA model extension and slot actor Sep 14, 2026
@yueming-yuan yueming-yuan mentioned this pull request Sep 15, 2026
7 of 15 tasks
@yueming-yuan
yueming-yuan removed this pull request from stack #3278 September 16, 2026 08:22
@yueming-yuan
yueming-yuan changed the base branch from yueming/remove-multi-lora-v1 to main September 16, 2026 08:23
@yueming-yuan
yueming-yuan force-pushed the yueming/lora-slot-executor branch from 4a2d856 to 28c3602 Compare September 16, 2026 08:24
@yueming-yuan
yueming-yuan merged commit c747e8e into main Sep 16, 2026
7 of 8 checks passed
@yueming-yuan
yueming-yuan deleted the yueming/lora-slot-executor branch September 16, 2026 08:25
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.

3 participants