Lesson 3 of 4 Model Routing and Cascading

Routing with Intelligent Prompt Routing and Live Metrics

This lesson covers Amazon Bedrock Intelligent Prompt Routing, which predicts response quality to choose a model, and metric-based routing from live measurements of latency, errors and cost.

Learning outcomes

After completing this lesson, you will be able to:

  • Configure a prompt router and its quality threshold.
  • Route by live operational metrics.

Amazon Bedrock Intelligent Prompt Routing

Intelligent Prompt Routing uses a prompt router that, for each request, predicts the response quality of each model in its configuration and sends the request to the model expected to give the best combination of quality and cost. Default prompt routers are provided for model families such as Anthropic Claude, Meta Llama and Amazon Nova; configured routers let you choose two models in a family, a fallback model and a response quality difference threshold: the router chooses the cheaper model unless the larger model is predicted to be better by more than that threshold.

Applications invoke the router's ARN as the modelId in Converse or InvokeModel, and the response trace shows which model handled the request. It suits chat and question-answering traffic with a mix of simple and complex requests, with no classifier to build or maintain.

r = brt.converse(
    modelId="arn:aws:bedrock:us-east-1:111122223333:default-prompt-router/amazon.nova:1",
    messages=[{"role": "user", "content": [{"text": question}]}],
)
print(r["trace"]["promptRouter"]["invokedModelId"])   # which model actually answered

The following diagram shows a configured prompt router choosing between a smaller and a larger model for each prompt.

Reducing cost with a configured Intelligent Prompt Router. The application only changes its modelId to the router ARN. For each prompt, the router predicts the response quality of a smaller and a larger Nova model and chooses the cheaper one unless the larger is predicted to be better by more than the response quality difference. The trace shows which model answered.
The share of simple questions comes from the scenario above.
Select all that apply

Intelligent Prompt Routing

Exam skills 2.4.4 · 4.1.2

Choose the true statements about Amazon Bedrock Intelligent Prompt Routing.

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

Metric-based routing

Metric-based routing chooses models from live operational data: the routing layer reads recent latency percentiles, error and throttle rates and cost per request from CloudWatch or its own counters, and shifts traffic away from a model whose latency or errors exceed thresholds, or toward the cheapest model that currently meets the service level. Quality metrics from continuous evaluation can also feed routing, for example demoting a model whose judge scores dropped after a provider update.

Weighted routing splits traffic by percentage, which supports A/B tests and gradual migrations. The weights live in AppConfig and change automatically through alarms and Lambda functions, or manually. The following table compares the routing approaches.

ApproachDecides byMaintenance
Static configurationRequest typeLow
Content-based (classifier)Request contentClassifier upkeep
Intelligent Prompt RoutingPredicted quality versus cost within a familyManaged by Bedrock
Metric-basedLive latency, errors, cost, qualityMetrics pipeline and thresholds
Weighted splitPercentagesConfiguration changes
Worked example

Reducing cost with the least effort

A chat assistant uses a large Nova model for every question. Analysis shows that about 60% of questions are simple. The team wants to reduce cost without building or maintaining a classifier.

A configured Intelligent Prompt Router with a smaller and a larger Nova model and an appropriate response quality difference sends simple prompts to the smaller model automatically. The application only changes the modelId to the router ARN, and the trace shows the routing decisions for monitoring.

Check yourself

How does an application use Intelligent Prompt Routing?

Show answer

It invokes a prompt router ARN as the model ID, and the router picks a model in the family for each request.

Exam Tips

Remember for the exam

  • Intelligent Prompt Routing: invoke a prompt router ARN; it picks a model in the family per request.
  • Response quality difference controls when the larger model is chosen.
  • Metric-based routing shifts traffic on latency, errors, cost or quality.
  • Weighted routing in AppConfig supports A/B tests and gradual migration.