Compounding error
Series reliability, the \(p^n\) rule
Takeaway
An agent that takes steps at % per step finishes correctly only 36% of the time.
Change the blue numbers. Every figure on this page updates with them.
Why care
Demos show one good run. Production runs thousands, and every tool call, extraction and reasoning step is another chance to fail.
Teams usually measure accuracy per step ("the extractor is 97% accurate") and then are surprised when the whole workflow lands far lower. The gap is not bad luck. It is multiplication. This one formula explains why long autonomous chains disappoint, why checkpoints and verifiers pay for themselves, and why fixing the weakest step beats polishing the strong ones.
The intuition
Think of a relay race where each runner drops the baton 5% of the time. One runner is fine. Six runners in a row is a different story, because the baton has to survive every handoff. Each step only ever keeps or loses what survived the step before it.
The loss is quiet at first and then steep: the run is still 90% healthy after two steps, but below 40% by step twenty. Because the losses multiply rather than add, a small per-step improvement buys a large end-to-end gain on long chains.
The math
If a run has \(n\) steps and step \(i\) succeeds with probability \(p_i\), independently of the others, the run succeeds only when every step does:
- \(n\)
- number of steps that must all go right (tool calls, extractions, decisions)
- \(p_i\)
- probability step \(i\) produces a correct result
- \(\varepsilon = 1-p\)
- per-step error rate
- \(d\)
- share of failures your checks catch (schema validation, tests, a verifier)
- \(r\)
- retries allowed after a caught failure
Three results follow and are worth memorizing:
- Exponential decay: success falls like \(e^{-n\varepsilon}\), so what matters is the product of steps and error rate. Doubling steps hurts as much as doubling errors.
- Half-life: the number of steps after which half your runs have failed. At 5% error that is about 14 steps.
- Required accuracy: to hit target success \(T\) over \(n\) steps, each step needs \(p^{*}=T^{1/n}\). For 90% over 20 steps, that is 99.5% per step.
Checks and retries change the per-step number. If a failure is caught with probability \(d\) and retried up to \(r\) times, the effective step accuracy is:
Where each of these comes from is worked through in Derivations at the end of the page.
Interactive calculator
Set your chain and your safety net. The curve shows end-to-end success at every chain length; the simulation runs 40 agents step by step.
Worked example: a claims agent
An insurer's claims agent handles a home-damage claim in 12 steps. Per-step accuracy was measured from 500 traced runs, not guessed.
| # | Step | Accuracy |
|---|
Every step looks healthy on its own; the average is 97%. Multiplied together, the agent completes a claim correctly 69.7% of the time, so roughly three claims in ten need a human to fix them.
Three fixes, compared
The lesson for the design review: one targeted fix plus a verification layer moves the agent from "needs a human on every third claim" to "needs a human on one claim in seventeen". The reverse also holds: adding one more step "for completeness", such as an extra enrichment call at 97%, quietly takes the as-built figure from 69.7% to 67.6%.
Assumptions and where it breaks
- Failures are not independent. Steps share a model, a prompt and a context window, so one bad document can derail several steps at once. Positive correlation means real success is often a little higher than \(p^n\) (failures cluster in the same runs), but retries help less, because a retry with the same model and context tends to fail the same way.
- Steps can repair earlier mistakes. An agent that re-reads its work or a later validation step can fix an upstream error, which the pure chain ignores. Treat \(p^n\) as a pessimistic baseline for self-correcting agents.
- The step count is not fixed. Agents loop and branch, so \(n\) is a random variable \(N\). Success is then \(\mathbb{E}[p^N]\), and long-tail runs drag it down; see the Markov chain model.
- Success is not binary. A run with a slightly wrong field may still be useful. When partial credit matters, model the cost of each failure type instead of a single success rate.
- Accuracy drifts. \(p\) measured last month is not \(p\) today after a model upgrade or a shift in inputs. Re-measure per step on fresh traces.
- Checks have their own errors. A verifier can reject good output (wasted retries) or approve bad output (that is \(1-d\)). Measure its catch rate rather than assuming one.
How to apply it
- Measure per-step accuracy from traces. Label 100–500 runs at the step level. A single end-to-end number hides which step is failing.
- Compute the chain before you build it. Count the steps in the design and multiply. If the projected success misses the target, change the design now, not after launch.
- Fix the weakest step first. Sort steps by accuracy; the bottom one or two usually account for most of the loss.
- Add checks where failures are detectable. Schema validation, unit tests, reference lookups and verifier models raise \(d\). Retries without detection buy nothing.
- Cut steps that do not earn their place. Merge deterministic steps into code, and checkpoint long chains so a failure restarts from the last good state.
How to explain it to a stakeholder
"Each step is a coin weighted 95 to 5 in our favor. Flip it twenty times and expect a miss in two runs out of three. So we either flip fewer coins, or we check each flip and re-flip the bad ones."
Related models and patterns
For coding agents
A machine-readable summary and a reference implementation. The same spec is embedded in this page as <script type="application/json" id="model-spec">, and the whole series is listed in models.json.
id: compounding-error
number: M01
name: Compounding error (series reliability)
family: reliability
answers: "What end-to-end success should a multi-step agent expect?"
formula:
run_success: "prod_i p_i (equal steps: p**n)"
approx: "exp(-n * (1 - p))"
half_life_steps: "ln(2) / -ln(p)"
required_step_accuracy: "T ** (1/n)"
effective_step_accuracy: "p * (1 - q**(r+1)) / (1 - q), q = (1 - p) * d"
inputs:
n: {type: int, meaning: steps that must all succeed}
p: {type: float, range: [0, 1], meaning: per-step accuracy}
d: {type: float, range: [0, 1], meaning: share of failures detected}
r: {type: int, meaning: retries after a detected failure}
T: {type: float, range: [0, 1], meaning: target run success}
assumptions:
- step outcomes independent
- fixed step count
- binary success per step
- undetected failures are fatal; no downstream repair
use_when:
- sizing a workflow before building it
- deciding between fewer steps, better steps, or verification
related_patterns: [prompt-chaining, guardrails, evaluator-optimizer, plan-and-execute, test-first-loop]import math
from functools import reduce
def run_success(step_accuracies):
"""End-to-end success for independent steps."""
return reduce(lambda acc, p: acc * p, step_accuracies, 1.0)
def effective_step_accuracy(p, d=0.0, r=0):
"""Step accuracy when a share d of failures is caught and retried up to r times."""
q = (1 - p) * d
return p * (1 - q ** (r + 1)) / (1 - q)
def expected_attempts(p, d=0.0, r=0):
q = (1 - p) * d
return (1 - q ** (r + 1)) / (1 - q)
def half_life_steps(p):
return math.log(2) / -math.log(p)
def required_step_accuracy(target, n):
return target ** (1 / n)
if __name__ == "__main__":
print(run_success([0.95] * 20)) # 0.358
print(effective_step_accuracy(0.97, d=0.8, r=1)) # 0.9933
print(required_step_accuracy(0.90, 20)) # 0.9947Derivations
For the math-curious: where each result in The math comes from. Nothing above depends on reading this.
Why the probabilities multiply
Let \(S_i\) be the event "step \(i\) is correct". The run is correct when all of them happen: \(S_1 \cap S_2 \cap \dots \cap S_n\). By the chain rule of probability,
$$\Pr\Big(\bigcap_i S_i\Big) = \Pr(S_1)\,\Pr(S_2\mid S_1)\cdots\Pr(S_n \mid S_1,\dots,S_{n-1}).$$If each step's success does not depend on how earlier steps went, every conditional term collapses to \(\Pr(S_i) = p_i\), giving \(\prod p_i\). The independence assumption is doing real work here; see where it breaks below.
The exponential approximation and the half-life
Take logs: \(\ln P = n \ln p = n\ln(1-\varepsilon)\). For small \(\varepsilon\), \(\ln(1-\varepsilon) \approx -\varepsilon\), so \(\ln P \approx -n\varepsilon\) and \(P \approx e^{-n\varepsilon}\).
Setting \(P = \tfrac12\) gives \(n_{1/2} = \ln 2 / (-\ln p)\). With the same small-\(\varepsilon\) approximation, \(n_{1/2} \approx 0.693/\varepsilon\). At \(\varepsilon = 0.05\): exact 13.5, approximate 13.9.
Per-step accuracy needed for a target
Solve \(p^n = T\) for \(p\): \(p^{*} = T^{1/n} = e^{\ln T / n}\). Expanding for large \(n\), \(p^{*} \approx 1 + \ln T / n\), so the allowed error per step is roughly \(-\ln T / n\). It shrinks in proportion to chain length: twice the steps, half the error budget per step.
Effective accuracy with checks and retries
Each attempt succeeds with probability \(p\). A failed attempt is caught with probability \(d\), and a caught failure gets another attempt if retries remain. An uncaught failure is silent: it passes downstream and the run fails.
The step succeeds on attempt \(k+1\) (for \(k = 0,\dots,r\)) if the first \(k\) attempts all failed and were caught, then attempt \(k+1\) succeeded. That has probability \(q^k p\) with \(q = (1-p)d\). Summing the geometric series:
$$p_{\text{eff}} = \sum_{k=0}^{r} q^{k} p = p\,\frac{1-q^{\,r+1}}{1-q}.$$The same sum without the final \(p\) gives the expected number of attempts per step, \(\mathbb{E}[\text{attempts}] = \frac{1-q^{\,r+1}}{1-q}\). So \(p_{\text{eff}} = p\cdot\mathbb{E}[\text{attempts}]\): every extra attempt you pay for converts into accuracy at rate \(p\). As \(r\to\infty\), \(p_{\text{eff}} \to p/(1-q)\), which is capped below 1 whenever \(d<1\). Retries cannot rescue failures you do not detect.
Why fixing the weakest step wins
Raising one step from \(p_i\) to \(p_i'\) multiplies the whole run by \(p_i'/p_i\). Lifting a 0.88 step to 0.96 multiplies success by 1.09. Lifting a 0.98 step to 0.99 multiplies it by 1.01. In log terms, \(\partial \ln P/\partial p_i = 1/p_i\): the lower a step's accuracy, the more each point of improvement is worth.
References
- Series systems in reliability engineering: the classic result that a chain of components is as reliable as the product of its parts. Reliability block diagram, Wikipedia.
- Yao, S. et al. (2024). τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. Shows how consistency across repeated trials falls well below single-trial success for tool-using agents.
- Yann LeCun's widely discussed argument (2023 talks) that errors compound in long autoregressive generation, the token-level version of the same \((1-\varepsilon)^n\) reasoning.