Originally published on tamiz.pro.
Most production AI failures are not model failures. They are decision failures—the moment a probabilistic system is asked to make a choice that a rule, a lookup table, or a state machine could make perfectly well. The model burns tokens, adds latency, invents plausible justifications, and returns a different answer tomorrow. This article dissects that pattern and shows how to engineer deterministic AI workflows that are dramatically cheaper, faster, and more honest about uncertainty.
Table of Contents
- 1. The Decision Bottleneck
- 2. Why LLMs Are Bad Decision Makers
- 3. The Deterministic AI Stack
- 4. Architecture: Where the Model Stops
- 5. The Uncertainty Ladder
- 6. Building a Deterministic Router
- 7. Calibrated Confidence and Escalation
- 8. The Cost and Latency Model
- 9. Where the Numbers Come From
- 10. Production Patterns
- 11. Observability and Evaluation
- 12. Anti-Patterns and Failure Modes
- 13. The Migration Playbook
- Frequently Asked Questions
1. The Decision Bottleneck
Consider a support triage pipeline. An incoming ticket arrives. The system must decide one of five things: billing, technical, account, sales, or spam. Then it must decide whether to auto-reply, route to a human, or close it.
The naive implementation asks the model to do both:
from openai import OpenAI
client = OpenAI()
def triage(ticket: str) -> dict:
response = client.chat.completions.create(
model="gpt-4o-mini",
temperature=0,
response_format={"type": "json_schema", "json_schema": {
"name": "triage",
"strict": True,
"schema": {
"type": "object",
"properties": {
"category": {"type": "string", "enum": [
"billing", "technical", "account", "sales", "spam"
]},
"action": {"type": "string", "enum": [
"auto_reply", "route_human", "close"
]},
"confidence": {"type": "number"}
},
"required": ["category", "action", "confidence"],
"additionalProperties": False
}
}},
messages=[
{"role": "system", "content": "Classify this ticket and choose an action."},
{"role": "user", "content": ticket}
]
)
return response.choices[0].message.content
Notice the contradictions in this snippet. temperature=0 implies determinism but does not guarantee it—sampling is still stochastic under the hood, and model updates change behavior silently. The schema constrains the shape of the output, not its correctness. The confidence field is the model grading its own homework, and research consistently shows LLM self-reported confidence is poorly calibrated.
Worse, every ticket pays the full tax: input tokens, output tokens, network round-trip, and a provider dependency—regardless of whether the ticket was an exact match for a known template.
The alternative is to recognize that a large fraction of these tickets are not novel decisions at all. They are recognizable patterns. A deterministic layer that handles the decidable cases and escalates only the genuinely ambiguous ones changes the economics of the system entirely.
The core thesis: an LLM should generate, transform, and interpret—not arbitrate. When a workflow needs a decision, it should reach for the most deterministic mechanism that can resolve it, and reserve the model for the residue.
2. Why LLMs Are Bad Decision Makers
This is not an argument against language models. It is an argument about matching the right tool to the decision class.
2.1 The three properties a decision actually needs
A production decision requires three things:
| Property | Requirement | What an LLM provides |
|---|---|---|
| Consistency | The same input yields the same output | Approximate; varies with sampling, batching, and model version |
| Auditability | A reviewer can explain why the decision was made | Post-hoc rationalization, not causal explanation |
| Calibration | Confidence tracks actual correctness | Weak; self-reported confidence is poorly calibrated |
A rule engine provides all three. A classifier provides the first two and, with proper Platt scaling or isotonic regression on a held-out set, the third. An LLM provides high coverage on fuzzy natural-language inputs and strong semantic generalization—but weak consistency, weak auditability, and weak calibration.
2.2 The 100x cost cliff
The economics of LLM decisions are brutal because the cost scales with the volume of decisions, not the difficulty of the decisions. A one-token classification of "is this a refund request or not?" costs the same as a 500-token summary. The model has no way to signal "this was trivial, charge me less.
Top comments (0)