Skip to content
nonconvexcard

Measure fan-out amplification and the value of hedging

CodingIntermediate⏱ 1 hourAI Systemsfan-outtail latencyhedgingorder statisticssimulation

Problem

Quantify what fan-out does to a tail, and what a hedged request buys back.

  1. required_child_quantile(n, p) and parent_tail(n, child_tail) — the closed forms.
  2. simulate_max_quantile(n, mean, p, trials, seed) — the empirical pp-quantile of the maximum of nn exponential latencies.
  3. hedged_samples(mean, d, trials, seed) — latencies when a duplicate attempt starts at delay dd and the first response wins.
  4. hedge_extra_load(p) — expected attempts per logical request when hedging at the pp-quantile.

Then confirm that the simulated hedged tail matches Fˉ(t)Fˉ(t−d)\bar F(t)\bar F(t-d) for t>dt > d.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here9 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 90s · draft saved in this browser
9 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Hints

Hints — 0 of 2 revealed

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Budget a latency target across a fan-outAI SystemsNumericalBeginner15 min
Simulate distance contrast runClassical MLCodingBeginner30 min
Balls into bins, with one choice and with two runAI SystemsCodingIntermediate1 hour
Cache hit rates under Zipf popularity runAI SystemsCodingIntermediate1 hour
Measure anisotropy in an embedding space runRAGCodingIntermediate1 hour