Evaluation and QualityStatistical reliabilityPrincipal
How can traffic mix reverse overall p99 latency while every request class gets slower?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
Using a hypothetical point-mass workload, Model A gets 98 percent short requests at 100 ms and 2 percent long at 10 seconds. Model B gets 99.5 percent short at 120 ms and 0.5 percent long at 12 seconds. Derive each overall p99 using an inverse-CDF convention, explain why bucket p99 s cannot be averaged, and design a fair matched-workload comparison including timeouts and behavior-driven mix changes.
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
Before arguing about the GPU, look at which requests entered each measurement. Say Model A saw 98% short prompts at 100 ms and 2% long prompts at 10 seconds. Model B saw 99.5% short prompts at 120 ms and 0.5% long prompts at 12 seconds. B is slower in both buckets, yet its overall p99 is around 120 ms while A's is 10 seconds. At the 99 th percentile, A's tail includes long prompts and B's does not. These are simplified point masses, but the reversal is real. You cannot average bucket p99 s to recover the overall p99 either.
Why did the mixes differ? A randomized A/B test should make them similar in expectation, though small samples can still differ. Maybe routing only sent easy requests to B, a compatibility filter excluded long prompts, timeouts disappeared from one dashboard, or the two arms ran during different hours. Compare the assigned population, not just completed requests. Check prompt and output lengths, image and tool use, tenant, region, cache hit, batch size, admission failures and deployment window. If assignment is truly randomized and the distribution is comparable, the paradoxical aggregate deserves a closer look at quantile estimation and sample size.
For a decision, keep user-visible p99 as an SLO metric, but compare models on a matched workload or reweight to a declared target traffic mix. Report latency distributions within useful request classes and completion/failure rates. A single scalar p99 of a shifting population cannot tell us whether B is faster at the same work. Google's SRE guidance discusses separate objectives for heterogeneous workload classes. It supports separating classes, while the numeric example here is just arithmetic.
The follow-up is that traffic mix can be part of the product effect. If a model's behavior causes users to make more long requests, “hold the mix fixed” estimates a direct serving comparison, not the full system outcome. Report both questions clearly. A flattering aggregate is sometimes a real change in user behavior, sometimes an assignment bug, and sometimes a dashboard that lost difficult requests. The data lineage decides which.
The 99 th percentile is the smallest latency whose cumulative probability reaches 0.99 under the convention used here. A’s 100 ms mass reaches only 0.98, so its p99 lies at 10 seconds. B’s 120 ms mass already reaches 0.995, so its p99 is 120 ms. Averaging class quantiles with traffic weights instead computes a different quantity. In a real dataset, specify the estimator and handling of ties, failures and censored requests before comparing dashboards.
Within-class p99 alone also does not describe the entire class distribution. If the workload weights match yet the aggregate seems surprising, inspect the relevant cumulative distributions and sample uncertainty rather than declaring the result impossible. A quantile comparison at one cutoff does not establish that one model is faster at every threshold. Matching traffic composition and examining full distributions together distinguish a routing artifact from a real serving difference.
Related questions
Keep practising evaluation and quality
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