Repository navigation
[LoRA] Publish fresh streamed versions alongside generation - #38165
Merged
Merged
Conversation
yushengsu-thu
requested review from
CatherineSue,
Fridge003,
JustinTong0323,
Ying1123,
hnyls2002,
ispobock,
jybsuper,
lifuhuang,
merrymercy,
slin1237,
sogalin,
wisclmy0611,
xiezhq-hermann and
zijiexia
as code owners
September 6, 2026 00:34
Zhichenzzz
force-pushed
the
sglang-miles
branch
from
September 8, 2026 05:02
a359142 to
a8e5c63
Compare
Zhichenzzz
requested review from
HaiShaw,
Qiaolin-Yu,
b8zhong,
ch-wan,
fzyzcjy,
key4ng,
kpham-sgl,
mickqian,
yctseng0211,
yhyang201 and
yuan-luo
as code owners
September 8, 2026 05:02
yushengsu-thu
force-pushed
the
yusheng/lora-publication-overlap
branch
2 times, most recently
from
September 8, 2026 07:20
7fef956 to
e3e3861
Compare
yushengsu-thu
force-pushed
the
yusheng/lora-publication-overlap
branch
from
September 8, 2026 07:24
e3e3861 to
7fef956
Compare
This was referenced Sep 8, 2026
A weight-update session may now register adapters with defer_publish: the backends hold their zeroed identities and stash the streamed tensors as before, but the names stay out of the serving registry until end_weight_update commits — so publishing a fresh immutable adapter version never needs the engine paused. Fresh names only: a published name has readers and must not be staged over. - register_lora_adapter gains lora_path: with a disk artifact the adapter is reloadable, so it may be LRU-evicted and refilled instead of being rejected at the --max-loaded-loras cap. - end_weight_update gains abort: discard the stash and the deferred registrations (base tensors already written in place are not rolled back). - A deferred publication commits only under a full checksum manifest; a session that ends without one is aborted (fail closed).
Generate/embedding requests gain lora_backfill_paths ({lora_name: path}):
when a requested adapter is neither registered nor in the ref cache, the
engine loads it from the carried path instead of rejecting the request.
The request is self-sufficient, so a fresh or restarted engine can serve
any published version without prior state; residency stays engine-managed.
The session stash holds references until end_weight_update applies them, but a CUDA-IPC sender reuses the shared bucket as soon as the RPC replies, so stashed tensors from the tensor transport must be copied out (and the copies synchronized) before the reply.
A staged session (adapter-only, deferred publications pending) touches nothing a running forward reads: the deferred names are not servable and base tensors are rejected. Taking the writer lock would serialize the push against generation for no correctness gain, so begin/bucket/end select the reader lock for staged sessions; base and fixed-name sessions keep the writer lock. The reader lock makes three guards load-bearing: a staged bucket must not flush caches, abort requests, or move the base weight version; a pending name cannot be re-registered or unloaded until its session commits or aborts; and a sample request cannot serve or backfill a name that a staged session is still streaming.
Multi-line comments cut to the one constraint that makes each line read right; the mechanism narration they carried is visible in the code.
The two bucket handlers inlined the same pause-aware lock selection that _weight_update_session_call already implements, and the end handler duplicated its cleanup across the missing-manifest and normal paths; a missing manifest is now just a forced abort on the single path. The staged serving-state guard is one helper.
…mentation Keeps the prior implementation in history for the record; the tree is the rewrite: deferred publication held at the tokenizer, reader-lock staged sessions, request-carried backfill, IPC stash clones, and the pending ack. Companion to radixark/miles#3127.
yueming-yuan
force-pushed
the
yusheng/lora-publication-overlap
branch
from
September 8, 2026 23:17
f1b2f7d to
cfbe52d
Compare
8 of 33 tasks
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.
Motivation and Modification
Scenario:
lora_a,lora_b, andlora_care separate LoRA adapters sharing one base model. A has finished rollout and training; its updated weights will becomelora_a@2.lora_b, andlora_care still generating.Most important file: tokenizer_control_mixin.py.
Previously, updates acquired a writer lock while the engine was running, making them mutually exclusive with generation.
For validated fresh-version publication, the PR selects a reader lock:
lora_b, andlora_cgeneration already uses reader locks, so publication can coexist with it.Supporting changes make this safe:
lora_a’s new version with ready=False, blocking premature sampling._weight_update_new_loras contains validated pending adapters; a session ID alone does not enable this path. Base updates and same-name overwrites retain exclusive locking.
CI States
Latest PR Test (Base): ❌ Run #34296559933
Latest PR Test (Extra): ❌ Run #34296559792
Latest PR Test (AMD ROCm 7.2): ❌ Run #34296560027