Skip to content

Conversation

@noooop
Copy link
Collaborator

@noooop noooop commented Jul 7, 2025

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.

Purpose

Pooling model “activation” supports per request control by PoolingParams

  • Consider only the dimensions and normalize parameters for embed models,
  • Consider only the activation parameter for classification (score) models
  • Consider only the softmax parameter for PoolingType.ALL reward models
  • Consider only the softmax/step_tag_id/returned_token_ids parameter for PoolingType.STEP reward models

Config priority, from low to high

  1. vllm default in vllm/pooling_params.py _set_default_parameters
  2. get_pooling_config (from sentencetransformer config) in vllm/config.py _init_pooler_config
  3. verify_and_update_config in vllm/model_executor/models/config.py
  4. override_pooler_config in vllm/config.py _init_pooler_config
  5. PoolingParams.init in vllm/pooling_params.py

To make the control logic simpler and more intuitive, we need to refactor the entire pooler control logic as follows:

  1. override_pooler_config is used to modify the default parameters of pooler_config (_init_pooler_config & verify_and_update_config in vllm/config.py)
  2. Allow users to set Pooler parameters via PoolingParams per request. All default parameters are merged from pooler_config into PoolingParams (PoolingParams.merge_default_parameters + PoolingParams.verify in vllm/pooling_params.py)
  3. PoolingParams is used to per request control Pooler ( PoolingMethod& PoolerActivation) ( in vllm/model_executor/layers/pooler.py)

More specific Pooler

  • EmbeddingPoolerHead + SimplePooler for embed models,
  • ClassifierPooler for classification (score) models
  • RewardPoolerHead + SimplePooler for PoolingType.ALL reward models
  • RewardPoolerHead + StepPooler for PoolingType.STEP reward models

Test Plan

  • override_pooler_config -> pooler_config -> PoolingParams

pytest -s -vvv tests/test_pooling_params.py

  • normalize for embed api
pytest -s -vvv tests/models/language/pooling/test_override_pooler_config.py::test_embed_models_using_normalize
pytest -s -vvv tests/entrypoints/llm/test_embedding.py::test_pooling_params
pytest -s -vvv tests/entrypoints/openai/test_embedding.py::test_normalize
  • activation for classify api
pytest -s -vvv tests/models/language/pooling/test_override_pooler_config.py::test_classify_models_using_activation
pytest -s -vvv tests/entrypoints/llm/test_classification.py::test_pooling_params
pytest -s -vvv tests/entrypoints/openai/test_classification.py::test_activation

  • activation for score api
pytest -s -vvv tests/entrypoints/llm/test_score.py::test_pooling_params
pytest -s -vvv tests/entrypoints/openai/test_score.py::test_activation
pytest -s -vvv tests/entrypoints/openai/test_rerank.py::test_activation
  • softmax for reward api
pytest -s -vvv tests/models/language/pooling/test_override_pooler_config.py::test_reward_models_using_softmax
pytest -s -vvv tests/entrypoints/llm/test_reward.py::test_pooling_params

Test Result

pass

(Optional) Documentation Update

Known Issues

We may need to refactor vllm/entrypoints/openai/serving_pooling.py because it uses EmbeddingCompletionRequest, which may deviate from the requirements of reward models.

PoolingCompletionRequest = EmbeddingCompletionRequest
PoolingChatRequest = EmbeddingChatRequest
PoolingRequest = Union[PoolingCompletionRequest, PoolingChatRequest]

@github-actions
Copy link

github-actions bot commented Jul 7, 2025

👋 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 fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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 ready label to the PR or enable auto-merge.

🚀

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.

Summary of Changes

Hello @noooop, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new test suite to ensure the proper functioning of the override_pooler_config mechanism for sequence classification models. It specifically focuses on validating how the softmax option within the pooler configuration influences the model's classification outputs.

Highlights

  • New Test Coverage: I've added a new pytest file (tests/models/language/pooling/test_classification_pooler_config.py) to verify that ForSequenceClassification models correctly respect the override_pooler_config parameter.
  • Pooler Configuration Validation: The new test specifically validates the softmax setting within PoolerConfig, asserting that classification outputs differ when softmax is enabled versus disabled, and that applying softmax to the raw output matches the softmax-enabled output.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 adds a new test to verify that override_pooler_config is correctly applied to ForSequenceClassification models. The test logic appears sound. I've found a minor issue in the test implementation regarding an assertion, which includes dead code and could be made clearer. My feedback focuses on improving the correctness and maintainability of the test.

@noooop
Copy link
Collaborator Author

noooop commented Jul 7, 2025

@DarkLight1337

after #20527

Bert like ForSequenceClassification, for example, papluca/xlm-roberta-base-language-detection is still not controlled by override_pooler_config.

On the other hand, the model converted using as_seq_cls_model, for example, jason9693/Qwen2.5-1.5B-apeach is controlled by override_pooler_config.

Do we need to unify this?

Signed-off-by: wang.yuqi <noooop@126.com>
@DarkLight1337
Copy link
Member

Yes, override_pooler_config should be applied in all cases

@noooop noooop changed the title [Model] The ForSequenceClassification model should be controlled by override_pooler_config. [Model] normalize & softmax can be controlled at the model level by override_pooler_config, and PoolingParams is controlled at the request level Jul 23, 2025
@noooop noooop changed the title [Model] normalize & softmax can be controlled at the model level by override_pooler_config, and PoolingParams is controlled at the request level [Model] normalize & softmax can be controlled by override_pooler_config, and by PoolingParams per request Jul 23, 2025
Signed-off-by: wang.yuqi <noooop@126.com>
@mergify mergify bot added the frontend label Jul 23, 2025
@maxdebayser
Copy link
Contributor

I wonder how that relates to the context extension PR. Would it perhaps make a difference to disable the normalize and softmax for the chunk processing and then apply them on the normalized results?

Another question is whether this would prevent us from using cuda graphs on the pooler.

@noooop
Copy link
Collaborator Author

noooop commented Jul 24, 2025

I wonder how that relates to the context extension PR. Would it perhaps make a difference to disable the normalize and softmax for the chunk processing and then apply them on the normalized results?

Another question is whether this would prevent us from using cuda graphs on the pooler.

This PR is unrelated to the context extension PR.

The pooler uses too many branch computations, making it inherently unsuitable for CUDA graphs. Using CUDA graphs on the backbone network is already efficient enough.

Signed-off-by: wang.yuqi <noooop@126.com>
@noooop noooop changed the title [Model] normalize & softmax can be controlled by override_pooler_config, and by PoolingParams per request [Model] normalize & activation can be controlled by override_pooler_config, and by PoolingParams per request Jul 24, 2025
@mergify
Copy link

mergify bot commented Jul 24, 2025

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

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 Jul 24, 2025
Signed-off-by: wang.yuqi <noooop@126.com>
@mergify mergify bot removed the needs-rebase label Jul 24, 2025
noooop added 3 commits July 24, 2025 17:11
Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: wang.yuqi <noooop@126.com>
@noooop noooop marked this pull request as ready for review July 24, 2025 10:45
@noooop
Copy link
Collaborator Author

noooop commented Aug 5, 2025

@DarkLight1337

Language Models Test (Extended Pooling) pass. Luck

@vllm-bot vllm-bot merged commit 586f286 into vllm-project:main Aug 5, 2025
43 of 47 checks passed
@noooop noooop deleted the pooler_config branch August 5, 2025 11:36
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
myselvess pushed a commit to myselvess/vllm that referenced this pull request Aug 7, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
…ingParams (vllm-project#20538)

Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 9, 2025
…ingParams (vllm-project#20538)

Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: Noam Gat <noamgat@gmail.com>
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
…ingParams (vllm-project#20538)

Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: Paul Pak <paulpak58@gmail.com>
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
…ingParams (vllm-project#20538)

Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: Diego-Castan <diego.castan@ibm.com>
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
…ingParams (vllm-project#20538)

Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: Xiao Yu <xiao.yu@amd.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend qwen Related to Qwen models 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.

4 participants