$ fssg build --deterministic --validate |

Treat LLM Fallback as a Model Migration, Not a Retry

AI Engineering

An LLM fallback is not a retry. A retry repeats an operation under the same behavioral contract. A fallback changes one of the components that interprets that contract.

That distinction matters the moment a model can choose tools, emit structured data, or influence an external action. Replacing model-a with model-b may preserve HTTP availability while changing argument construction, refusal behavior, context limits, instruction priority, or the meaning of “done.” The request succeeded. The task may have changed.

I treat every fallback as a small model migration.

Availability is the weakest success condition

A typical fallback ladder looks harmless:

primary model -> smaller model -> second provider -> cached answer

It answers one question: can the system return something? Production systems need a harder question: can the substitute complete this task without violating its contract?

The answer is task-specific. A summarizer may tolerate a different writing style. A classifier cannot tolerate an unknown label. A tool-using agent cannot silently lose parallel calls or submit a malformed argument. A workflow that drafts a message may degrade to plain text; a workflow authorized to send that message must not inherit the same fallback automatically.

This is why provider uptime and semantic compatibility belong to different layers.

Define a compatibility envelope

Before adding a model to a fallback path, I describe the smallest envelope within which substitution is allowed:

Boundary Question Fail-closed example
Input Can the model consume the same modalities and context shape? Reject an image task on a text-only fallback.
Output Does it satisfy the same schema and refusal states? Reject unknown enums; do not repair them into valid values.
Tools Are required tool-call semantics supported and tested? Disable the route if a required tool cannot be expressed.
Authority May this model influence the same effects? Downgrade from execute to draft when assurance is lower.
Quality Has it passed the task's regression set? Stop instead of using a model below the acceptance threshold.
Operations Are latency, context and rate limits compatible? Resume from a checkpoint rather than truncate hidden context.

The envelope is not a universal model score. It is a compatibility statement for one route and one task class.

{
  "route": "support.refund_draft",
  "required": {
    "schema": "refund-draft/v3",
    "tools": ["orders.read"],
    "max_authority": "draft",
    "modalities": ["text"],
    "eval_suite": "refund-draft-regression@12"
  },
  "fallbacks": [
    {"model": "primary-pinned-snapshot", "mode": "normal"},
    {"model": "secondary-pinned-snapshot", "mode": "draft_only"}
  ],
  "otherwise": "stop_with_recovery_artifact"
}

The names are illustrative. The important part is that the route declares what must remain true before a provider is selected.

Test substitution, not just each model

A model can pass an isolated benchmark and still fail as a substitute. The migration test has to replay the same task fixtures through both sides of the boundary.

I would keep at least four fixture groups:

  1. Nominal cases — common inputs with exact schema and tool assertions.
  2. Boundary cases — maximum context, ambiguous instructions, empty retrieval and unsupported modalities.
  3. Refusal cases — tasks that must stop, escalate, or request missing authority.
  4. Adversarial cases — prompt injection, invalid tool results and conflicting instructions.

Compare contract outcomes before prose similarity: valid terminal state, selected tool, normalized arguments, authority requested, evidence retained, and side-effect eligibility. Style can differ. Safety and task semantics cannot.

OpenAI's production guidance recommends pinning model snapshots and running evaluations when prompts or models change. That is the right base, but a fallback adds a routing decision. The route itself therefore needs tests: which failure activates it, which task classes may enter it, and which capabilities are removed after the switch.

This extends the argument in Why I Pin the Model Version and Test Every Bump. Pinning stabilizes each endpoint. A compatibility envelope governs movement between endpoints.

Degrade authority before quality

The most useful fallback is often not “another model with the same powers.” It is a narrower mode.

A system may move through states such as:

execute -> propose -> classify -> retrieve -> stop

Each step removes authority while preserving some useful work. If the primary model is unavailable, the secondary model might prepare a draft plus cited inputs but be forbidden to send, purchase, delete, or approve. If structured tool calling is unavailable, the system may return a recovery artifact instead of pretending free-form text is an executable command.

This makes degradation explicit and reviewable. It also aligns with a broader runtime rule: the model proposes, but the execution boundary decides what may commit. The AI runtime should select both a model and an authority profile, not treat the model name as the whole route.

Keep adapters passive

Fallback code often grows “helpful” repairs: rename a field for provider B, infer a missing enum, flatten tool results, or rewrite instructions until the second model accepts them. That restores traffic by moving semantics into an unreviewed adapter.

I avoid that. As I argued in Why AI Provider Adapters Must Not Repair Semantics, adapters should translate representation, not invent intent. If a provider cannot represent the contract, compilation or routing should reject the pairing. Silent repair makes replay and comparison unreliable because the effective task is no longer the declared task.

A migration checklist for every fallback

Before enabling a route, I want a compact receipt:

  • pinned primary and fallback identities;
  • activation conditions and circuit-breaker behavior;
  • accepted task classes and excluded capabilities;
  • schema, tool and refusal fixtures;
  • regression result for the exact prompt and contract revision;
  • authority downgrade after substitution;
  • observable route/model identity in the trace;
  • stop and recovery behavior when no compatible model remains.

The evaluation-tool decision matrix can help choose where those checks live. The artifact matters more than the vendor: fixtures and results must remain inspectable outside the routing dashboard.

This approach does not prove that two models are behaviorally identical. They are not. It proves a narrower and more useful claim: for a declared task class, the substitute stayed inside the tested envelope. Outside that envelope, the system stopped or reduced authority instead of improvising continuity.

Availability is valuable. Semantic continuity is earned.

Sources

FACET AI CLI Terminal
facet@ai:~$