Advanced Prompt Optimization supports prompt shortening and application inference profiles: You can enable prompt shortening per prompt template to reduce prompt length while maintaining or improving evaluation scores. Application inference profiles are ac

Published
October 20, 2026
https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompt-optimization-shorten.html

Shorten prompts

Advanced Prompt Optimization now includes a feature to shorten prompts, which can help reduce input token costs and latency. When enabled, the optimizer looks for a prompt that is shorter than the original and scores at least as high on your evaluation.

How prompt shortening works

When you enable the shortenPrompt field, the optimizer targets a shorter prompt in each iteration. Shortening is gradual and does not change how evaluation works. The shortened prompt may not preserve the structure and level of detail of your original prompt.

Enable prompt shortening

Prompt shortening is off by default. You enable it per prompt template by adding the optimizationConfig object to the template's line in your input JSONL file. The following example shows a single line of an input JSONL file with prompt shortening enabled:

{ "version": "bedrock-2026-05-14", "templateId": "customer-support-v1", "promptTemplate": "You are a customer support agent.\n\nProduct info:\n{{productInfo}}\n\nQuestion:\n{{customerQuestion}}\n\nProvide a helpful response.", "optimizationConfig": { "shortenPrompt": true }, "steeringCriteria": ["PROFESSIONAL"], "evaluationSamples": [ { "inputVariables": [ { "productInfo": "Product: Sony WH-1000XM5. Battery: 30 hours." }, { "customerQuestion": "How long does the battery last?" } ], "referenceResponse": "The battery lasts up to 30 hours on a single charge." } ] }

Return logic

When prompt shortening is enabled, the optimized prompt is returned only if it meets both conditions: it is shorter than the original prompt and scores at least as high as the original prompt on your evaluation. If the optimized prompt fails either condition, the original prompt is returned instead.

Limitations

  • No exact token budget: You cannot target a specific length, such as "optimize to exactly 500 tokens."
  • No per-section compression control: When your template has multiple <advpo:optimize> sections, all of them are eligible for shortening.
  • Short prompts may not compress: A prompt that is already concise may produce a compression ratio of 1.0 because the optimized prompt is not both shorter and at least as high scoring.

Best practices

  • Expect iteration: There can be a trade-off between prompt brevity and evaluation score improvement.
  • Validate on held-out data: Test the shortened prompt on data the optimizer has not seen to confirm quality gains hold.
  • Protect content that must not change: If sections of your prompt must remain verbatim, leave them outside your <advpo:optimize> tags, or use <advpo:exclude> tags if you are not using <advpo:optimize> at all.

Source: AWS release notes




If you need further guidance on AWS, our experts are available at AWS@westloop.io. You may also reach us by submitting the Contact Us form.

Follow our blog

Get the latest insights and advice on AWS services from our experts.

By clicking Sign Up you're confirming that you agree with our Terms and Conditions.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.