-
-
Notifications
You must be signed in to change notification settings - Fork 11k
[P/D][V1] Support dynamic loading of external KV connector implementations #18142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[P/D][V1] Support dynamic loading of external KV connector implementations #18142
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
|
@sdavidbd This looks much more clear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vllm/config.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there currently appears to be a distinction between the kv connector name and the class name, perhaps this should be the fully-qualified class name rather than just the module path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe another explicit kv_connector_class_name to keep thing safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment! I was actually hoping we could avoid maintaining a distinction between kv_connector and the actual class name.
In fact, I think we should consider renaming the kv_connector field to kv_connector_class_name (to reflect its intended use more clearly) in V1, where I believe we should move away from the current registration-based approach and instead rely entirely on dynamic loading via configuration.
Right now, the primary use of the kv_connector field is to look up a registered connector class, but this mechanism becomes redundant if we support fully dynamic loading. Also, currently, the only case where the kv_connector value is different from the class name is in the V0 SimpleConnector - where kv_connector is used more as an internal behavior flag. Even in that case, I’d argue that kv_connector_extra_config would have been a better fit.
Please let me know what you think, I'd be happy to help drive this cleanup if there's agreement on the direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdavidbd I agree with all of that! But I wasn't involved when the original implementation was done so I'm not sure if there's some other rationale for it being done this way. Thought it would be good for the original authors confirm that it's fine to remove this distinction.
Head branch was pushed to by a user without write access
b7f56b7 to
3b85dd4
Compare
Added a new 'kv_connector_module_path' field to KVTransferConfig. If a connector name is not found in the internal registry, the factory will now attempt to load it dynamically using the provided module path Signed-off-by: David Ben-David <davidb@pliops.com>
Signed-off-by: David Ben-David <davidb@pliops.com>
3b85dd4 to
0d2f835
Compare
…tions (vllm-project#18142) Signed-off-by: David Ben-David <davidb@pliops.com> Co-authored-by: David Ben-David <davidb@pliops.com> Signed-off-by: Yuqi Zhang <yuqizhang@google.com>
This PR introduces a new mechanism to simplify the integration of external KV connectors in vLLM's V1 prefill-decode (P/D) disaggregation pipeline.
📌 Motivation
Currently, external packages implementing KVConnectorBase_V1 must define a connector class and upstream it into the vLLM codebase, even if the class simply delegates to an external implementation. This causes unnecessary boilerplate and maintenance overhead for both vendors and vLLM maintainers.
✅ What this PR adds
This allows users to specify the Python module path from which the connector class should be dynamically loaded.
KVConnectorFactorylogic:If a
kv_connectoris not found in the internal registry, the factory attempts to load the class from the givenkv_connector_module_pathviaimportlib.🔧 Usage Example
This enables setups like the following, without requiring any code to be added to the vLLM repo:
✅ Benefits