Applied AI Engineering

Cost, Latency & Reliability

AI features have systems constraints. Model choice, token count, retrieval size, retries, caching, streaming, batching, and fallbacks determine whether the feature is usable and affordable.
  • Tokens are both cost and latency
  • Model choice should match task difficulty
  • Caching helps stable work
  • Retries are not free reliability
  • Fallback behavior is part of UX
Optimization levers
LeverReducesTrade-off
Shorter contextCost/latencyMay lose useful evidence
Smaller modelCost/latencyMay reduce quality
CachingRepeated costFreshness complexity
StreamingPerceived latencyClient complexity
Reranking fewer docsLatencyMay miss evidence
Bounded retriesTail failuresMay return fallback more often
Sources
  • OpenAI API DocumentationLatency optimization; cost optimization; production best practices
  • Made With MLServing and monitoring
  • Rules of Machine LearningML system design