Lesson 6 of 6 Evaluating Generative AI

Running Reproducible Prompt Experiments

This lesson explains how versioning every element of a generative AI experiment, with Bedrock Prompt Management and Bedrock evaluations, makes good results reproducible and comparisons fair.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify what defines a generative AI experiment.
  • Version prompts with Prompt Management.
  • Run comparable evaluations with the same configuration.

What defines a generative AI experiment

The result of a generative AI experiment depends on more than the prompt text. It depends on the prompt template and its variables, the model ID and version, the inference parameters such as temperature, top P and maximum tokens, the system prompt, any retrieval configuration such as the knowledge base, number of results, filters and reranker, the guardrail version and the evaluation dataset.

Changing any of these can change the outcome, so all of them must be recorded with each result. Sampling randomness also means that repeated runs vary unless the temperature is low, so comparisons should use several runs or deterministic settings.

Select all that apply

Record the experiment

Exam skills 2.3.1 · 3.3.7

Identify what must be recorded for a prompt experiment to be reproducible.

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

Versioning with Prompt Management

Amazon Bedrock Prompt Management stores a prompt with its template, variables, model and inference configuration. Editing happens in a draft; creating a version takes an immutable snapshot with its own ARN. Experiments and applications reference a specific version, and prompt variants can be compared side by side. MLflow tracing and experiments can also record prompt versions, parameters and scores alongside traditional ML runs.

Running comparable evaluations

Run every candidate through the same Bedrock evaluation job configuration: the same dataset version in S3, the same judge model and metrics. Record which prompt version and model each job evaluated, keep evaluation jobs' results for comparison and rerun the baseline when the dataset changes. The following table lists the elements to fix and how.

ElementHow to version or fix it
Prompt template and parametersPrompt Management version ARN
ModelExplicit model ID or inference profile, not an alias that changes
Evaluation datasetVersioned S3 object
Judge and metricsSame evaluation job configuration
Retrieval settings and guardrailRecorded configuration and guardrail version
ResultsEvaluation job outputs, MLflow runs

The following diagram compares two engineers' playground impressions of a prompt change with a controlled evaluation of the same change.

Settling the disputed prompt change. The playground impressions were not comparable: one engineer used temperature 0.9 on ten questions, the other a different model version. Saved as versions 7 and 8 in Prompt Management with the same model ID and temperature 0.2, and run through identical evaluation jobs on 400 questions, version 8 scores 0.86 against 0.81, and the application switches by changing one ARN.
The scenario is illustrative.
Scenario questions

Is it really better?

Exam skills 2.3.1

Decide whether a prompt change has really improved results.

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

A disputed improvement

Two engineers disagree about whether a new prompt improved answer quality. One tested in the playground with temperature 0.9 on ten questions; the other used a different model version.

  • Save both prompts as versions 7 and 8 in Prompt Management with temperature 0.2 and the same model ID.
  • Run two evaluation jobs on the same 400-question dataset version with the same judge metrics.
  • Version 8 scores 0.86 correctness against 0.81 for version 7, with lower variance across reruns.

The application is switched to version 8 by changing one ARN, and version 7 remains available for rollback. Playground impressions were not comparable because the model and sampling differed.

Check yourself

Can a Bedrock Prompt Management version be edited?

Show answer

No. Versions are immutable and have their own ARN.

Exam Tips

Remember for the exam

  • Version prompts, with model and parameters, in Bedrock Prompt Management.
  • Prompt versions are immutable and have their own ARN.
  • Compare candidates with the same evaluation dataset, judge and metrics.
  • Pin explicit model IDs for experiments.
  • Use low temperature to reduce run-to-run variance in comparisons.