Skip to content

[sglang-miles] Allow load_lora_adapter_from_distributed under dp attention - #32421

Merged
yushengsu-thu merged 1 commit into
sgl-project:sglang-milesfrom
yushengsu-thu:lora-from-distributed-dp-attention
Jul 26, 2026
Merged

yushengsu-thu merged 1 commit into
sgl-project:sglang-milesfrom
yushengsu-thu:lora-from-distributed-dp-attention

Conversation

@yushengsu-thu

@yushengsu-thu yushengsu-thu commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Motivation

load_lora_adapter_from_distributed was the only LoRA update endpoint still asserting dp_size == 1. Its three siblings — load_lora_adapter, load_lora_adapter_from_tensors, unload_lora_adapter — were all relaxed to dp_size == 1 or dp attention must be enabled, as was update_weights_from_distributed for base weights.

The stale assert blocked the one route that supports upsert (the disaggregated RL weight-sync path) on every dp-attention serving config — GLM-5.2's standard recipe (--enable-dp-attention --dp-size N with NSA attention) among them. Colocate single-LoRA runs never hit it because they load adapters from tensors; disaggregated multi-LoRA dies at the first slot load.

Modifications

Relax the assert to match the sibling endpoints: dp_size == 1 or enable_dp_attention. All four LoRA routes share update_lora_adapter_communicator for the tokenizer→scheduler broadcast, and the weight-update NCCL group already covers every dp-attention rank (the same topology update_weights_from_distributed relies on), so no other change is needed.

Accuracy Test

Verified by a GLM-5.2_5layer multi-LoRA e2e (miles, disaggregated 4 train + 4 rollout GPUs, 2 engines with dp-attention ep=dp=2): both DP ranks of both engines receive the initial slot load and the per-step upserts (3 rounds, all 200 OK), and the run completes 3 training steps end-to-end with correct rollouts.

Benchmarking and Profiling

No performance impact — one assert condition at the endpoint entry.

Checklist

  • Format the code with pre-commit.
  • Tests: one-line assert relaxation matching three sibling endpoints; covered by the e2e above. Existing test_lora_upsert.py continues to cover the dp_size=1 path.

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #30187943315
Latest PR Test (Extra): ❌ Run #30187943137

…ntion

load_lora_adapter_from_distributed was the only LoRA update endpoint still
asserting dp_size == 1: load_lora_adapter, load_lora_adapter_from_tensors
and unload were all relaxed to "dp_size == 1 or dp attention enabled", as
was update_weights_from_distributed for base weights. All four LoRA routes
share update_lora_adapter_communicator, and the weight-update NCCL group
covers every dp-attention rank, so the stale assert blocked the one route
that supports upsert — the disaggregated RL weight-sync path — on any
dp-attention serving config (GLM-5.2's standard recipe among them).
Colocate single-LoRA runs never hit it because they load from tensors.

Verified by a GLM-5.2_5layer multi-LoRA e2e (2 engines, dp-attention
ep=dp=2): both DP ranks of both engines receive the initial load and the
per-step upserts (3 rounds, all 200 OK) and the run completes 3 training
steps end-to-end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 26, 2026 04:32
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants