vllm-project/vllm · error · ValueError

Cannot set both `pooling_type` and `seq_pooling_type`

Error message

Cannot set both `pooling_type` and `seq_pooling_type`

What it means

PoolerConfig.__post_init__ forbids setting both the convenience field pooling_type and the specific seq_pooling_type. pooling_type exists only as a user-facing shortcut that auto-resolves into seq_pooling_type or tok_pooling_type; setting both creates ambiguity about which sequence pooling method wins.

Source

Thrown at vllm/config/pooler.py:137

    @classmethod
    def reject_removed_parameters(cls, data):
        values = data.kwargs if isinstance(data, ArgsKwargs) else data
        if not isinstance(values, dict):
            return data
        if "normalize" in values:
            raise ValueError(
                "Parameter `normalize` was removed; use `use_activation` instead."
            )
        check_removed_pooling_task(values.get("task"))
        return data

    def __post_init__(self) -> None:
        if self.logit_sigma is not None and self.logit_sigma == 0:
            raise ValueError("logit_sigma cannot be 0 (division by zero)")

        if pooling_type := self.pooling_type:
            if self.seq_pooling_type is not None:
                raise ValueError(
                    "Cannot set both `pooling_type` and `seq_pooling_type`"
                )
            if self.tok_pooling_type is not None:
                raise ValueError(
                    "Cannot set both `pooling_type` and `tok_pooling_type`"
                )

            if pooling_type in SEQ_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `seq_pooling_type=%r`.",
                    pooling_type,
                    pooling_type,
                )
                self.seq_pooling_type = pooling_type  # type: ignore[assignment]
            elif pooling_type in TOK_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `tok_pooling_type=%r`.",
                    pooling_type,

View on GitHub (pinned to c794754062)

Solutions

  1. Keep only seq_pooling_type (or tok_pooling_type) and drop pooling_type.
  2. Or keep only pooling_type and let it auto-resolve.
  3. Audit generated override dicts for both keys before passing to PoolerConfig.

Example fix

# before
PoolerConfig(pooling_type='MEAN', seq_pooling_type='CLS')

# after
PoolerConfig(seq_pooling_type='CLS')
Defensive patterns

Strategy: validation

Validate before calling

def validate_pooler_fields(cfg_kwargs: dict) -> None:
    if cfg_kwargs.get("pooling_type") and cfg_kwargs.get("seq_pooling_type"):
        raise SystemExit("set either pooling_type or seq_pooling_type, not both")

Prevention

When it happens

Trigger: Constructing PoolerConfig(pooling_type='MEAN', seq_pooling_type='CLS') or a CLI/config override that supplies both keys.

Common situations: Copying a model's default seq_pooling_type into an override while also setting pooling_type for clarity; merging config dicts that each contributed one of the fields.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/704af0e395daf5d1. Report an issue: GitHub.