vllm-project/vllm · error · ValueError

logit_sigma cannot be 0 (division by zero)

Error message

logit_sigma cannot be 0 (division by zero)

What it means

PoolerConfig.__post_init__ rejects logit_sigma == 0. logit_sigma divides classification logits for Platt-style score calibration: activation((logit - logit_mean) / logit_sigma). Zero would cause division by zero at inference time, so config construction fails fast.

Source

Thrown at vllm/config/pooler.py:133

    `math-shepherd-mistral-7b-prm` model.
    """

    @model_validator(mode="before")
    @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]

View on GitHub (pinned to c794754062)

Solutions

  1. Set logit_sigma to a non-zero scale value (typically the calibrated sigma, e.g. 1.0).
  2. Omit logit_sigma entirely if no sigma scaling is wanted (None disables it).
  3. If only mean calibration is needed, set logit_mean only and leave logit_sigma unset.

Example fix

# before
PoolerConfig(logit_mean=0.5, logit_sigma=0)

# after
PoolerConfig(logit_mean=0.5, logit_sigma=1.0)  # or omit logit_sigma
Defensive patterns

Strategy: validation

Validate before calling

def validate_pooler_calibration(logit_sigma: float | None) -> float | None:
    if logit_sigma == 0:
        raise SystemExit("logit_sigma must be non-zero; omit it if sigma scaling is unused")
    return logit_sigma

Prevention

When it happens

Trigger: Passing PoolerConfig(logit_sigma=0) (or --overrides pooler_config.logit_sigma=0) for a classification model, often when logit_mean is set for calibration and sigma is left as an explicit 0 instead of omitted.

Common situations: Calibration configs where a user zeroes out unused knobs; porting calibration YAML where 0 was a placeholder; confusion between 'None means unused' and '0 means unused'.

Related errors


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