[Model] Avoid hardcoding pooling type#32119
Merged
vllm-bot merged 7 commits intovllm-project:mainfrom Jan 12, 2026
Merged
Conversation
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Contributor
There was a problem hiding this comment.
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>
Isotr0py
approved these changes
Jan 11, 2026
noooop
approved these changes
Jan 12, 2026
5 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Gracefully handle user-specified pooling types where possible, instead of silently ignoring them.
In the next PR, we will work on passing
EmbeddingPoolerHeadtoheadargument so that pooling params are applied correctly.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Note
Enables user-configurable sequence pooling types instead of hardcoded defaults and aligns pooler construction across models.
BertPoolernow takesseq_pooling_type(viaget_seq_pooling_method); pooling initialized frompooler_config.ModernBertPooleruses configuredseq_pooling_typeand validates against HFclassifier_pooling; sequence classification uses this pooler.CLSPoolusage;DispatchPooler.for_seq_cls/for_embeddinghandle token extraction; minor comment clarifications.GritLMPooleronly forMEAN; otherwise defer to genericpooler_for_embed.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.
BertPoolernow acceptsseq_pooling_typeand usesget_seq_pooling_method;BertPoolingModel/BertWithRopeinitialize pooler frompooler_config.ModernBertPooleruses providedseq_pooling_type;ModernBertForSequenceClassificationvalidates HFclassifier_poolingvs. configured type and wires pooling intoDispatchPooler.for_seq_cls.CLSPool; rely onDispatchPooler.for_seq_cls/for_embeddingfor token extraction; clarify comments.GritLMMeanPoolonly whenseq_pooling_type == "MEAN"; otherwise defer toget_seq_pooling_method.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.
BertPoolernow takesPoolerConfigand usesget_seq_pooling_method; pooling instantiated frompooler_configinBertPoolingModelandBertWithRope(when present)ModernBertPooler(config, pooler_config)(uses HFclassifier_pooling);ModernBertForSequenceClassificationwires this throughDispatchPooler.for_seq_clsCLSPool; rely onDispatchPooler.for_seq_cls/for_embeddingfor token extraction; update default attribute todefault_seq_pooling_typeGritLMPooleruses customGritLMMeanPoolonly forMEAN, otherwise defers toget_seq_pooling_method; updatesDispatchPoolerwiringSPLADESparsePoolerWritten by Cursor Bugbot for commit 69c8fde. This will update automatically on new commits. Configure here.