Loading patterns…
Resource-Aware Optimization
Cost, latency, energy, compute, and memory optimization patterns
In 30 seconds
- What
- Adapts model selection, computation depth, memory use, and execution strategy to meet latency, cost, energy, or capacity constraints while maintaining quality targets.
- When to use
- Workloads vary in complexity; latency, cost, memory, or energy has a defined budget; system can choose among models or computation strategies.
- Watch out
- Optimizing token count alone while ignoring total latency, tool cost, and whether reliability or safety is actually preserved.
Ask the AI expert about these patterns
Opens the assistant with your question prefilled. You review it before sending.
Overview
Resource-aware optimization patterns adapt model choice, computation depth, memory use, and execution strategy to operational constraints. They help systems meet quality targets while controlling latency, infrastructure cost, energy use, and capacity under changing load.
Practical Applications & Use Cases
Production inference
Select models and execution paths that meet latency and quality objectives.
Edge deployment
Fit useful capabilities within device memory, power, and connectivity constraints.
Capacity planning
Allocate compute dynamically while protecting service-level objectives and budgets.
Why This Matters
A system that is accurate but too slow, costly, or resource-intensive is not production-ready. Resource constraints need to be explicit inputs to system design.
Implementation Guide
When to Use
- Workloads vary significantly in complexity or business value
- Latency, cost, memory, or energy has a defined budget
- The system can choose among models, tools, or computation strategies
Best Practices
- Define measurable quality and resource budgets before optimizing
- Route simple requests to the least expensive path that meets requirements
- Measure end-to-end impact under representative load
Common Pitfalls
- Optimizing token count while ignoring total latency and tool cost
- Using static routing for highly variable workloads
- Trading away reliability or safety without explicit acceptance criteria
Available Techniques
Adaptive Compute Scaling(ACS)
Dynamically adjusts computational resources based on workload demands and performance requirements
Cost-Aware Model Selection(CAMS)
Intelligently selects AI models based on cost-performance trade-offs for specific tasks
Energy-Efficient Inference(EEI)
Optimizes AI inference for minimal energy consumption while maintaining performance
Memory Optimization(MO)
Efficiently manages memory usage through caching, compression, and garbage collection strategies
Latency Optimization(LO)
Minimizes response time through predictive loading, caching, and request optimization
Sleep-Time Compute(STC)
Use idle time between user interactions to do background reasoning instead of waiting for the next query. The agent reorganizes and compresses memory, precomputes likely-needed inferences, and pre-answers anticipated questions so work is shifted off the latency-critical path. At inference time the answer is largely ready, cutting test-time compute and latency.
Semantic Caching(SCA)
Cache LLM or agent responses keyed by embedding similarity rather than exact string match, so semantically equivalent queries reuse a stored answer. A similarity threshold decides a hit, a freshness TTL bounds staleness, and an invalidation policy evicts entries when source data changes. This cuts cost and latency on high-volume traffic and is distinct from prompt-prefix or KV caching.
Budget-Guarded Autonomy(BGA)
Hard, enforced per-task and per-session budgets on tokens, dollars, wall-clock time, and tool-call count that are checked before each call and pause or terminate execution, rather than after-the-fact cost alerts. Mechanisms include pre-flight budget checks that raise a budget-exceeded stop before the next call reaches the provider, a token-velocity circuit breaker that trips on runaway loops, loop detectors that halt no-progress cycles, and delegated budget ceilings where a parent agent grants a child a spend cap the child cannot exceed. Distinct from `cost-aware-model-selection`, which routes to cheaper models to lower unit cost but does not enforce a ceiling or halt spend.
Patterns Pack
Take the whole catalog with you: MCP server, editor rules and skills, and data.
The Agent Architect
One pattern, one tradeoff, one production failure story. A short weekly briefing for people building agentic systems.
Weekly email, one-click unsubscribe. We only use your address to send the briefing.
From the engineer behind this catalog
Get your agent architecture reviewed
This page documents one pattern. Your system runs dozens, and most failures live in how they fit together. Have the whole design reviewed against the 288 patterns in this catalog: architecture, reliability, evaluation and cost, every finding mapped to the pattern that fixes it.
€750 instead of €1,500, one week, written report and walkthrough call, until 30 September