BerriAI/litellm · error · ValueError

baseline_model is set for exactly the reverse jobs

Error message

baseline_model is set for exactly the reverse jobs

What it means

Pydantic model validator on ActiveShadowEvalJob: baseline_model is set (or omitted) inconsistently with direction — a baseline model is only valid for 'reverse' shadow-eval jobs, so the job config is contradictory and rejected at load time.

Solutions

  1. Set baseline_model only for the intended shadow-eval job direction; remove it from the reverse job configuration.

Example fix

# set baseline_model on both shadow jobs or neither
Defensive patterns

Strategy: validation

When it happens

Trigger: baseline_model configured on exactly the opposite set of shadow eval jobs than intended.

Common situations: Copy-pasted job config with baseline_model applied to the wrong job.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/3011dcf79e87395f. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/shadow_eval_logger.py:477

    id: str
    router_name: str
    direction: ShadowEvalDirection = "forward"
    baseline_model: str | None = None
    shadow_percentage: float
    judge_model: str
    max_turns: int
    ends_at: datetime
    attempts: int = 0

    @field_validator("ends_at")
    @classmethod
    def _as_utc(cls, value: datetime) -> datetime:
        return value.replace(tzinfo=timezone.utc) if value.tzinfo is None else value

    @model_validator(mode="after")
    def _baseline_model_matches_direction(self) -> "ActiveShadowEvalJob":
        if (self.baseline_model is not None) != (self.direction == "reverse"):
            raise ValueError("baseline_model is set for exactly the reverse jobs")
        return self

    @property
    def shadow_target(self) -> str:
        """The model the duplicated arm calls: the router itself for a forward job, the
        fixed baseline for a reverse one. Total because the validator above pins
        baseline_model to reverse jobs and only those."""
        return self.baseline_model or self.router_name


def _as_active_job(record: object, attempts: int) -> ActiveShadowEvalJob | None:
    """The sampling path's view of one job row, or None for a row it cannot sample: an
    unknown direction, or a reverse job with no baseline model to duplicate against.
    Failing closed here is what keeps the dispatch path total."""
    try:
        job: Final = ActiveShadowEvalJob.model_validate(record)
    except ValidationError as e:
        verbose_logger.debug("shadow_eval: skipping unsamplable job row: %s", e)

View on GitHub (pinned to 77b7c6c40c)