vllm-project/vllm · error · ValueError

synthetic_acceptance_rates entries must be in [0, 1], got {r

Error message

synthetic_acceptance_rates entries must be in [0, 1], got {rates}.

What it means

Each entry of synthetic_acceptance_rates must be a probability in [0, 1]. Values outside that range (negative, > 1, NaN) are not valid acceptance probabilities and the profile is rejected before ever reaching the sampler.

Source

Thrown at vllm/config/speculative.py:274

    def _resolve_synthetic_acceptance_rates(
        n: int,
        rates: list[float] | None,
        length: float | None,
    ) -> list[float]:
        """Return per-position unconditional acceptance rates from exactly one
        of `rates` or `length` (validates range, length, and monotonicity)."""
        if (rates is None) == (length is None):
            raise ValueError(
                "rejection_sample_method='synthetic' requires exactly one of "
                "synthetic_acceptance_rates or synthetic_acceptance_length."
            )
        if rates is not None:
            if len(rates) != n:
                raise ValueError(
                    f"synthetic_acceptance_rates must have length {n}, got {rates}."
                )
            if not all(0.0 <= r <= 1.0 for r in rates):
                raise ValueError(
                    f"synthetic_acceptance_rates entries must be in [0, 1], "
                    f"got {rates}."
                )
            if any(rates[i] > rates[i - 1] for i in range(1, n)):
                raise ValueError(
                    f"synthetic_acceptance_rates must be non-increasing, got {rates}."
                )
            return list(rates)
        assert length is not None
        if not 1.0 <= length <= float(n + 1):
            raise ValueError(
                f"synthetic_acceptance_length must be in [1, {n + 1}], got {length}."
            )
        return SpeculativeConfig._acceptance_length_to_rates(length, n)

    draft_sample_method: DraftSampleMethod = "greedy"
    """How the draft model samples tokens. 'greedy' always picks the argmax
    token, and the draft probabilities are treated as one-hot during rejection

View on GitHub (pinned to c794754062)

Solutions

  1. Clip/normalize rates to [0,1] before passing them
  2. Fix the measurement pipeline to emit probabilities (accepted/total)
  3. Replace NaN with 0.0 or use synthetic_acceptance_length instead

Example fix

# before
synthetic_acceptance_rates=[92, 85, 70]  # percentages

# after
synthetic_acceptance_rates=[0.92, 0.85, 0.70]
Defensive patterns

Strategy: validation

Validate before calling

def rates_in_range(rates: list[float]) -> bool:
    return all(0.0 <= r <= 1.0 for r in rates)

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Rates computed as ratios with inverted denominators producing >1 values; NaN leaking in from logging measurements (0/0); percentage values (92) supplied instead of fractions (0.92).

Common situations: Hand-derived profiles from acceptance counts; pandas/numpy pipelines that emit NaN for empty buckets; unit confusion percent vs probability.

Related errors


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