Skip to content

fix: keep lora_A/lora_B paired in LoRA IPC weight buckets - #82

Merged
Rockdu merged 5 commits into
radixark:mainfrom
niehen6174:fix/lora-ipc-layer-bucketing
Jul 29, 2026
Merged

fix: keep lora_A/lora_B paired in LoRA IPC weight buckets#82
Rockdu merged 5 commits into
radixark:mainfrom
niehen6174:fix/lora-ipc-layer-bucketing

Conversation

@niehen6174

Copy link
Copy Markdown
Collaborator

Summary

  • Fix LoRA IPC weight sync to bucket by layer prefix so lora_A and lora_B always ship in the same IPC payload
  • sglang merges adapters per payload; per-tensor bucketing could split A/B across buckets and silently skip layers when update_weight_buffer_size is small
  • Add GPU test test_lora_ipc_bucket_keeps_ab_together to verify pairing under a tight buffer

Test plan

  • python -m pytest tests/fast-gpu/test_lora_weight_sync.py::test_lora_ipc_bucket_keeps_ab_together -v
  • python -m pytest tests/fast-gpu/test_lora_weight_sync.py -v

sglang merges LoRA adapters per IPC payload, so splitting lora_A and
lora_B across update_weight_buffer_size buckets silently skips layers.
Group tensors by layer prefix before bucketing and add a GPU test.
Comment thread miles/backends/fsdp_utils/diffusion_update_weight_utils.py Outdated
Avoid preparing all lora_A/lora_B params on GPU before bucketing, which
spiked peak memory by the full adapter size. Bucket using raw state-dict
refs first, then _prepare_lora_param only for the bucket being flushed.
Stream layer groups into buckets and call _prepare_lora_param on append,
instead of building a fully prepared bucket list before flush. Keeps peak
GPU memory bounded to the current bucket while preserving A/B pairing.
return layer_groups, unmapped_keys, num_lora_keys


def bucket_lora_layer_groups(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This function has become redundant now and can be removed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment thread miles/backends/fsdp_utils/diffusion_update_weight_utils.py
Remove bucket_lora_layer_groups now that bucketing is inlined in
update_weights. Validate each collected layer group matches
[layer.lora_A, layer.lora_B] before IPC sync.
@Rockdu
Rockdu merged commit 5cc409a into radixark:main Jul 29, 2026
28 of 29 checks passed
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