Distributed ReliabilityLatency and load evidencePrincipal
When can hedged model requests improve p99 response time, and when do they worsen overload?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A gateway duplicates slow model requests and takes the first result. Off peak p95 improves, but at peak duplicate GPU work rises and p99 collapses. Explain the feedback loop, define eligible requests and winner selection for streaming, and design capacity-aware hedge budgets, cancellation and a load test that measures useful work.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Hedging spends spare capacity to escape an isolated slow replica. If the tail comes from shared saturation, a duplicate enters the same queues and repeats initial prompt processing, called prefill. It also allocates its own attention state, called a key-value or KV cache, and may perform many decode steps to generate new tokens. It can push the fleet further into saturation, which triggers more hedges. The Tail at Scale studies when hedging helps large distributed services, while gRPC's hedging guide warns that naive hedging adds load and describes limits and throttling. Neither says to duplicate expensive generation indiscriminately.
Consider a hypothetical pool that can sustain 650 equal-cost attempts per second at the target latency. It receives 600 logical requests per second. If 20 percent launch one hedge and both attempts consume a full request’s work before cancellation takes effect, demand becomes 600 × 1.2 = 720 attempt-equivalents per second. The added work exceeds the pool’s measured capacity. This is a deliberately simple capacity example, not a claim that all hedges run to completion. Measure the loser’s actual work to determine the real amplification.
I would start with a latency decomposition. Is the request queued, pre-filling a long prompt, decoding slowly, or waiting on a remote tool? Hedging at the gateway after a total-latency threshold may start another expensive prefill when the first replica is already generating. For a streamed answer, switching winners after the user saw tokens is not a transparent hedge. If only pre-first-token work is eligible, state that boundary. Requests with external side effects should not be duplicated unless their tools have their own idempotency and authorization contract.
An effective design sets a small hedge budget, waits until a measured tail threshold, sends the copy to a genuinely independent and healthy capacity pool, and cancels the loser through the actual engine scheduler. Closing the client stream alone may leave GPU work running. Suppress hedges when utilization, queue age or admitted decode load says the fleet is saturated. Compare the extra compute against the user latency saved, and use one deadline for both copies.
I would run open-loop load tests across low, medium and peak arrival rates. Count logical requests and physical attempts separately, track both copies' GPU time and KV residency, and inspect p95, p99, error rate and completed tasks per GPU-hour. A hedging policy that looks excellent at 30% utilization but destabilizes 90% utilization is not ready to ship. The condition that made hedging useful is also the condition the admission controller must prove still holds.
Related questions
Keep practising distributed reliability
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux