Skip to content

Conversation

@ahengljh
Copy link
Contributor

@ahengljh ahengljh commented Aug 25, 2025

Purpose

This PR removes the ability for each LoRA adapter to define its own additional
vocabulary, as proposed in issue #23474. All LoRA adapters for a given model now
share the same vocabulary as the base model.

Test Plan

  1. Test basic LoRA initialization:
import vllm
llm = vllm.LLM(model="Qwen3-8B", enable_lora=True)
  1. Test LoRA adapter loading (with existing adapters):
from vllm.lora.request import LoRARequest
lora_request = LoRARequest("adapter1", 1, "/path/to/lora/adapter")
outputs = llm.generate(["Test prompt"], lora_request=lora_request)
  1. Run LoRA-related tests:
pytest tests/lora/test_lora_manager.py -v
pytest tests/lora/test_layers.py -v 

Test Result

  • ✅ Successfully initialized vLLM with enable_lora=True without AttributeError
  • ✅ LoRAConfig no longer has lora_extra_vocab_size attribute
  • ✅ All model files updated to remove additional vocabulary references

(Optional) Documentation Update

No documentation updates required as this removes an undocumented internal feature.

Essential Elements of an Effective PR Description Checklist - [X] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)". - [X] The test plan, such as providing test command. - [X] 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.
BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the functionality for LoRA adapters to have their own additional vocabulary, which simplifies the LoRA implementation across the codebase. The changes are extensive and touch many files, primarily removing lora_extra_vocab_size and related logic.

The changes are generally correct and align with the goal of the PR. I've identified a few areas where the code can be cleaned up for better maintainability, such as removing redundant code blocks and expressions. These patterns are repeated across several model definition files, and I've provided examples in the comments. Addressing them would improve the overall code quality.

Copy link
Contributor

Choose a reason for hiding this comment

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

high

The expression self.base_layer.org_vocab_size + 0 is redundant. It can be simplified to self.base_layer.org_vocab_size for better code clarity.

Suggested change
self.base_layer.org_vocab_size +
lora_config.lora_extra_vocab_size,
0, # No extra vocab size
self.base_layer.org_vocab_size,

Comment on lines 280 to 281
lora_vocab = ((0 *
(lora_config.max_loras or 1)) if lora_config else 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The lora_vocab variable is now always 0 and is unused. It can be removed for clarity. This pattern of an unused lora_vocab variable is present in several other model files and should be addressed there as well.

Comment on lines 538 to 540
if lora_config:
unpadded_vocab_size += lora_config.lora_extra_vocab_size
# No additional vocabulary for LoRA
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This if lora_config: block is now empty and can be removed to improve code clarity. This pattern is repeated in several other model files (e.g., minicpm_eagle.py, phi4flash.py, phi4mm.py, step3_text.py) and should be addressed there as well.

@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch 2 times, most recently from d0dd2eb to fbea0b6 Compare August 25, 2025 09:58
@jeejeelee
Copy link
Collaborator

As a start, maybe it would be better to just provide a deprecation warning for lora_extra_vocab_size

@ahengljh
Copy link
Contributor Author

As a start, maybe it would be better to just provide a deprecation warning for lora_extra_vocab_size

Oh I see. So we should hold this PR and just add warning info to users at this moment right?

@jeejeelee
Copy link
Collaborator

As a start, maybe it would be better to just provide a deprecation warning for lora_extra_vocab_size

Oh I see. So we should hold this PR and just add warning info to users at this moment right?

I think so

@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch from 2634859 to e0018fc Compare August 26, 2025 03:35
@ahengljh
Copy link
Contributor Author

As a start, maybe it would be better to just provide a deprecation warning for lora_extra_vocab_size

Oh I see. So we should hold this PR and just add warning info to users at this moment right?

I think so

I just made another one-line PR #23635 for adding the warning, and we may hold this PR until you believe it's time to deprecate this feature completely. What's your opinion on this?

@mergify mergify bot added the needs-rebase label Sep 18, 2025
@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch 2 times, most recently from e6239d0 to a4677dd Compare September 18, 2025 06:37
@mergify mergify bot removed the needs-rebase label Sep 18, 2025
@jeejeelee
Copy link
Collaborator

I have trigged the lora testing to verify these changes

@jeejeelee
Copy link
Collaborator

All LoRA tests are failing. Could you take a closer look into this? @ahengljh

@ahengljh
Copy link
Contributor Author

All LoRA tests are failing. Could you take a closer look into this? @ahengljh

Yes, I noticed that and will try to fix them

@mergify
Copy link

mergify bot commented Sep 19, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ahengljh.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Sep 19, 2025
@jeejeelee
Copy link
Collaborator

@ahengljh could we speed up a bit? Thank you.

@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch from f7ad2ef to 2f5ee25 Compare September 22, 2025 06:58
@mergify mergify bot removed the needs-rebase label Sep 22, 2025
@ahengljh
Copy link
Contributor Author

@ahengljh could we speed up a bit? Thank you.

I have been trying run the lora tests on my local machine but I found that even I ran them on the main branch, they still fail, which seems difficult for me to debug. I need to investigate and try more.

@mergify
Copy link

mergify bot commented Sep 24, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ahengljh.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Sep 24, 2025
@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch from 007c50e to 1606db4 Compare September 26, 2025 09:44
@mergify mergify bot removed the needs-rebase label Sep 26, 2025
@mergify
Copy link

mergify bot commented Sep 29, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ahengljh.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@jeejeelee
Copy link
Collaborator

@ahengljh Would you like to continue working on this PR? If so, could you resolve the conflicts first?

@ahengljh
Copy link
Contributor Author

@ahengljh Would you like to continue working on this PR? If so, could you resolve the conflicts first?

Yes, of course, and sorry for being late, I can solve conflicts first. But there has been some problems on my local gpu env to run tests to debug. So I may need a little help on passing tests.

@jeejeelee
Copy link
Collaborator

Okay, please feel free to ping me on slack

@ahengljh ahengljh force-pushed the remove-lora-additional-vocabulary branch from 1606db4 to ee013d7 Compare October 15, 2025 14:37
@mergify mergify bot removed the needs-rebase label Oct 15, 2025
@mergify
Copy link

mergify bot commented Oct 17, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ahengljh.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Oct 17, 2025
@WoosukKwon
Copy link
Collaborator

@ahengljh @jeejeelee Do we have any updates? 😅

@jeejeelee
Copy link
Collaborator

Sorry for missing this PR, @ahengljh would you like to continue working on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llama Related to Llama models needs-rebase qwen Related to Qwen models speculative-decoding tpu Related to Google TPUs v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants