Skip to content

[LoRA] Fix dedup for post-replacement module aliases#44413

Merged
jeejeelee merged 2 commits into
vllm-project:mainfrom
linitra24:fix-dedup-lora-wrapping
Jun 3, 2026
Merged

[LoRA] Fix dedup for post-replacement module aliases#44413
jeejeelee merged 2 commits into
vllm-project:mainfrom
linitra24:fix-dedup-lora-wrapping

Conversation

@linitra24
Copy link
Copy Markdown
Contributor

@linitra24 linitra24 commented Jun 3, 2026

Follow up on #42757 by fixing another shared-alias LoRA registration case.

#42757 deduplicated LoRA wrapping when the same original module is reachable
through multiple attribute paths, such as the MoE gate alias. However, it only
tracked the id of the original module before replacement.

This misses alias paths that resolve to the already-replaced LoRA wrapper. For
example, in Gemma4, self_decoder.decoder_layers aliases layers. After the
canonical layers.* path is wrapped, the alias path later sees the new
BaseLayerWithLoRA object, not the original module. Since the wrapper id was
not tracked, the same wrapper could still be registered twice.

During adapter activation, the canonical module name loads the LoRA weights, but
the alias module name has no matching adapter key and resets the same wrapper,
effectively clearing the LoRA weights.

This PR records both the original module id and the replacement wrapper id, so
both pre-replacement and post-replacement alias paths reuse the existing wrapper
without adding a second self.modules entry.

Purpose

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@linitra24 linitra24 requested a review from jeejeelee as a code owner June 3, 2026 10:48
@linitra24
Copy link
Copy Markdown
Contributor Author

CC @jeejeelee

Signed-off-by: bk-201 <joy25810@foxmail.com>
@jeejeelee jeejeelee enabled auto-merge (squash) June 3, 2026 16:16
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 3, 2026
@jeejeelee jeejeelee merged commit 271328e into vllm-project:main Jun 3, 2026
40 checks passed
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
)

Signed-off-by: bk-201 <joy25810@foxmail.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
JisoLya pushed a commit to JisoLya/vllm that referenced this pull request Jun 5, 2026
)

Signed-off-by: bk-201 <joy25810@foxmail.com>
Signed-off-by: JisoLya <523420504@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants