Skip to content

Support shared-outer expert LoRA in Tinker - #3899

Open
yueming-yuan wants to merge 5 commits into
yueming/multilora-grad-accumulationfrom
yueming/multilora-shared-outer
Open

yueming-yuan wants to merge 5 commits into
yueming/multilora-grad-accumulationfrom
yueming/multilora-shared-outer

Conversation

@yueming-yuan

@yueming-yuan yueming-yuan commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Enable --experts-shared-outer-loras for multi-LoRA/Tinker. Each tenant keeps independent factors and Adam state; sampling snapshots use the existing shared-outer adapter format.

Record the expert layout in checkpoint metadata and reject restores under the other layout. Checkpoints written before the field existed are per-expert, since multi-LoRA rejected the shared-outer flag until this PR. Boundary: checkpoints saved by earlier heads of this branch (before 4ba90fe) carry no field and load as per-expert too; the H200 validation checkpoints below are the only such files and are scratch.

Stacked on #4480, which carries the per-request gradient accumulation fix this PR originally included (re-syncing retained expert gradients scaled earlier requests by 1/EP). This PR keeps the shared-outer part: the shared factors are replicated across EP, so their gradients are summed across EP once per request (allreduce_expert_parallel_replicated_grads).

Pins Megatron-Bridge to 2d0aa270 in all three Dockerfiles: radixark/Megatron-Bridge#45 as merged, on top of #50's fused-layer TP gradient fixes. The previous pin, 8cd3466d, rejects experts_shared_outer_loras for MultiLoRA. The H200 table below was measured on this branch at bc020cb with Bridge#45 at cd417d03, i.e. without those fixes; it is kept as the pre-fix record and is not validation of the current heads. At the current head, tests/e2e/lora/test_shared_outer_slots.py passes against Bridge 2d0aa270 on 2× B200 (TP1/EP2), and at Bridge#45's head on TP1/EP2 and TP2/EP2. No Megatron-Core or SGLang changes required. SGLang's fused shared-expert combination remains unsupported.

H200 validation: Qwen3.5-35B-A3B, 3 tenants, rank16/alpha32, train TP2/EP4 + inference TP4. Each tenant trained on a distinct fixed 8,192-token DAPO sequence with CE and Adam lr=1e-5 for 50 steps.

Tenant Training NLL: step 1 → 50 SGLang prompt NLL: base → trained
0 0.926204 → 0.214607 1.159517 → 0.318825
1 0.950774 → 0.242959 1.241800 → 0.333805
2 0.978503 → 0.233334 1.058517 → 0.212997

Sampling used 512-token prefixes and a resumed step-51 snapshot. All tenants generated successfully. Checkpoint restore matched all 1,920 tensors/tenant exactly, including FP32 masters and Adam state. Repeated-forward logprobs varied even without an update: ~0.02 mean absolute difference after training, and ~0.08 in a separate serial zero-adapter control. Checkpoint tensors are exact; forward determinism has not been established or localized.

Other checks: 36 Bridge GPU cases passed; EP2 and TP2/EP2 integration passed accumulation, norm, isolation, cross-slot restore and resumed Adam. The old accumulation path fails the same test. Pre-commit and all CPU CI shards passed (15,693 tests). GPU CI scope: run-ci-multi-lora.

@yueming-yuan yueming-yuan added run-ci-image run-ci-multi-lora Run Tinker cookbook and multi-tenant gateway GPU e2e tests labels Oct 2, 2026
@yueming-yuan yueming-yuan added run-ci-image run-ci-multi-lora Run Tinker cookbook and multi-tenant gateway GPU e2e tests labels Oct 2, 2026

@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/multilora-shared-outer branch from 4ba90fe to 04feccc Compare October 9, 2026 22:20
@yueming-yuan
yueming-yuan force-pushed the yueming/multilora-shared-outer branch from 04feccc to ada1fd2 Compare October 27, 2026 21:53
@yueming-yuan
yueming-yuan added this pull request to stack #4479 October 27, 2026 22:00
@yueming-yuan
yueming-yuan force-pushed the yueming/multilora-shared-outer branch from ada1fd2 to bb82e23 Compare October 27, 2026 22:10
@yueming-yuan
yueming-yuan removed this pull request from stack #4479 October 27, 2026 22:12
@yueming-yuan
yueming-yuan changed the base branch from main to yueming/multilora-grad-accumulation October 27, 2026 22:12
@yueming-yuan
yueming-yuan added this pull request to stack #4481 October 27, 2026 22:13
@yueming-yuan
yueming-yuan force-pushed the yueming/multilora-shared-outer branch from ee5d3d7 to 81c3bb2 Compare October 28, 2026 05:36
@yueming-yuan
yueming-yuan force-pushed the yueming/multilora-shared-outer branch 2 times, most recently from d17e98f to 25e8bb9 Compare October 28, 2026 05:56
@yueming-yuan
yueming-yuan force-pushed the yueming/multilora-shared-outer branch from 25e8bb9 to 1ce16d1 Compare October 28, 2026 06:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci-multi-lora Run Tinker cookbook and multi-tenant gateway GPU e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant