Routing for Cost/Quality Balance — Cost Engineering

← Back to Dashboard
1. Token Economics and Caching2. Routing for Cost/Quality Balance

Routing for Cost/Quality Balance

📚 Cost Engineering⏱ 10 min⭐ 95 XP⌨ Hands-on lab

Tiered Inference Strategies

Route easy requests to low-cost models and reserve premium models for complex or high-risk tasks. The price spread between tiers is often 10-50x per token - routing is the single biggest cost lever most teams never pull.

The Escalation Pattern in Practice

request → Nova Lite (cheap tier)
  ├─ output validates + confidence ≥ 0.8  → serve (≈85% of traffic)
  └─ validation fails / low confidence    → escalate to Nova Pro / Claude tier
        └─ still failing → human queue

# Result: premium prices paid only for the ~15% that needs premium capability

Batch: The Forgotten Half-Price Tier

For large, non-interactive workloads, use Batch inference: submit many prompts as JSONL to Amazon S3 and get responses back asynchronously at roughly 50% of on-demand pricing. Constraints to design around:

  • No tool calling or structured-output enforcement - each record is processed independently with no back-and-forth.
  • Asynchronous completion - hours, not seconds; wrong for anything a user is waiting on.
  • Perfect for: nightly classification/enrichment, eval-suite runs, embedding backfills, content moderation sweeps.

Measure the Metric That Matters

MetricWhat it hidesBetter version
Cost per tokenCheap models that need 3 attemptsCost per successful outcome - total spend ÷ tasks completed correctly
Cost per requestFailed/retried/escalated requests

A premium model at 3x the token price that succeeds first-time can beat a budget model that retries twice and escalates - only outcome-level accounting reveals this.

Tuning loop: review the routing matrix monthly against fresh eval scores - track "% served by cheap tier without escalation" as your routing health metric. Rising escalation means the cheap tier no longer fits the traffic; falling quality means it never did.
⌨ HANDS-ON LABImplement Intelligent Model Tier Classifier
⭐ +150 XP

Deploy an Amazon Bedrock intelligent routing router that directs simple queries to Haiku and complex reasoning to Sonnet.

1Test routing classifier against high-complexity code generation query.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
🧪 Knowledge Check
Press 1-4 to select1 of 3
Which metric best reflects business efficiency?
Cost per token only
Cost per successful outcome
CPU temp
Cache hit ratio only