PoolingParams class controls how vLLM performs pooling operations for embeddings, classification, and scoring tasks.
Constructor
Parameters
Whether to apply activation function to pooler outputs. None uses the model’s default (typically True).
Reduce embedding dimensions if the model supports matryoshka representation. Only valid for embedding tasks.
The pooling task to perform. Should be one of:
"embed"- Generate embeddings"classify"- Classification task"score"- Scoring/ranking task"token_embed"- Token-level embeddings"token_classify"- Token-level classification
Task-specific parameters
Different pooling tasks support different parameters:Embedding tasks (embed, token_embed)
use_activation: Whether to apply activationdimensions: Output dimensionality (if model supports matryoshka)
Classification tasks (classify, token_classify)
use_activation: Whether to apply activation
Scoring task (score)
use_activation: Whether to apply activation
Example: Generate embeddings
Example: Matryoshka embeddings
Example: Classification
Example: Scoring/Reranking
Valid parameter combinations
ThePoolingParams class validates that only task-appropriate parameters are specified:
| Task | Valid Parameters |
|---|---|
embed | use_activation, dimensions |
classify | use_activation |
score | use_activation |
token_embed | use_activation, dimensions |
token_classify | use_activation |
Related
- LLM - Use PoolingParams with
llm.embed(),llm.classify(), orllm.score() - SamplingParams - Parameters for text generation
- Output classes - Output formats for pooling tasks