Skip to content

[RL] Add /pull_weights: engine-side pull of published weights into a host-local checkpoint (sglang-miles) - #30366

Merged
yueming-yuan merged 1 commit into
sgl-project:sglang-milesfrom
nanjiangwill:pull-weights-sglang-miles
Jul 9, 2026
Merged

[RL] Add /pull_weights: engine-side pull of published weights into a host-local checkpoint (sglang-miles)#30366
yueming-yuan merged 1 commit into
sgl-project:sglang-milesfrom
nanjiangwill:pull-weights-sglang-miles

Conversation

@nanjiangwill

@nanjiangwill nanjiangwill commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Motivation

RL trainers with disaggregated rollout publish each weight sync as a version dir weight_v{N:06d}/ on a shared filesystem — a full HF checkpoint, or zstd-compressed per-tensor byte deltas (xor/overwrite) with per-tensor checksums, packaged as a canonical HF checkpoint dir. This adds the engine-side receiver: POST /pull_weights brings a host-local checkpoint up to a target version on every host the deployment spans, so the trainer talks to one endpoint per engine.

Trainer PR: radixark/miles#1235 · main variant: #30367 · Refs: THUDM/slime#2181

Behavior

POST /pull_weights {local_checkpoint_dir, source_dir, target_version} fans out to every scheduler rank on every node. Each host seeds from the newest full version ≤ target (or the server's own model_path — version 0 is the engine's base), then applies the delta chain in place via mmap, parallelized across tensors. A checksum mismatch or out-of-order apply raises — never serve bad weights; a per-host flock + applied-version marker collapse co-located ranks to one pull. Success is gathered across the TP group, so the reply covers every host. The trainer then reloads via the ordinary /update_weights_from_disk — weight loading never sees the delta format.

--custom-pull-weights-pre-read-hook <import.path>: refresh hook for object-store-backed mounts without cross-host read-after-write consistency (POSIX shared FS needs none).

Notes


CI States

Latest PR Test (Base): ❌ Run #28888974230
Latest PR Test (Extra): ❌ Run #28888973534

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@nanjiangwill
nanjiangwill force-pushed the pull-weights-sglang-miles branch 2 times, most recently from e419790 to 8f0ab41 Compare July 7, 2026 18:13
…host-local checkpoint

A trainer publishes each weight sync as a version directory (a full HF
checkpoint, or zstd-compressed per-tensor deltas with checksums) under a
shared source_dir. /pull_weights fans out to every rank on every node of
the deployment; each host seeds a local checkpoint from the newest full
version (or the server's own model path) and applies the delta chain in
place, verified per-tensor. The engine then reloads the local checkpoint
through the ordinary update_weights_from_disk path, so the weight-loading
code never sees the delta format.

--custom-pull-weights-pre-read-hook covers object-store-backed shared
filesystems that need an explicit refresh before reads.

Ported from slime's runtime patch (THUDM/slime#2181) for miles/slime-style
disaggregated RL training.
@nanjiangwill
nanjiangwill force-pushed the pull-weights-sglang-miles branch from 8f0ab41 to 5de87ba Compare July 7, 2026 18:22
nanjiangwill added a commit to nanjiangwill/miles that referenced this pull request Jul 8, 2026
…i-weight-update

The weights checker (--check-weight-update-equal, armed by --ci-test)
resets engine tensors at startup and compares after the first sync,
expecting it to rewrite every tensor — but the disk-delta baseline
publishes nothing. When the checker is armed, the baseline now also
reloads the just-pulled v0 checkpoint via update_weights_from_disk,
restoring engine state and setting the weight version the CI equality
check expects.

Adds tests/e2e/megatron/test_qwen3_4B_disk_delta.py (mirrors the p2p
weight-update test: 4 actor + 4 rollout GPUs, --ci-test), registered
under labels ["megatron", "weight-update"]; disabled until the CI image
ships sglang /pull_weights (sgl-project/sglang#30366).
@yueming-yuan
yueming-yuan merged commit 51514f6 into sgl-project:sglang-miles Jul 9, 2026
88 of 99 checks passed
@nanjiangwill
nanjiangwill deleted the pull-weights-sglang-miles branch July 9, 2026 03:22
yueming-yuan pushed a commit that referenced this pull request Jul 14, 2026
yueming-yuan pushed a commit that referenced this pull request Jul 14, 2026
yueming-yuan pushed a commit that referenced this pull request Jul 14, 2026
yueming-yuan pushed a commit that referenced this pull request Jul 14, 2026
yueming-yuan pushed a commit that referenced this pull request Jul 25, 2026
… into a host-local checkpoint (#30366, #28524)

Folds in the two fixes #28524 made to this endpoint -- Annotated[..., Body()]
on the handler and keyword construction of PullWeightsReqOutput, which is a
kw_only msgspec Struct and would raise on the positional form. The rest of
#28524 (dumper / dump-comparator) is already upstream in v0.5.16 and is dropped.
yueming-yuan pushed a commit that referenced this pull request Jul 25, 2026
… into a host-local checkpoint (#30366, #28524)

Folds in the two fixes #28524 made to this endpoint -- Annotated[..., Body()]
on the handler and keyword construction of PullWeightsReqOutput, which is a
kw_only msgspec Struct and would raise on the positional form. The rest of
#28524 (dumper / dump-comparator) is already upstream in v0.5.16 and is dropped.
yueming-yuan pushed a commit that referenced this pull request Jul 25, 2026
… into a host-local checkpoint (#30366, #28524)

Folds in the two fixes #28524 made to this endpoint -- Annotated[..., Body()]
on the handler and keyword construction of PullWeightsReqOutput, which is a
kw_only msgspec Struct and would raise on the positional form. The rest of
#28524 (dumper / dump-comparator) is already upstream in v0.5.16 and is dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blackwell SM100/SM120 deepseek dependencies Pull requests that update a dependency file jit-kernel lora model-gateway mthreads Multi-modal multi-modal language model npu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants