Skip to content

[Model] Avoid hardcoding pooling type#32119

Merged
vllm-bot merged 7 commits intovllm-project:mainfrom
DarkLight1337:avoid-hardcoded-pooler-type
Jan 12, 2026
Merged

[Model] Avoid hardcoding pooling type#32119
vllm-bot merged 7 commits intovllm-project:mainfrom
DarkLight1337:avoid-hardcoded-pooler-type

Conversation

@DarkLight1337
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 commented Jan 11, 2026

Purpose

Gracefully handle user-specified pooling types where possible, instead of silently ignoring them.

In the next PR, we will work on passing EmbeddingPoolerHead to head argument so that pooling params are applied correctly.

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.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Note

Enables user-configurable sequence pooling types instead of hardcoded defaults and aligns pooler construction across models.

  • BERT/BertWithRope: BertPooler now takes seq_pooling_type (via get_seq_pooling_method); pooling initialized from pooler_config.
  • ModernBert: ModernBertPooler uses configured seq_pooling_type and validates against HF classifier_pooling; sequence classification uses this pooler.
  • RoBERTa and Transformers mixins: remove explicit CLSPool usage; DispatchPooler.for_seq_cls/for_embedding handle token extraction; minor comment clarifications.
  • GritLM: use custom GritLMPooler only for MEAN; otherwise defer to generic pooler_for_embed.
  • SPLADE embedding: note that built-in sequence pooling is overridden by SPLADESparsePooler.

Written by Cursor Bugbot for commit ecb0656. This will update automatically on new commits. Configure here.


Note

Enables configurable sequence pooling and aligns pooler construction across models.

  • BERT/BertWithRope: BertPooler now accepts seq_pooling_type and uses get_seq_pooling_method; BertPoolingModel/BertWithRope initialize pooler from pooler_config.
  • ModernBert: ModernBertPooler uses provided seq_pooling_type; ModernBertForSequenceClassification validates HF classifier_pooling vs. configured type and wires pooling into DispatchPooler.for_seq_cls.
  • RoBERTa + transformers mixins: Remove explicit CLSPool; rely on DispatchPooler.for_seq_cls/for_embedding for token extraction; clarify comments.
  • GritLM: Use custom GritLMMeanPool only when seq_pooling_type == "MEAN"; otherwise defer to get_seq_pooling_method.
  • SPLADE embedding: Note built-in sequence pooling is overridden by SPLADESparsePooler.

Written by Cursor Bugbot for commit 7c25d15. This will update automatically on new commits. Configure here.


Note

Cursor Bugbot is generating a summary for commit 5d5064e. Configure here.


Note

Cursor Bugbot is generating a summary for commit ce4cef5. Configure here.


Note

Cursor Bugbot is generating a summary for commit 69c8fde. Configure here.


Note

Makes sequence pooling user-configurable and standardizes pooler construction.

  • BERT/BertWithRope: BertPooler now takes PoolerConfig and uses get_seq_pooling_method; pooling instantiated from pooler_config in BertPoolingModel and BertWithRope (when present)
  • ModernBert: new ModernBertPooler(config, pooler_config) (uses HF classifier_pooling); ModernBertForSequenceClassification wires this through DispatchPooler.for_seq_cls
  • RoBERTa + transformers mixins: remove explicit CLSPool; rely on DispatchPooler.for_seq_cls/for_embedding for token extraction; update default attribute to default_seq_pooling_type
  • GritLM: GritLMPooler uses custom GritLMMeanPool only for MEAN, otherwise defers to get_seq_pooling_method; updates DispatchPooler wiring
  • SPLADE embedding: note that built-in sequence pooling is overridden by SPLADESparsePooler

Written by Cursor Bugbot for commit 69c8fde. This will update automatically on new commits. Configure here.

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 11, 2026
Copy link
Copy Markdown
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 effectively refactors the model implementations to avoid hardcoding the pooling type, instead sourcing it from the PoolerConfig. This is a great improvement for flexibility and configurability. The changes are consistent across various models like Bert, Roberta, and ModernBert. I've found one critical issue in bert_with_rope.py where an attribute might not be initialized, potentially leading to a runtime error. My detailed comment includes a fix for this.

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337 DarkLight1337 changed the title [Model[ Avoid hardcoding pooling type [Model] Avoid hardcoding pooling type Jan 11, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@vllm-bot vllm-bot merged commit 9101dc7 into vllm-project:main Jan 12, 2026
56 of 58 checks passed
@DarkLight1337 DarkLight1337 deleted the avoid-hardcoded-pooler-type branch January 12, 2026 05:28
TomerBN-Nvidia pushed a commit to TomerBN-Nvidia/vllm that referenced this pull request Jan 13, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Tomer Natan <tbarnatan@computelab-frontend-8.nvidia.com>
akh64bit pushed a commit to akh64bit/vllm that referenced this pull request Jan 16, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
dsuhinin pushed a commit to dsuhinin/vllm that referenced this pull request Jan 21, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
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.

4 participants