[vllm] feat: Support LoRA for DeepSeek V4 & GLM5.3 Flash - #7483
Open
HollowMan6 wants to merge 7 commits into
Open
HollowMan6 wants to merge 7 commits into
HollowMan6 wants to merge 7 commits into
Conversation
4 tasks
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
2 times, most recently
from
August 20, 2026 22:29
737a33b to
3bfa19e
Compare
HollowMan6
marked this pull request as draft
August 21, 2026 07:30
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
from
August 21, 2026 07:38
3bfa19e to
f84a51d
Compare
HollowMan6
marked this pull request as ready for review
August 21, 2026 08:37
4 tasks
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
4 times, most recently
from
September 3, 2026 00:31
8d1059f to
1b994e6
Compare
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
from
September 10, 2026 17:43
465283c to
6f36884
Compare
4 tasks
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
2 times, most recently
from
September 10, 2026 21:45
7bde29f to
6439c6e
Compare
Adds DeepSeek V4 (DSV4) LoRA support to verl's vLLM weight-sync path. Previously a merge=False LoRA base sync orphaned the `.base_layer.` suffix on wrapped modules and mishandled the mxfp4 quant path, so DSV4 LoRA diverged from the actor. This reworks weight-name reconciliation to be runtime-probed (strict vs flat loader) instead of model-type-based, unwraps the LoRA-installed mxfp4 quant-method wrapper, and threads `peft_config` through the FP8/mxfp4 load path so the same reconciliation applies there. Tested with Megatron backend, GPU E2E (DSV4 merge=F GRPO, 2-node): step1/step2 pearson 0.9970/0.9950, aligned to run15 merge=T 0.9952/0.9944. Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
from
September 14, 2026 07:27
4480098 to
5c40c03
Compare
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
HollowMan6
force-pushed
the
songlin/dsv4-lora
branch
from
September 14, 2026 07:42
5c40c03 to
b3f4beb
Compare
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.
What does this PR do?
Depends on:
Adds DeepSeek V4 (DSV4) LoRA support to verl's vLLM weight-sync path. Previously a merge=False LoRA base sync orphaned the
.base_layer.suffix on wrapped modules and mishandled the mxfp4 quant path, so DSV4 LoRA diverged from the actor.This reworks weight-name reconciliation to be runtime-probed (strict vs flat loader) instead of model-type-based, unwraps the LoRA-installed mxfp4 quant-method wrapper, and threads
peft_configthrough the FP8/mxfp4 load path so the same reconciliation applies there.Tested with Megatron backend, GPU E2E (DSV4 merge=F GRPO, 2-node): step1/step2 pearson 0.9970/0.9950, aligned to run15 merge=T 0.9952/0.9944.
Checklist Before Starting
[{modules}] {type}: {description}(This will be checked by the CI){modules}includefsdp,megatron,veomni,sglang,vllm,rollout,trainer,ci,training_utils,recipe,hardware,deployment,ray,worker,single_controller,misc,perf,model,algo,env,tool,ckpt,doc,data,cfg,reward,fully_async,one_step_off,like[megatron, fsdp, doc]{type}is infeat,fix,refactor,chore,test[BREAKING]to the beginning of the title.[BREAKING][fsdp, megatron] feat: dynamic batchingTest
pytest tests/utils/test_vllm_weight_name_normalization_on_cpu.py # GPU E2E: DSV4 merge=F GRPO 2-node — step1/step2 pearson 0.9970/0.9950 vs run15 merge=T 0.9952/0.9944Unit tests cover strict-vs-flat loader detection, per-expert routed leaves, and non-LoRA params on wrapped modules (e.g. DSV4
gate.tid2eid/gate.e_score_correction_bias).API and Usage Example
No CLI/API change. Behavior is automatic:
resolve_weight_nameprobes the inner model'sload_weightsat runtime and toggles.base_layer.accordingly. For DSV4 merge=False LoRA, no extra config is needed beyond enabling LoRA +merge=False.Design & Code Changes
Runtime-probed
.base_layer.reconciliation (verl/utils/vllm/utils.py)_inner_load_weights_is_strict: probes the inner transformer'sload_weightsbytecode (co_names) to decide strict (keeps.base_layer., DeepseekV2/DSV4) vs flat (strips it, Llama/Qwen3.5). Cached per class.resolve_weight_nametoggles one.base_layer.segment loader-style-aware, re-adds the suffix for non-LoRA params on a wrapped module, and reconciles per-expert routed leaves (strict keep / flat strip, gated by_HAS_LORA_BASE_LAYER_PREFIX).mxfp4 LoRA unwrap (
verl/utils/vllm/vllm_fp4_utils.py)_resolve_mxfp4_quant_method: unwraps theFusedMoEModularMethodwrapper that merge=False LoRA installs overMxfp4MoEMethod(stored asold_quant_method) so staging, layout derivation, andprocess_weights_after_loadingrepack reach the legacy method — the modular wrapper inherits a no-op post-load and would otherwise skip the repack.FP8/mxfp4 name reconciliation (
verl/utils/vllm/vllm_quant_utils.py,verl/workers/rollout/vllm_rollout/utils.py)load_quanted_weightsgains apeft_configparameter; when set (LoRA base sync), names run throughresolve_weight_nameagainst live params/buffers so.base_layer.is reconciled on the FP8/mxfp4 path too (e.g. DSV4compressor.fused_wkv_wgate). Callers threadpeft_configfor both base and drafter loads.LoRA MoE prefix (
verl/utils/vllm/patch.py)lora_base_layer_prefixclearing block; the prefix is now reconciled throughresolve_weight_nameinstead.Tests (
tests/utils/test_vllm_weight_name_normalization_on_cpu.py)Checklist Before Submitting
Important
Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=alwaysci-requestchannel in theverlSlack workspace. (If not accessible, please try the Feishu group (飞书群).)recipesubmodule, please also update the reference to the submodule commit viagit submodule update --remoteorcd recipe && git pull origin main.