Skip merge/unmerge when colocated vLLM only consumes PEFT LoRA factors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- machine-learning, performance
Research direction
Read RolloutTrainerMixin._move_adapter_to_vllm() and compare its merge, state-dict export, and unmerge path with the issue’s direct-export experiment. Start by checking how the colocated vLLM path handles plain dense PEFT LoRA and its existing fallback cases. Done means adapter publication avoids changing frozen BF16 base weights while preserving the expected adapter payload; the issue says the revised candidate still needs a run on the Ascend recipe.
Written by the indexing model from the issue text.
Description
Bug Description / Bug 描述
In the Hugging Face trainer's colocated vLLM path, RolloutTrainerMixin._move_adapter_to_vllm() temporarily merges PEFT LoRA into the frozen base, reads the adapter state dict and then unmerges. The rollout request contains only the adapter. BF16 addition and subtraction can leave the frozen base with different values even when no training update occurs.
On an Ascend 910B2, with ms-swift 4.6.1, PEFT 0.20.0, vLLM and vLLM-Ascend 0.30.0, and dense Qwen3-8B BF16, the first adapter publish changed 2,112 of 16,777,216 elements in the frozen first-layer q_proj. A local direct-export experiment had zero changed elements in that projection. All 504 published BF16 tensors and all 32 first-rollout outputs matched. A separate Qwen3-1.7B L1 trace showed 392 aten::matmul calls and 196 each of aten::add_ and aten::sub_ in the old publication interval, compared with zero in the direct-export interval.
How to Reproduce / 如何复现
This CPU example uses a real PEFT layer and synthetic weights. The placement call matches what Swift currently does before its merge. The same BF16 change can be reproduced without a model download or vLLM.
import torch
from torch import nn
from peft import LoraConfig, get_peft_model
torch.manual_seed(127)
model = get_peft_model(nn.Sequential(nn.Linear(4, 4, bias=False)).bfloat16(),
LoraConfig(r=2, lora_alpha=2, target_modules=["0"]))
layer = model.base_model.model[0]
with torch.no_grad():
layer.lora_B["default"].weight.normal_()
before = layer.base_layer.weight.clone()
layer._move_adapter_to_device_of_base_layer("default")
model.merge_adapter()
model.unmerge_adapter()
print("changed frozen values:", layer.base_layer.weight.ne(before).sum().item())
Additional Information / 补充信息
Related work: #10154 described the same rounding defect and proposed restoring original storage after merging. This proposal is for the adapter-only request and skips the dense computation entirely for plain dense PEFT LoRA. #10360 and #10363 describe a related optimizer dtype issue. Here the dtype/device conversion would run on exported snapshots, leaving the FP32 training Parameters and their AdamW state intact.
A local candidate targets main at 9e4d40cc48c74988f167045db4fdb8b0008acf77. It covers single-rank colocate, one plain default PEFT Linear LoRA adapter, one parameter group and no offload. A small CPU regression checks frozen weights, exact BF16 payloads, fallback and AdamW continuation. The Ascend measurements above used a local direct-export trial. The revised upstream candidate snapshots detached tensors and still needs a run on this NPU recipe.
- Dominant language
- Python
- Stars
- 16.2k
- Forks
- 1.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 68
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelscope/ms-swift
-
get_multimodal_target_regex(..., exclude_router=True) does not exclude shared_expert_gatePossibly taken @KonnyakuMatcha claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelscope/ms-swift#10696 ·
Maintainers usually reply within 1 day
-
[BUG] GRPO REAL loss crashes with beta>0 and kl_in_reward=True (NoneType * Tensor)Possibly taken @newcloud123 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
modelscope/ms-swift#10690 ·
Maintainers usually reply within 1 day
-
[BUG] GRPO REAL loss divides by all groups instead of valid groups, silently scaling gradientsPossibly taken @newcloud123 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelscope/ms-swift#10688 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 Half a day Newbie friendliness 62/100
modelscope/ms-swift#10621 ·
Maintainers usually reply within 1 day
-
[Bug] `get_seed` consumes a draw from the shared RandomState even when decision augmentation is disabled, changing the train/val split and dataset shufflePossibly taken @ryznren claimed this 38 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelscope/ms-swift#10466 · 1 comment ·
Maintainers usually reply within 1 day
All issues in modelscope/ms-swift
Similar issues
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 · 3 comments ·
Maintainers usually reply within 1 day
-
polish
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresPossibly taken @AshutoshSingh840 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
UKGovernmentBEIS/control-arena#992 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
mvalentsev/awesome-free-ai-coding#70 ·
Maintainers usually reply within 1 day