---
title: Reliability engineering for ML and LLM systems
url: https://gurkanozkan.ai/learn/topics/systems-reliability/
markdown: https://gurkanozkan.ai/learn/topics/systems-reliability.md
kind: topic
tracks:
  - Applied LLM
  - AI leadership
  - ML engineering
  - Research
json: https://gurkanozkan.ai/api/learn/topics/systems-reliability.json
---

# 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.

## 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.

### 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.

## 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.

**Solution**

**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.


### 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?

**Solution**

**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.


### 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?

**Solution**

**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.


## What changed recently

- **Feb 2026: 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](https://status.cloud.google.com/incidents/41E5S3mkTGDfkZuJZH5k)
- **Nov 2025: 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](https://blog.cloudflare.com/18-november-2025-outage/)
- **Oct 2025: 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](https://aws.amazon.com/message/101925/)
- **Sep 2025: 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](https://www.anthropic.com/engineering/a-postmortem-of-three-recent-issues)
- **Feb 2025: 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](https://arxiv.org/abs/2502.12340)

## 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.

## Reading

- [Postmortem Culture: Learning from Failure (Google SRE book, chapter 15)](https://sre.google/sre-book/postmortem-culture/) (Book, 25 min, Intro): How blameless postmortems turn incidents into lasting improvements.
- [A postmortem of three recent issues (Anthropic)](https://www.anthropic.com/engineering/a-postmortem-of-three-recent-issues) (Blog, 20 min, Core): How routing, configuration and compiler bugs degraded LLM output quality without raising errors, and why evals and privacy limits made them hard to catch.
- [Service Level Objectives (Google SRE book, chapter 4)](https://sre.google/sre-book/service-level-objectives/) (Book, 30 min, Core): The canonical treatment of SLIs, SLOs and how to choose them.
- [Timeouts, retries, and backoff with jitter (Amazon Builders' Library)](https://builder.aws.com/content/3EumjoZascWd1oZiEgL8ORlv3qE/timeouts-retries-and-backoff-with-jitter) (Blog, 25 min, Core): Practical guidance on retry amplification across layers, jitter and idempotency.
- [The ML Test Score: A Rubric for ML Production Readiness and Technical Debt Reduction](https://research.google/pubs/the-ml-test-score-a-rubric-for-ml-production-readiness-and-technical-debt-reduction/) (Paper, 30 min, Core): A concrete checklist of tests for data, models, infrastructure and monitoring.
- [Summary of the Amazon DynamoDB Service Disruption in the Northern Virginia (US-EAST-1) Region](https://aws.amazon.com/message/101925/) (Blog, 30 min, Core): A first-hand account of a latent race condition, a dependency chain and congestive collapse that needed throttling to recover.
- [The Tail at Scale](https://research.google/pubs/the-tail-at-scale/) (Paper, 30 min, Deep): Why fan-out makes rare slowness common, and hedged or tied requests as remedies.
- [Metastable Failures in Distributed Systems](https://sigops.org/s/conferences/hotos/2021/papers/hotos21-s11-bronson.pdf) (Paper, 30 min, Deep): Explains outages that persist after the trigger, often sustained by retries.

## Practise this topic

- [Your product depends on an external LLM API that sometimes returns 429s and overload errors and occasionally stalls mid-stream. Design the client-side…](https://gurkanozkan.ai/learn/questions/applied-llm-srv-11.md)
- [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…](https://gurkanozkan.ai/learn/questions/applied-llm-cod-01.md)
- [List the main ways tool-using agents fail in production and the mitigation for each.](https://gurkanozkan.ai/learn/questions/applied-llm-agt-06.md)
- [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…](https://gurkanozkan.ai/learn/questions/applied-llm-dbg-07.md)
- [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.](https://gurkanozkan.ai/learn/questions/applied-llm-prm-04.md)
- [Most of our AI features depend on a single frontier-model API. Is that a problem, and what would you do?](https://gurkanozkan.ai/learn/questions/lead-st-06.md)
- [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…](https://gurkanozkan.ai/learn/questions/lead-td-02.md)
- [How do you make tool-using agents reliable enough for production?](https://gurkanozkan.ai/learn/questions/lead-td-10.md)
- [What is your minimum engineering bar before an ML model goes to production?](https://gurkanozkan.ai/learn/questions/lead-td-12.md)
- [Design the serving stack for a large multimodal assistant used by millions of people. Where are the bottlenecks?](https://gurkanozkan.ai/learn/questions/research-serving-a-large-multimodal-assistant-081.md)
---

*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.*
