EXPECTED ERROR LOSS
- Probability correct
- 99%
- Loss if wrong
- $20
- Human review
- $5
AI SDLCENGINEERING THE DECISIONThe example behind the comment 01 / The stakes
Same probability.
Different consequences.
A probability is not permission.
EXPECTED ERROR LOSS
EXPECTED ERROR LOSS
Illustrative cases, not measured Jev performance. Assumes validated probabilities, negligible review error,
and mandatory policy checks already passed. All amounts in USD.
02 / Change the stakes
Move the controls. Watch a cheap model decision become an expensive business mistake.
Educational model, not an authorization system. Assumes review resolves the uncertainty with negligible error. Equal costs route to review.
03 / Before the math earns your trust
Decision theory, applied to AI. A low API bill says nothing about the cost of a wrong action.
04 / Code controls
One small function. No agent framework. No payment execution. Just an explicit, testable routing recommendation.
PYTHON / NO DEPENDENCIESILLUSTRATIVE POLICYInputs: a validated probability and finite, nonnegative cost estimates. A policy veto or invalid probability routes to review. Equal expected costs also route to review.
def route(p_correct, loss_if_wrong, review_cost, *, policy_ok):
if not policy_ok or not 0 <= p_correct <= 1:
return "REVIEW"
expected_loss = (1 - p_correct) * loss_if_wrong
return (
"AUTO_CANDIDATE"
if expected_loss < review_cost
else "REVIEW"
)
print(route(0.99, 20, 5, policy_ok=True))
print(route(0.99, 20_000, 5, policy_ok=True))
# Equal costs? Review. Policy veto? Review.
assert route(0.75, 20, 5, policy_ok=True) == "REVIEW"
assert route(1.0, 20, 5, policy_ok=False) == "REVIEW"05 / The subtle Jev trap
confidenceTypeSafe describes confidence as a statistic derived from the shape of the answer's probability distribution. Do not use it interchangeably with the probability of the selected outcome.
A perfectly valid enum can still select the wrong action.
answer = response.answers["department"]
# Probability of the selected classification:
p_selected = answer.probabilities[answer.choice]
# Not an interchangeable substitute:
# p_selected = answer.confidence06 / Take the idea with you
The benchmark worth asking for: how much can we automate within a fixed error-loss budget?
Optimize cost per correct outcome, not cost per call.
Download the infographic ↓An illustrative comparison, not a Jev benchmark.
07 / ESL AI SDLC
Bring this question to your next AI workflow review: what does a wrong decision cost, and what evidence justifies automation?
Engineering Software Lab · Ha-Nagar 24 A, Hod Hasharon, Israel

Independent ESL educational commentary. No endorsement by TypeSafe implied. The calculator runs locally in your browser; it does not call an AI service or submit your inputs.