Lesson 3 of 3 Selecting Foundation Models

Balancing Foundation Model Quality, Latency and Cost

This lesson explains the Bedrock features that shift the balance between answer quality, response time and token cost, and how to match them to requirements.

Learning outcomes

After completing this lesson, you will be able to:

  • Use smaller models and routing for simple tasks.
  • Apply prompt caching and response optimisations.
  • Choose service tiers and capacity options.

Model size and routing

Larger models usually reason better but respond more slowly and cost more per token. Using a smaller model for simple tasks is the most effective saving. Intelligent prompt routing sends each request to one of the models in a family, choosing the smaller model when it predicts similar quality, which lowers average cost and latency. Distillation creates a small model that imitates a large one for a specific use case.

Scenario questions

Right-size the model

Exam skills 2.1.7

Choose a model size or routing strategy that balances quality, latency and cost.

Log in to try this activity Interactive activities are free with an account.

Prompt and response optimisations

Several techniques reduce the cost and latency of foundation model requests without changing the model. Prompt caching stores a repeated prompt prefix, such as a long system prompt, a reference document or tool definitions, so later requests read it from the cache at a reduced price and with lower latency. Shorter prompts, fewer retrieved chunks in RAG and limits on output length reduce both cost and latency, because every token is processed and charged.

Streaming, with the ConverseStream API, returns tokens as they are generated. It does not shorten the total generation time, but users see the first words within a second, which greatly improves the perceived latency of chat interfaces.

The following diagram shows the prompt, the routing and the perceived latency of an assistant that answers questions about a 40,000-token policy manual, after changes to cut its cost and latency.

The policy-manual assistant after the changes. The 40,000-token manual is a cached prompt prefix, billed at a reduced rate and processed faster; intelligent prompt routing sends simple questions to the smaller model in the family; maximum tokens caps answers at 400; and streaming shows the first words after about one second instead of a blank screen for nine.
Timings are approximate; streaming does not shorten total generation time.

Service tiers and capacity options

Bedrock offers service tiers selected per request. Standard is the default. Priority gives faster responses for latency-critical work at a premium price. Flex gives a discount for work that can tolerate lower priority, such as evaluations and background summarisation. Reserved capacity guarantees tokens-per-minute for 1 or 3 months, overflowing to Standard. Latency-optimized inference is available for selected models, batch inference processes large JSONL files at a lower price, and Provisioned Throughput buys dedicated model units, which is also how some custom models are served.

The following table summarises the options.

GoalFeature
Lower cost for mixed simple and complex requestsIntelligent prompt routing, smaller model
Lower cost and latency for repeated long contextPrompt caching
Faster perceived response in chatStreaming
Fastest responses for critical trafficPriority tier, latency-optimized inference
Cheaper non-urgent requestsFlex tier, batch inference
Guaranteed throughputReserved tier or Provisioned Throughput
Sort into groups

Choose the tier

Exam skills 2.1.7 · 4.2.7

Choose the Bedrock service tier or option for each workload.

Log in to try this activity Interactive activities are free with an account.
Worked example

A document Q&A assistant

An assistant answers questions about a 60-page policy manual that is included in every prompt (40,000 tokens). Responses take 9 seconds and cost is high. Most questions are simple.

Change                                   Effect
Prompt caching on the manual prefix      Cached input tokens billed at a reduced rate; faster time to first token
Intelligent prompt routing (same family) Simple questions served by the smaller model
ConverseStream in the UI                 First words appear in about 1 second
Max tokens 400                           Caps long answers

Together these changes cut cost and perceived latency sharply without lowering quality on complex questions. Switching everything to the smallest model would have been cheaper still, but it failed the complex questions in evaluation.

Check yourself

Which feature sends simple requests to a cheaper model and hard ones to a stronger one?

Show answer

Intelligent prompt routing.

Exam Tips

Remember for the exam

  • Same long prefix in many requests: prompt caching.
  • Mixed request difficulty: intelligent prompt routing.
  • Chat responsiveness: streaming.
  • Latency-critical requests: Priority tier; non-urgent: Flex tier or batch inference.
  • Guaranteed capacity: Reserved tier or Provisioned Throughput.