How to Optimize Prompts in Amazon Bedrock: A Step-by-Step Guide

By

Introduction

Amazon Bedrock's new Advanced Prompt Optimization tool lets you automatically refine your prompts for any supported model—and even compare performance across up to five models at once. Whether you're migrating to a newer model or simply want to squeeze more accuracy from your current one, this tool uses a metric-driven feedback loop to iteratively improve your prompts. You can test optimized prompts against known use cases to ensure no regressions and to boost underperforming tasks. This guide walks you through the entire process, from preparation to analysis.

How to Optimize Prompts in Amazon Bedrock: A Step-by-Step Guide
Source: aws.amazon.com

What You Need

Step-by-Step Instructions

Step 1: Access the Advanced Prompt Optimization Page

Log in to the AWS Management Console and navigate to Amazon Bedrock. In the left navigation pane, under Prompt management, choose Advanced Prompt Optimization. Click the Create prompt optimization button to start a new job.

Step 2: Select Up to Five Inference Models

You can choose up to 5 models for prompt optimization. This feature is ideal for two scenarios:

For each model, the tool will generate both an original and an optimized prompt version, allowing you to compare scores, cost, and latency.

Step 3: Prepare Your Prompt Templates in JSONL Format

The tool expects a JSONL file where each line is a single JSON object representing one template. Each object must include the following fields:

Important: Each JSON object must be on a single line. Save the file with a .jsonl extension.

How to Optimize Prompts in Amazon Bedrock: A Step-by-Step Guide
Source: aws.amazon.com

Step 4: Configure the Evaluation Metric

Choose how the optimization will measure success:

If you use a custom metric, you must also provide a custom evaluation metric label (e.g., "accuracy_score").

Step 5: Upload Your JSONL File and Start the Optimization

On the creation page, upload your prepared JSONL file. The system will parse the templates and samples. Review the configuration and click Start optimization. The process runs in a metric-driven feedback loop: the optimizer iteratively refines the prompt, generates model responses, evaluates them using your chosen metric, and adjusts the prompt until it converges on the best version.

Step 6: Review the Results

After completion, you’ll see a report comparing original and optimized prompts for each selected model. The report includes:

You can drill down into individual samples to see how the optimized prompt performed. Use this information to decide whether to adopt the new prompt, deploy it to a new model, or iterate further.

Tips and Best Practices

Tags:

Related Articles

Recommended

Discover More

8 Critical Facts About the OceanLotus PyPI Attack and ZiChatBot MalwareSony's AI Camera Assistant: A Step Backward for Smartphone Photography?Swift 6.3: Cross-Platform Build Revolution & Community Updates – March 2026Breakthrough: Scientists Reverse Alzheimer’s Memory Loss by Targeting Single ProteinJapan's Motorcycle Titans Electrify: Honda, Yamaha, Kawasaki, Suzuki Shift Gears