Insights

Architecture Decisions: Balancing Cost, Latency and Control

Cost, latency and control pull against each other in every AI system. A useful decision record names the one a use case favors, what it gives up, and the measurement that would reopen the choice.

Published
Reading time
3 min read
  • Architecture Decisions
  • Cost
  • Latency
  • Model Serving

Every AI system makes the same three-way trade. Cost is what each request and each month of operation consumes. Latency is how long a user or a downstream process waits, including for the slowest requests. Control is how much of the behavior, the data handling and the change schedule the organization decides for itself. Improving one usually costs another, so the useful output of an architecture review is not a perfect design. It is a recorded choice.

Write the trade-off down

Michael Nygard's architecture decision record keeps a decision small: its context, the decision, its status and its consequences. He notes that a decision "may have positive, negative, and neutral consequences", and a record for an AI component needs all three. "We use a smaller model for classification" is incomplete without the quality it was measured at, the cost it saves and the condition that would reverse it. Microsoft's Well-Architected guidance gives the matching warning: choices that focus only on minimizing spending can undermine a workload's business goals.

Common levers and what they cost

  • Route by difficulty. FrugalGPT studied cascades that send a query to cheaper models first and escalate only when the answer is not reliable enough. On its benchmarks, the authors report matching the best individual model with up to 98% lower cost. The price is an extra decision point, a scorer that must itself be evaluated, and slower answers for the requests that escalate.
  • Move work off the request path. OpenAI's Batch API offers a 50% discount compared with its synchronous APIs, and each batch completes within 24 hours. That suits evaluations, re-indexing and bulk classification, not a person waiting for an answer.
  • Reuse stable prompt prefixes. Prompt caching lowers the price of repeated input and the time spent processing it, but cache reuse requires the entire rendered prefix to match. Prompt layout becomes an architectural constraint: stable instructions and shared reference material first, variable content last.
  • Watch the tail, not the average. Dean and Barroso showed in The Tail at Scale that rare slow responses "may come to dominate overall service performance at large scale." A design that chains several model and tool calls compounds the effect, so latency targets should be stated as percentiles for the whole path.

Control is a cost you choose

A managed API moves operational work to the provider, and with it part of the change schedule. OpenAI's deprecations page states that it regularly retires older models and that every deprecated model receives a shutdown date. Teams that need pinned behavior, data residency or offline operation can host open-weight models instead, and then own capacity, patching, monitoring and evaluation themselves. Neither option is free. The decision record should say which costs the organization has chosen to carry.

THE THREE-WAY TRADE Improving oneusually costsanother Cost Each request and eachmonth of operation Latency Including theslowest requests Control Behavior, datahandling, changeschedule Set targets as percentilesfor the whole path,not the average. Slow tail requests compoundacross chained calls. LEVERS AND WHAT THEY COST Route by difficulty HELPS Cost COSTS An extra decision point, a scorer that must itselfbe evaluated, slower answers for requests that escalate Batch off the request path HELPS Cost: a lower price COSTS Waiting: results within 24 hours, so not fora person waiting for an answer SUITS Evaluations, re-indexing, bulk classification Cache stable prompt prefixes HELPS Cost and latency COSTS A layout constraint: stable instructions and sharedmaterial first, variable content last Managed API HELPS Operations: the provider runs them COSTS Control: the provider retires models on its own schedule Self-hosted open-weight models HELPS Control: pinned behavior, data residency,offline operation COSTS Owning capacity, patching, monitoring and evaluation
Every lever improves one side of the trade and charges another.

A decision is only as good as its trigger

Each choice should name the measurement that reopens it: an evaluation score below the agreed threshold, monthly cost above budget, a latency percentile missed for a week, or a provider's shutdown notice. That turns the record into an operating rule rather than a memory of a meeting. The Architecture Lab study Serving Multiple Models Safely shows one way to place routing and fallbacks in a serving layer.

DECISION RECORD CONTEXT Which of cost, latency or controlthe use case favors DECISION Use a smaller model for classification EVIDENCE The quality it was measured at STATUS In force until a trigger reopens it CONSEQUENCES Positive the cost it saves Negative what it gives up Neutral what else it changes REOPEN WHEN The condition that would reverse it REVIEW Reopen the decision new context,new record TRIGGERS Evaluation score belowthe agreed threshold Monthly cost above budget A latency percentilemissed for a week A provider's shutdown notice any one fires names themeasurement
Naming the measurement that reopens a decision turns the record into an operating rule.

Sources

  1. Documenting Architecture Decisions

    Michael Nygard, 15 November 2011cognitect.comChecked

  2. Cost Optimization tradeoffs

    Microsoft Azure Well-Architected Frameworklearn.microsoft.comChecked

  3. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance

    Chen, Zaharia and Zou, 2023arxiv.orgChecked

  4. Batch API

    OpenAIdevelopers.openai.comChecked

  5. Prompt caching

    OpenAIdevelopers.openai.comChecked

  6. The Tail at Scale

    Dean and Barroso, Communications of the ACM, 2013research.googleChecked

  7. Deprecations

    OpenAIdevelopers.openai.comChecked

Related