← Questions

Design guardrails and fallbacks for a reliable LLM service

0
AnthropicSystem designLast asked Feb 2026

An AI system design interview question asked in Anthropic's system design round, last asked Feb 2026. It tests llm, guardrails and fault tolerance.

A product depends on calls to a large language model. Design the guardrails and fallback paths that keep it reliable and safe: what is checked before a request reaches the model and after the answer comes back, what happens when the model times out, errors, is overloaded, or returns something unusable or unsafe, and how the system falls back without making an outage worse.

Requirements

  • Functional: validate and filter inputs (size, prompt injection, policy); validate outputs (schema for structured answers, safety and policy, grounding where needed); retries, a second model or provider, cached or degraded answers; a clear message to the user when nothing works.
  • Non-functional: added latency from guardrails within a fixed budget (for example under 100 ms at p95); no retry storms during a provider outage; every block and fallback measurable; behaviour configurable per product surface.

Clarifying questions

  • What does the product do with the output: show it to a user, take an action, or feed another system?
  • Which failures matter most: unavailability, wrong format, unsafe content, or confidently wrong answers?
  • Are there several models or providers available, and do their answers have to match in format?
  • What latency and cost budget does each request have?
  • Who sets the policies, and how quickly must a new rule take effect?

What a strong answer covers

  • A request pipeline: input checks (length, PII, injection classifiers), the model call through a client with timeouts, then output checks (JSON schema validation and repair, safety classifier, rules), each step able to pass, fix, retry or block.
  • Failure handling: retries with backoff and jitter only for retryable errors, a retry budget, circuit breakers per provider, hedged requests for latency, and fallback to a smaller or other provider's model with its own prompt.
  • Degraded modes: cached answers for common requests, a simpler non-LLM path, or an honest error, chosen per surface.
  • Avoiding harm from the fallbacks themselves: idempotent actions, not doubling load on a struggling provider, and keeping the fallback model to the same output contract.
  • Measuring it: block rates, false positives sampled for review, schema failure rates, fallback rates, latency per stage, and offline evaluation sets for the classifiers; alerts on sudden changes.
  • Rolling out new guardrails in shadow mode before they block.

Follow-ups

  • The primary provider is down for an hour. Walk through what users see and what the system does.
  • A new jailbreak gets through. How do you find it and ship a fix within hours?
  • Output checks add 300 ms. How do you get the latency back (streaming with checks on chunks, parallel checks)?
  • The model's answer will trigger an action like a refund. What extra guardrails apply?

Where it's asked

  • Anthropic · System design · Last asked Feb 202655 min · Design discussion, often typed into a shared Google Doc rather than drawn; some rounds let you share any drawing tool · No AI

What it tests

llm · guardrails · fault tolerance · failover

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing