refactor(update-weight): LoRA adapter tensors ride the base weight stream - #2756
Open
yueming-yuan wants to merge 32 commits into
Open
refactor(update-weight): LoRA adapter tensors ride the base weight stream#2756yueming-yuan wants to merge 32 commits into
yueming-yuan wants to merge 32 commits into
Conversation
Adapter units join iter_hf_weights (renamed from iter_hf_base_weights) as
'{lora_name}:{hf_key}' entries following the resolved placement; the updater
registers adapters via the new control-plane RPC, streams one unified bucket
loop, and the engines apply the stash at end_weight_update (sync_base scope,
optional sha256 manifest for --check-lora-weight-equal). Deletes the second
send path: send_adapter, is_lora_sender, the full-adapter PP gather surface,
unload-before-reload, and the colocate cuMem repack workaround.
Requires sgl-project/sglang#36384 (register RPC + session scope + stash).
yueming-yuan
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
maocheng23 and
yushengsu-thu
as code owners
August 25, 2026 21:57
There was a problem hiding this comment.
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.
This was referenced Aug 25, 2026
# Conflicts: # tests/fast/backends/training_utils/weight_update/test_lora_weight_sync_validation.py
# Conflicts: # miles/backends/training_utils/weight_update/updater.py
_adapters_to_push -> _get_updated_adapters; _new_registrations -> _get_new_lora_registrations.
# Conflicts: # miles/backends/training_utils/weight_update/protocols/broadcast.py
# Conflicts: # miles/backends/training_utils/weight_update/updater.py
# Conflicts: # miles/backends/megatron_utils/update_weight/hf_weight_iterator.py
# Conflicts: # miles/backends/training_utils/weight_update/hf_weight_iterator/__init__.py
# Conflicts: # miles/backends/training_utils/weight_update/protocol.py # miles/backends/training_utils/weight_update/updater.py
yushengsu-thu
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ci-sglang-pr: #36384
Part of #1360 Step 6 (design:
lora_weight_sync_cleanup.md). Stacked on #2754. Engine counterpart: sgl-project/sglang#36384 — miles tracks the sglang-miles tip continuously, so this PR must merge only after that change is in sglang-miles (and sglang-miles must keep the legacy routes until this merges).What
The second LoRA send path is deleted; adapter tensors are ordinary entries in the bucketed stream, and adapter identity moves to a control plane.
iter_hf_base_weights→iter_hf_weights(weights, *, include_base=True, adapters=(), materialize=True). Adapter units join the same unit stream under{lora_name}:{hf_key}names via the new_iter_hf_adapter_unitshook. The megatron base implements it as the existing PP-local export hook (_export_pp_local_lora, unchanged in bridge/direct) + the PP gather now placement-gated (runs for gather_pp placements — bridge, colocate; disappears for direct+dist) instead of unconditional. The zero-export / no-lora-names guards move into the hook._adapters_to_push()(single:miles_lora; multi:__miles_slot_{i}sorted) + eagerregister_lora_adapterfor new tenants beforebegin(engine validates r ≤ max_lora_rank before any bytes move); the frame is unconditional again with the scope passed asbegin_weight_update(..., sync_base=...)— reverting the refactor(update-weight): colocated transfer as a protocol on the unified updater #2753 call gating whose substance (no quant round-trip on adapter-only rounds) now lives in the session scope.--check-lora-weight-equalbecomes a driver-side sha256 manifest accumulated during the stream and verified engine-side atend_weight_update(now on both transports; previously colocate-only).send_adapterfrom the ABC + both implementations, theis_lora_senderrole from all five protocols,get_hf_lora_weights/_export_lora_named_tensors,_send_lora_adapter/_send_multi_lora_adapters, unload-before-reload (+session.unload_lora_adapter), the colocate LoRA IPC branch and the_repack_onto_fresh_storagecuMem workaround (adapter tensors now travel in sync-time-allocatedFlattenedTensorBuckets, which is exactly why the base path never had the problem).Behavior changes
NotImplementedError).weight_version(frame is unconditional); the actor-side CI version assertion can be re-enabled in a follow-up.supports_loraremains the gate for p2p/rdt/disk-delta (unchanged: unsupported).Tests: iterator template tests retargeted to adapter units in the stream; transport-era
send_adapter/orchestration test classes removed (their engine-side successors live in sglang'stest_lora_stream_update.py).