AWS: If Code Handles 95% of Requests, Only One in Twenty Reaches an LLM
Many teams send everything through an LLM, even format checks and routing decisions, and at production volumes that gets expensive. AWS advises asking whether a model is needed at each step. A message containing the word "refund" can be caught by a plain rule in milliseconds. In AWS's illustrative calculation, if rules handle 95% of requests, only 1 in 20 reaches the model, so savings should start with an audit of each step.
AI-processed from AWS Machine Learning Blog; edited by Hamidun News
Picture a support assistant where every incoming message first goes to a large language model: check the order number, work out that the customer is asking about a refund, reformat the request. Each call costs pennies, but at production volumes those pennies add up to one of the biggest line items in the budget. AWS Machine Learning's blog published a breakdown built on a simple idea: first ask whether a model is needed at this step at all.
If the message contains the word "refund", a plain rule will catch it in a few milliseconds. Suppose such rules handle 95% of requests. Then only 1 request in 20 reaches the model, and that is before you even start choosing a cheaper model.
AWS itself stresses that the 95% figure is illustrative arithmetic, not a measurement from a real system.
Why unnecessary model calls are expensive
AWS names three costs of an unneeded LLM call. The first is money: spending grows with the number of requests, even when the step adds no meaningful value. The second is latency: each call in a chain adds hundreds of milliseconds, and those add up. The third is unpredictability: the same input string can produce different answers. Temperature 0 reduces variability but does not guarantee an identical result. As a result, tests are harder to write and audits take longer.
In this comparison, ordinary code wins. It costs orders of magnitude less and responds in milliseconds. The rule lives in version control and can be shown to an auditor. Its behavior does not change unless you change it, whereas a model drifts when moved to a new version or when an old one is retired. That is why regulated industries tend to prefer rules.
Three questions for every step
The authors suggest running each workflow step through three questions in order and stopping at the first one that applies.
- Can success be verified with a rule: format, schema, keyword, range? If a rule covers only some cases, it goes first (the "fast path"), and the remainder is passed on.
- Can a model write the rule once, for example a regular expression or a JSON schema? Then you verify the result, commit it to code, and from then on it runs at the speed and cost of code.
- Is the output one answer chosen from a predefined list: a support queue, a class, yes/no? For this you need a narrow call with constrained output and a signal for when to escalate.
If the answer to all three is no, the task is open-ended, and a model of suitable size is brought in. This is the smallest model in Amazon Bedrock that clears your quality threshold.
In the support assistant example, this looks as follows. Order-number format is checked by validation in API Gateway or Lambda. Words like "refund" are caught by a Choice state in Step Functions using JSONata. The tracking number from the carrier's email is extracted by a regular expression that a model drafted first. One of four queues for the ticket is selected by a narrow call, and when the model is unsure, the ticket goes to a larger model. The reply to the customer is written by a model of suitable size.
How to handle selection from a list without breaking quality
For these steps, AWS describes four options. A small model in Bedrock with structured outputs, where the answer is limited to an enumerated set of options plus "unsure". Nearest-neighbor lookup of a labeled example using embeddings. The experimental Strands Decider model under Apache 2.0, which you must host yourself, for example on SageMaker. According to its README, answers with 90% confidence or higher are correct in about 95% of cases on short classification tasks, but the result has to be verified on your own data. And a classifier trained on SageMaker. In every case, the escalation threshold has to be tuned on your own labeled sample. Authorization decisions, such as a refund limit, stay in rules.
The approach has its own risks. A generated regular expression needs testing on malicious inputs: nested quantifiers such as (a+)+ open the door to ReDoS, where matching hangs on a specially crafted string. If rules live in configuration, allow only known primitives and never execute arbitrary code from config.
Where to start
AWS recommends four steps. Classify each call as code, a narrow decision, or a model, and calculate the cost per successful result. Move rules into Lambda or Step Functions, which is usually the largest and safest saving. For selection from a list, add calls with escalation. And keep a benchmark set of examples for each task in CI: a cheaper model that falls below the quality threshold counts as a regression. It is also worth putting the model behind a configuration flag so the replacement can be rolled back. In addition, it helps to run some of the requests that rules already resolve through the model in shadow mode: disagreements will show which steps need reclassifying.
The practical takeaway is simple: first ask whether a model is needed, and only then choose which one. Start with your single heaviest workflow and see what share of its calls never needed an LLM.
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
- Dec 2, 2026Tacit, a Startup With $93.5 Million in Funding, Built Earbuds for Silent Text Input
- Dec 2, 2026Amazon to Speed Up Ergo From 400 to 2,200 Tokens per Second and Buy 2 Million More Nvidia GPUs
- Dec 2, 2026Amazon Releases Ergo: US Open Model Closes the Gap With GPT-6.1 Terra at 38 Points
Key Questions Answered
Why unnecessary model calls are expensive?
AWS names three costs of an unneeded LLM call. The first is money: spending grows with the number of requests, even when the step adds no meaningful value. The second is latency: each call in a chain adds hundreds of milliseconds, and those add up. The third is unpredictability: the same input string can produce different answers. Temperature 0 reduces variability but does not guarantee an identical result. As a result, tests are harder to write and audits take longer. In this comparison, ordinary code wins.
What are the key details on Three questions for every step?
The authors suggest running each workflow step through three questions in order and stopping at the first one that applies. Can success be verified with a rule: format, schema, keyword, range? If a rule covers only some cases, it goes first (the "fast path"), and the remainder is passed on. Can a model write the rule once, for example a regular expression or a JSON schema? Then you verify the result, commit it to code, and from then on it runs at the speed and cost of code.
How to handle selection from a list without breaking quality?
For these steps, AWS describes four options. A small model in Bedrock with structured outputs, where the answer is limited to an enumerated set of options plus "unsure". Nearest-neighbor lookup of a labeled example using embeddings. The experimental Strands Decider model under Apache 2.0, which you must host yourself, for example on SageMaker.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
