Reliability
Success decays with every step; retries fix visible errors, a verifier catches silent ones. The closed forms beside seeded simulations and their confidence intervals.
Check yourself ↓ three questions and what to remember, at the end
Loading the animation…
Concept
Every step of a workflow can go wrong, and the failures multiply. If each step is right with probability , a chain of steps is right with probability : at 92% a step (5% visible errors, 3% silent ones), ten steps succeed 43.4% of the time and thirty steps 8.2%. The animation runs 48 seeded workflows of ten steps, one step at a time; the chart beside it puts the closed form (lines) against 2,000 simulated runs at each length (dots, with 95% intervals).
Two kinds of failure need two different fixes:
- A visible error (an exception, a malformed tool call, a timeout) can be retried. With three attempts a step fails only if all three do, and ten steps succeed 72.5% of the time (simulated: 72.9%). Retries cost little: 10.53 attempts per ten-step run on average.
- A silent error (a plausible wrong answer) passes straight through retries, because nothing signals it. Only a verifier catches it: a second check (a test suite, a schema, a second model) that rejects a wrong result with probability (here 80%) and, its own cost, a right one with probability (5%). A rejection is retried like an error. With both, ten steps succeed 91.8% of the time (simulated: 92.5%) and thirty 77.3%, against 38.0% with retries alone.
The design rule that falls out: make failures visible wherever you can (validate outputs, run the tests, check the schema), because a visible failure costs one retry and a silent one costs the whole run. Retries are only as good as the error signal behind them.
Maths
One attempt at a step is a visible error with probability , silently wrong with probability , correct with . With a verifier of recall and false-rejection rate (both zero without one) an attempt is retried with probability , accepted correct with , accepted wrong with . With attempts, attempt happens only if the first were all retried, so the step is correct with probability , silently wrong with , and gives up with ; it takes attempts on average. A run of steps succeeds if every step is correct, ; it stops early when a step gives up, so its expected attempts are .
At the defaults with three attempts and no verifier: , , , so a step is right with probability and ten steps with . The 95% intervals are Wilson score intervals; the engine's tests require every simulated rate to be within four standard errors of its closed form, for twelve configurations of 6,000 runs each.
Code
One attempt, cut from the vendored engine's simulation (reliability.ts):
const u = r.random();
if (u < e) {
log.push("error");
continue;
}
const right = u >= e + w;
if (verifier) {
const v = r.random();
if (right && v < verifier.false_reject) {
log.push("rejected_ok");
continue;
}
if (!right && v < verifier.recall) {
log.push("caught");
continue;
}
}
Check yourself
Commit to an answer before you reveal it: a wrong guess you can explain teaches more than a right one you skimmed. Every number in the answers comes from the same tested model as the chapter’s.
Reveal the answer
Answer: 43.4% (counted right within ± 5%)
: failures multiply. Thirty steps succeed only 8.2% of the time.
Commit to a number, then reveal.
Reveal the answer
Answer: 72.5% (counted right within 10%)
Retries fix the visible errors, for about 10.53 attempts per run, but not the silent ones, which pass straight through.
Commit to a number, then reveal.
Reveal the answer
Answer: A verifier
A verifier: a test suite, a schema, a second model that rejects a wrong result. With retries and a verifier, ten steps succeed 91.8% of the time.
Pick one, then reveal.