LearnTopic guide

Reliability engineering for ML and LLM systems

Production AI systems fail in the ordinary distributed-systems ways (timeouts, overload, cascading retries, tail latency, partial outages of a dependency) and in ML-specific ways (silent data and model degradation, malformed structured output, agents compounding small error rates over many steps). Interviewers probe whether you can set SLOs and error budgets, design client-side resilience for a flaky LLM API, reason about concurrency and hung requests, define a minimum engineering bar before a model ships, and lead improvement through blameless postmortems. Public postmortems from 2025–26 are now common interview material: infrastructure bugs that quietly degraded Claude’s answers, the AWS us-east-1 and Cloudflare outages, a shared safety service that took down every Gemini model on Vertex AI, and silent data corruption in large training runs. Strong answers attach numbers to availability, amplification and tail probabilities instead of listing best practices.

Applied LLM · AI leadership · ML engineering · Research8 key concepts10 questions

Start: Key concepts 6 lessons · about 19 min
Contents

Key concepts

SLIs, SLOs and error budgets

An SLI is a measured ratio (requests answered successfully within 2 s ÷ all requests); an SLO is its target over a window (99.9% over 30 days); the error budget is what remains (0.1%, or 43.2 minutes of full outage a month). Spending the budget on risky launches is acceptable; exhausting it triggers a freeze on features in favour of reliability work. For LLM features use latency SLIs that match streaming (time to first token, inter-token latency) and add quality SLIs, such as schema-valid output rate and groundedness on sampled traffic, not just uptime: Anthropic’s 2025 postmortem describes weeks of degraded answers from routing, configuration and compiler bugs that error rates and standard benchmarks did not reveal, fixed in part by continuous quality evaluation on production.

Timeouts, retries, backoff and idempotency

Every call needs a timeout derived from the caller’s deadline; for streaming, use an idle timeout between chunks as well as a total one. Retry only transient errors (429, 503, timeouts), with exponential backoff and full jitter, honouring Retry-After. Retry at one layer of the stack, cap retries with a budget (for example, retries at most 10% of requests), and make side-effecting calls idempotent with idempotency keys so a retried refund is not paid twice. Restarts and reconnects need jitter too: Google Cloud’s June 2025 outage lasted longest in us-central1 because restarting tasks without randomised exponential backoff overloaded the database they all depended on.

Flow · 5 stepsClient-side resilience for a flaky LLM API

Client-side resilience for a flaky LLM APIAn incoming request passes through a timeout and idle-timeout guard, then a provider call. Success returns the answer; a transient error (429, 503, timeout) triggers a jittered retry that loops back to the provider, while a breached error threshold trips the circuit breaker and sends traffic to a fallback or degraded response.Incoming requestcaller deadlineTimeout guardtotal + idle timeoutLLM provider callstreamingCircuitbreakerfail fast pastthresholdAnswersuccessRetry withbackoffexponential,full jitterFallback / degraded responsecheaper model, cached answersuccess429, 503, timeouterror rateopen12345InputClientProviderOutput
  1. Bound the call The caller sets a total deadline and an idle timeout between chunks.
  2. Call the provider The request reaches the LLM provider; a successful response returns the answer.
  3. Retry transient errors On 429, 503 or a timeout, retry with exponential backoff and full jitter, honouring Retry-After.
  4. Cap the retries Retries stay within a budget (for example at most 10% of requests); side-effecting calls carry idempotency keys.
  5. Fail fast to fallback Once the error rate crosses the threshold, the circuit breaker opens and traffic goes to a fallback model or a degraded response.

A request is bounded by timeouts, retried only for transient errors within a budget, and fails fast to a fallback when the circuit breaker opens.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1Bound the callThe caller sets a total deadline and an idle timeout between chunks.
2Call the providerThe request reaches the LLM provider; a successful response returns the answer.
3Retry transient errorsOn 429, 503 or a timeout, retry with exponential backoff and full jitter, honouring Retry-After.
4Cap the retriesRetries stay within a budget (for example at most 10% of requests); side-effecting calls carry idempotency keys.
5Fail fast to fallbackOnce the error rate crosses the threshold, the circuit breaker opens and traffic goes to a fallback model or a degraded response.

Source: This page's text

Boxes
BoxGroupDetail
Incoming requestInputcaller deadline
Timeout guardClienttotal + idle timeout
LLM provider callProviderstreaming
Retry with backoffClientexponential, full jitter
Circuit breakerClientfail fast past threshold
AnswerOutputsuccess
Fallback / degraded responseOutputcheaper model, cached answer

Source: This page's text

Overload protection and cascading failure

When a dependency slows, queues grow, timeouts fire, retries add load and healthy components fall over in turn. Defences: bounded queues and concurrency limits (semaphores), load shedding by priority, circuit breakers that fail fast once error rates cross a threshold, backpressure to callers, and graceful degradation (a cheaper model, a cached answer, a ‘try again shortly’ message). Metastable failures persist even after the trigger is gone because the retry load itself keeps the system overloaded; the fix is to remove the sustaining load. In AWS’s October 2025 us-east-1 outage, DynamoDB’s DNS was repaired in under three hours, but EC2’s lease manager then sat in congestive collapse trying to rebuild every lease at once and recovered only after engineers throttled incoming work and restarted its hosts selectively.

Tail latency at scale

With fan-out, the slowest component sets the response time: if each of 100 shards is slow 1% of the time, 63% of requests hit at least one slow shard. Mitigations include hedged requests (send a second copy after the 95th-percentile latency), tied requests, micro-partitioning and selective replication. Agent pipelines show the same arithmetic for correctness: 20 sequential steps at 95% success each complete only 36% of the time.

Fallbacks and vendor resilience

A single frontier-model API is a concentration risk. Put a gateway in front of providers, keep an evaluated fallback model (another provider or a self-hosted open-weight model) with prompts tested against it, and decide per feature whether degraded quality is acceptable. Check that ‘independent’ fallbacks really are independent: the same cloud region or the same underlying model behind two resellers fails together, and so do sibling models behind one shared service, as when a safety-filter configuration change broke every Gemini model on Vertex AI in February 2026.

Structured-output reliability

For JSON on every call, prefer constrained decoding or a provider’s strict schema mode over prompt- only instructions; validate with a schema library anyway, retry with the validation error once, and route persistent failures to a fallback or a queue. When about 2% of responses fail, bucket failures (truncation at max tokens, markdown fences, wrong types, refusals) by model version and input length before fixing anything.

Concurrency bugs and hung requests

Asynchronous clients need bounded concurrency (a semaphore), token-per-minute budgeting, cancellation that propagates, and no blocking calls (time.sleep) inside the event loop. Servers that hang under load but not alone usually point to resource exhaustion or a scheduling deadlock: KV cache full with preemption thrash, a pool with fewer slots than concurrent users (for example, adapter or connection pools), or an engine bug on a specific code path. Collect stack dumps and engine metrics while it is stuck, add per-request deadlines and a generation-based watchdog, and reproduce with a load test.

Minimum bar for production ML and continuous improvement

Before launch: reproducible training pipeline, data validation on training and serving inputs, offline evaluation with sliced metrics against a baseline, shadow or canary rollout with automatic rollback, monitoring of inputs, outputs and business metrics, an on-call owner and a runbook (the ML Test Score turns this into a rubric). Treat configuration and data pushes like code: Cloudflare’s November 2025 outage began with an internally generated feature file that doubled in size and crashed its proxy, so validate generated config as untrusted input, roll it out progressively and keep kill switches. After incidents: blameless postmortems with timelines, causes and owned action items, tracked to completion.

Next: Worked examples Lesson 3 of 6 · about 5 min

Worked examples

Retry amplification and a sane backoff policy

A request passes through three layers (API gateway → orchestrator → LLM client). Each layer makes up to 3 attempts. The LLM provider starts failing. At 200 incoming requests/s, how much load hits the provider? Then design a better policy with concrete backoff timings.

1. Amplification. Worst case, each layer multiplies attempts by 3: 3 × 3 × 3 = 27 provider calls per incoming request. At 200 requests/s that is 5,400 calls/s against a provider that is already struggling, which is how a partial outage becomes a full one.

2. Retry at one layer. Let only the LLM client retry; the upper layers fail fast and pass the error up. Worst case falls to 3× (600 calls/s).

3. Retry budget. Allow retries for at most 10% of requests in a sliding window: provider load is at most 1.1× (220 calls/s). If every layer must retry, each with a 10% budget, the bound is 1.1³ = 1.33× rather than 27×.

4. Backoff with full jitter. Base 0.5 s, cap 20 s; attempt n sleeps uniform(0, min(20, 0.5 × 2^n)).

  • Retry 1: U(0, 1 s), mean 0.5 s.
  • Retry 2: U(0, 2 s), mean 1 s.
  • Expected extra wait for two retries ≈ 1.5 s; worst case 3 s. Jitter spreads clients so their retries do not arrive in synchronised waves.
  • If the response has Retry-After, wait at least that long.

5. Circuit breaker. If the error rate exceeds 50% over 10 s, stop calling the provider for 30 s, send traffic to the fallback model or a degraded response, then let a few probe requests through before closing the breaker.

6. Streams. Use an idle timeout (for example, 15 s with no tokens) as well as a total deadline; on a stall, cancel and retry once from scratch if the remaining deadline allows.

Flow · 6 stepsRetry amplification and a sane backoff policy

Retry amplification and a sane backoff policyA request enters at 200 requests/s and passes through the API gateway, orchestrator and LLM client before reaching the LLM provider. In the worst case each layer makes up to 3 attempts, giving 27 provider calls per request; in the sane policy the upper layers fail fast, only the client retries, and the budget, jitter, breaker and stream timeouts bound the damage.Incoming requests200 requests/sAPI gatewayworst case 3 attempts; sane: failfastOrchestratorworst case 3 attempts; sane: failfastLLM clientup to 3 attempts; the one retry layerLLM provideralready strugglingFallback / degradedafter the breaker opensrequest3 attempts / fail fast3 attempts / fail fastup to 3 attemptsbreaker open123456InputLayersProviderFallback
  1. Amplification Each layer makes up to 3 attempts: 3 × 3 × 3 = 27 provider calls per request, about 5,400 calls/s at 200 requests/s.
  2. Retry at one layer The upper layers fail fast and pass the error up; only the LLM client retries, worst case 3× (600 calls/s).
  3. Retry budget Allow retries for at most 10% of requests in a sliding window; provider load is at most 1.1× (220 calls/s).
  4. Backoff with full jitter Base 0.5 s, cap 20 s; attempt n sleeps uniform(0, min(20, 0.5 × 2^n)); honour Retry-After.
  5. Circuit breaker If error rate exceeds 50% over 10 s, stop calling the provider for 30 s, send traffic to fallback or degraded response, then probe before closing.
  6. Streams Use an idle timeout (for example, 15 s with no tokens) plus a total deadline; on a stall, cancel and retry once if the remaining deadline allows.

The same request path either multiplies provider load across three layers or fails fast above the LLM client, with a retry budget, full-jitter backoff and a circuit breaker keeping provider load bounded.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1AmplificationEach layer makes up to 3 attempts: 3 × 3 × 3 = 27 provider calls per request, about 5,400 calls/s at 200 requests/s.
2Retry at one layerThe upper layers fail fast and pass the error up; only the LLM client retries, worst case 3× (600 calls/s).
3Retry budgetAllow retries for at most 10% of requests in a sliding window; provider load is at most 1.1× (220 calls/s).
4Backoff with full jitterBase 0.5 s, cap 20 s; attempt n sleeps uniform(0, min(20, 0.5 × 2^n)); honour Retry-After.
5Circuit breakerIf error rate exceeds 50% over 10 s, stop calling the provider for 30 s, send traffic to fallback or degraded response, then probe before closing.
6StreamsUse an idle timeout (for example, 15 s with no tokens) plus a total deadline; on a stall, cancel and retry once if the remaining deadline allows.

Source: This page's text

Boxes
BoxGroupDetail
Incoming requestsInput200 requests/s
API gatewayLayersworst case 3 attempts; sane: fail fast
OrchestratorLayersworst case 3 attempts; sane: fail fast
LLM clientLayersup to 3 attempts; the one retry layer
LLM providerProvideralready struggling
Fallback / degradedFallbackafter the breaker opens

Source: This page's text

Can this LLM feature meet a 99.9% availability SLO?

A feature depends serially on an LLM API (99.5% available), a vector database (99.95%) and your own application tier (99.9%). What availability can it reach? What changes with a fallback provider that is also 99.5% available and fails independently?

1. Serial dependencies multiply. 0.995 × 0.9995 × 0.999 = 0.99351, about 99.35%. Over 30 days (43,200 minutes) that is 0.0065 × 43,200 ≈ 280 minutes of unavailability, against a 99.9% budget of 43.2 minutes.

2. Add an independent fallback provider. The LLM tier fails only if both fail: 1 − 0.005² = 0.999975. Overall = 0.999975 × 0.9995 × 0.999 = 0.99848, about 99.85%, or about 66 minutes a month. Better, but still over budget.

3. Where the budget goes now. The application tier alone (0.1%) consumes the entire 43.2-minute budget and the vector database adds 21.6 minutes. To reach 99.9% you must also harden those, for example multi-zone deployment for the app and a replica for the vector store, or relax the SLO.

4. Correlation caveat. If both providers run in the same cloud region, or one resells the other’s model, failures are correlated and the 0.999975 figure is fiction. Measure joint failure from incident history.

5. Degraded modes count. If a cached or smaller-model answer is acceptable during outages, define the SLI so degraded-but-useful responses count as available, and track quality separately.

CalculatorSerial availability against a 99.9% SLO

Serial availability = LLM API availability × Vector database availability × App tier availability

Serial unavailable min = (1 − Serial availability) × 43200

Availability with fallback = (1 − (1 − LLM API availability) × (1 − Fallback availability)) × Vector database availability × App tier availability

Fallback unavailable min = (1 − Availability with fallback) × 43200

Worked cases
CaseLLM API availabilityVector database availabilityApp tier availabilityFallback availabilitySerial availabilitySerial unavailable minAvailability with fallbackFallback unavailable min
Worked example0.9950.99950.9990.99599.35%280 min/month99.85%66 min/month
Serial dependencies multiply: the LLM API, vector database and app tier land at about 99.35%, far over the 43.2-minute monthly budget.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.

Tail latency with fan-out, and what hedging buys

A request fans out to 100 retrieval shards and waits for all of them. Each shard is fast 99% of the time and slow 1% of the time, independently. What fraction of requests are slow? What happens if you send a hedged duplicate to another replica when a shard has not answered by its 95th-percentile latency?

1. Without hedging. P(no slow shard) = 0.99^100 = 0.366, so 1 − 0.366 = 63.4% of requests wait on at least one slow shard. The rare per-shard event becomes the common case.

2. With hedging. A shard is still slow only if the primary and the hedge are both slow: about 0.01 × 0.01 = 1e-4 if independent. P(at least one slow shard) = 1 − (1 − 1e-4)^100 ≈ 1.0%.

3. Cost. Hedges fire only for sub-requests slower than their p95, so extra load is about 5%. Cancel the loser when one copy answers.

4. Caveats. If slowness is correlated (a hot key, a shared overloaded host), hedging helps less; if the system is overloaded, hedges add load, so disable them under pressure. The same maths applies to agents: per-step success of 95% over 20 steps gives 0.95^20 = 36% end-to-end, so add verification and checkpoints rather than hoping each step improves.

Flow · 3 stepsFan-out tail latency and hedging

Fan-out tail latency and hedgingA request fans out to 100 retrieval shards and waits for all of them. Without hedging, 63.4% of requests hit at least one slow shard; with a hedge after p95, about 1.0% do, at roughly 5% extra load.requestfans out to 100 shardsfan-out100 retrieval shardsprimary shardfast 99% of the timehedged duplicatesecond copy after p95wait for allslowest shard sets response timeresponsecancel the loseransweredslower than p95cancel loser123InputFan-outHedgeOutcome
  1. Baseline fan-out Each shard is slow 1% of the time, so 0.99^100 = 0.366 and 63.4% of requests wait on at least one slow shard.
  2. Hedge after p95 A shard is still slow only if primary and hedge are both slow, about 0.01 x 0.01 = 1e-4, so about 1.0% of requests hit at least one slow shard.
  3. Cost and caveats Hedges fire only for sub-requests slower than p95, about 5% extra load; correlated slowness helps less, and hedges are disabled under pressure.

A request waits on 100 shards, so the rare slow shard becomes the common case unless a hedged duplicate is sent after the 95th-percentile latency.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1Baseline fan-outEach shard is slow 1% of the time, so 0.99^100 = 0.366 and 63.4% of requests wait on at least one slow shard.
2Hedge after p95A shard is still slow only if primary and hedge are both slow, about 0.01 x 0.01 = 1e-4, so about 1.0% of requests hit at least one slow shard.
3Cost and caveatsHedges fire only for sub-requests slower than p95, about 5% extra load; correlated slowness helps less, and hedges are disabled under pressure.

Source: This page's text

Boxes
BoxGroupDetail
requestInputfans out to 100 shards
fan-outFan-out100 retrieval shards
primary shardFan-outfast 99% of the time
hedged duplicateHedgesecond copy after p95
wait for allFan-outslowest shard sets response time
responseOutcomecancel the loser

Source: This page's text

Next: What changed Lesson 4 of 6 · about 3 min

What changed recently

  1. One safety service took down every Gemini model on Vertex AI

    On 27 February 2026 a configuration change to a safety-filtering service used by all Gemini models caused about two hours of errors on Vertex AI’s Gemini API, seen as 429s by pay-as-you-go customers and 503s by provisioned-throughput customers. It is a clean case of correlated failure behind apparently diverse fallbacks: switching to another Gemini model would not have helped, and a 429 did not mean the caller had exceeded its quota. Interviewers use it to test whether a fallback plan crosses providers and whether retry logic copes with provider-side faults.

    Source

  2. Cloudflare's feature-file outage

    On 18 November 2025 a database permissions change made a query write duplicate rows into the Bot Management feature file; the file passed a preallocated 200-feature limit and an unhandled error in Cloudflare’s Rust proxy turned into HTTP 5xx across its network, with core traffic restored about three hours later. Because the file was regenerated every five minutes from a partly updated cluster, the network flapped between good and bad states and first looked like an attack. The lessons interviewers probe: validate internally generated config like user input, stage global pushes and keep kill switches.

    Source

  3. AWS us-east-1: a DNS race condition and congestive collapse

    A latent race between two DynamoDB DNS automation workers left the regional DynamoDB endpoint with an empty DNS record. DNS was fixed in under three hours, but EC2’s lease manager, which depends on DynamoDB, then entered congestive collapse and network load balancers flapped on failing health checks, stretching impact to roughly 14.5 hours. It is a textbook metastable failure: recovery needed throttling and selective restarts, and AWS’s planned fixes include velocity limits on health-check failover and rate limiting by queue size.

    Source

  4. Anthropic's postmortem of three quality bugs

    Between August and early September 2025, a context-window routing error (up to 16% of Sonnet 4 requests in the worst hour, amplified by sticky routing), a TPU misconfiguration that corrupted token probabilities and an XLA:TPU miscompilation of approximate top-k degraded Claude’s output rather than causing errors. Noisy evaluations missed it and privacy limits slowed debugging; the fixes include more sensitive evals and continuous quality evaluation on production. Interviewers now ask how you would detect a model that is up but subtly wrong.

    Source

  5. Silent data corruption in LLM training, measured on real faulty hardware

    A study that trained on unhealthy nodes pulled from a production fleet, using deterministic execution to compare them with healthy ones, found that silent data corruption usually perturbs individual computations only slightly but can still push training to different optima and cause loss spikes. Questions about large training runs now go beyond checkpoint frequency to how you would detect corrupting hardware and when you would quarantine a node.

    Source

Next: Pitfalls and interview angles Lesson 5 of 6 · about 2 min

Pitfalls

  • Retrying at every layer with no budget or jitter, turning a provider slowdown into a self-inflicted outage.
  • Treating availability of a serial chain as the minimum of its parts instead of the product.
  • Assuming fallback providers or models are independent when they share a region, cloud, underlying model or a hidden common service such as safety filtering, authentication, DNS or a CDN.
  • Prompt-only JSON with no validation, or retrying a non-idempotent action without an idempotency key.
  • Health checks that only test that the HTTP server is up, so a wedged model server keeps receiving traffic, and dashboards that track only errors and latency, so a model that is up but subtly wrong goes unnoticed.
  • Postmortems that name a person as the root cause, or action items with no owner and no follow-up.

How interviewers probe it

  • Your product depends on an external LLM API that returns 429s and sometimes stalls mid-stream: design the client-side resilience.
  • Implement an async client with at most C requests in flight, a tokens-per-minute limit and backoff with jitter; how do you test it?
  • Most of our AI features depend on one frontier-model API: is that a problem, and what would you do? Interviewers often anchor this on the 2025–26 cloud, CDN and model-provider outages.
  • A self-hosted model server hangs at zero throughput under concurrent load but not for single requests: how do you debug it?
  • What is your minimum engineering bar before an ML model goes to production, and how do you make tool-using agents reliable?
  • Behavioural variant: something you inherited and improved, or a time you dug into details to find the real cause.
Next: Quiz Lesson 6 of 6 · about 3 min

Quiz

Three questions from this guide. Answer each in your head or out loud, show the model answer, then rate yourself. The cards join your practice deck and come back when they are due.

  1. Question 1 of 3 · Applied LLM · Technical · Medium

    Your product depends on an external LLM API that sometimes returns 429s and overload errors and occasionally stalls mid-stream. Design the client-side reliability layer.

  2. Question 2 of 3 · Applied LLM · Coding · Medium

    Implement an async client that sends N prompts to an LLM API with at most C requests in flight, a tokens-per-minute limit, exponential backoff with jitter and per-request timeouts, returning results in input order.

  3. Question 3 of 3 · Applied LLM · Technical · Medium

    List the main ways tool-using agents fail in production and the mitigation for each.

Reading

Practise this topic

  1. Your product depends on an external LLM API that sometimes returns 429s and overload errors and occasionally stalls mid-stream. Design the client-side reliability layer.Applied LLM · Technical · Medium
  2. Implement an async client that sends N prompts to an LLM API with at most C requests in flight, a tokens-per-minute limit, exponential backoff with jitter and per-request timeouts, returning results in input order.Applied LLM · Coding · Medium
  3. List the main ways tool-using agents fail in production and the mitigation for each.Applied LLM · Technical · Medium
  4. Your self-hosted model server is fine for single requests, but under concurrent load some requests hang at zero throughput while others finish. How do you investigate?Applied LLM · Technical · Hard
  5. Your pipeline needs JSON matching a schema on every call. Compare the options for guaranteeing it, and how you’d handle the failures that remain.Applied LLM · Technical · Easy
  6. Most of our AI features depend on a single frontier-model API. Is that a problem, and what would you do?AI leadership · Technical · Medium
  7. Take a typical LLM serving stack: an API gateway, a request queue, a pool of GPU inference servers running continuous batching, and a single region behind a load balancer. What breaks under load, and what would you change first?AI leadership · System design · Very hard
  8. How do you make tool-using agents reliable enough for production?AI leadership · Technical · Very hard
  9. What is your minimum engineering bar before an ML model goes to production?AI leadership · Technical · Medium
  10. Design the serving stack for a large multimodal assistant used by millions of people. Where are the bottlenecks?Research · System design · Hard

Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.