Promptimus: Improving already good LLM prompts with zero manual engineering Promptimus, a new method for automatically optimizing well-developed large language model prompts, eliminates the need for manual engineering by using AI agents to identify failure points and surgically refine prompts. The model-agnostic system iteratively improves prompts based on user-defined performance metrics and task-specific data, preserving complex business logic while targeting nuanced refinements. Promptimus addresses the challenge of migrating prompts across rapidly evolving models from providers like Anthropic and OpenAI, reducing costly manual reoptimization for enterprise applications in healthcare, finance, and other regulated industries. Large language models LLMs have become integral to enterprise applications across industries. Under the hood, customers’ inputs to the models are usually augmented with prompts that encode intricate business logic, regulatory requirements, and domain expertise: a healthcare system must use language compliant with the Health Insurance Portability and Accountability Act, for instance, and a financial trading system must follow risk tolerance rules. These prompts are typically crafted by domain experts over weeks or months. Yet business demands continue to push for further performance gains. The challenge, therefore, is not engineering prompts from scratch but rather elevating already strong performance by discovering nuanced, task-specific refinements — without compromising domain requirements. In this post, we present Promptimus, a method for automatically optimizing well-developed prompts that has several advantages over its predecessors: It's model agnostic : It takes a prompt already optimized for a source model, rapidly reoptimizes it for a target model, and compares the optimized prompts across models. It's driven by performance criteria : It takes the existing prompt template, task-specific data samples, and user-defined performance metrics and generates targeted improvement strategies, iterating repeatedly to achieve domain-specific optimization objectives. It focuses on exploits : It uses a metric-analyzer AI agent to identify failure points and a debugging helper agent to identify root causes, and it surgically refines prompts relative to failures rather than along random dimensions for targeted performance improvement. It’s fully automated : It analyzes user-defined metrics and uses a code sanitization AI agent to generate debugging checkpoints automatically. Metric functions can be imported as Python code, and performance criteria can be added or modified at any time. It has an edit mode : For large, carefully structured prompts with complex business logic, the edit mode makes surgical, targeted modifications instead of rewriting the entire prompt — preserving the parts that already work while fixing exactly what’s broken. Promptimus supports a wide range of textual and multimodal LLM tasks, including classification, extraction, generation, summarization, code generation, and tool use. In the following sections, we’ll present our methodology, the system architecture, and experimental results on multiple enterprise tasks. Why good prompts are hard to improve Attempts to automate prompt optimization are as old as prompt engineering itself, but approaches that work well when generating prompts from scratch struggle to improve well-engineered prompts. Random exploration strategies using generic directions like "be more creative" or "add examples" are ineffective, because the remaining improvements lie in very specific strategic directions. Sparse feedback in the form of scalar scores provides no guidance on why instances fail or how to improve. On top of growing complexity from business domain demands, rapid model evolution further compounds the challenge of prompt optimization. As providers like Anthropic, OpenAI, Google, Meta, and Alibaba release new models, enterprises face recurring prompt migration challenges. Prompts optimized for one model often underperform on another due to different instruction-following characteristics. Manual reoptimization is costly and time consuming, and regression risks delay adoption of better models. Methodology and system design Promptimus addresses these challenges with a methodology built around a four-step iteration loop, with the following inputs: - the LLM you aim to use for inference - the initial prompt template - a small JSONL dataset typically 20–50 samples with corresponding variables for prompt templates, split into a development set for prompt tuning and a held-out test set for validation ; it is not mandatory for the samples to contain the ground truth - a user-defined performance-evaluation metric function you can bring your own Python code The four-step iteration loop Step 1 — evaluation: During initialization, the original prompt is executed on the target LLM using the development set dev set to establish baseline evaluation scores. Additionally, the metric-analyzer agent performs analysis of the user-defined metric function, generating checkpoint functions that decompose the evaluation into intermediate validation steps. These checkpoints enable fine-grained failure diagnosis throughout the optimization process. For example, when the checkpoints reveal that 98% of outputs have the correct JSON format, and 95% have valid schemas, but only 88% have valid values, the cause of underperformance is localized to value validation. After the initial evaluation, Promptimus branches into either standard mode, where it conducts full prompt rewrites, or edit mode, where it modifies prompts with structured find-and-replace edits. | | | | | | | | | | | We recommend standard mode for short prompts that need significant expansion — for example, a two-line math prompt that needs to grow into detailed reasoning protocols. Edit mode is a better choice for longer and already well-crafted prompts containing structured content like API schemas, compliance rules, or domain taxonomies, where full rewrites risk silently dropping or reorganizing carefully crafted sections. For a prompt with 50,000–100,000 tokens, a typical iteration produces three to five edits totaling 500–1,000 tokens, versus regeneration of the entire prompt. More generally, Promptimus adds content only when the optimization loop surfaces unaddressed failure modes, so prompt length plateaus within the first few iterations. This means that the relative serving-time impact is small for already long production prompts and larger for short starter templates. If the optimized prompt is served as a cached system prompt, the additional cost is one call during the cache's time to live, which becomes negligible at scale. Empirical experiments and analysis We evaluated Promptimus against six leading automatic prompt optimization methods across 20 public benchmarks spanning reasoning, math, question answering, text-to-SQL, coding, function calling, instruction following, and multimodal tasks. All methods used the same optimizer model and evaluation budgets with Claude Sonnet 4.6 as the target model, averaged over five random seeds. Each benchmark used 20 dev samples for optimization and 100 held-out test examples for evaluation. As reported in the table below, Promptimus achieves the best result on 16 of 20 benchmarks and ties on one, outperforming all six baselines on average 0.792 vs. 0.765 for the best-of-six baseline . The largest gains appear on tasks where the metric has a decomposable structure. Notably, Promptimus with edit mode outperforms all four multimodal benchmarks, suggesting that vision-language prompts benefit from preserving existing visual-analysis structure rather than rewriting it. | | | | | | BBH-CausalJudge | Acc 0,1 | 0.538 | | 0.718 | Standard | BBH-DisambigQA | Acc 0,1 | 0.601 | 0.868 GPO | | Standard | BBH-GeoShapes | Acc 0,1 | 0.747 | 0.770 OPRO | | Standard | BBH-RuinNames | Acc 0,1 | 0.918 | 0.926 GEPA | | Standard | BBH-Snarks | Acc 0,1 | 0.324 | | 0.908 | Edit | GSM8K | Acc 0,1 | 0.658 | | 0.958 | Standard | DAPO-AIME | Acc 0,1 | 0.703 | 0.730 ProTeGi | | Standard | HotPotQA | F1 0,1 | 0.16 | 0.832 MIPROv2 | | Standard | Spider | ExAcc 0,1 | 0.68 | 0.846 GEPA | | Edit | BIRD | ExAcc 0,1 | 0.626 | | | Standard | BigCodeBench-hard | Pass@1 0,1 | 0.339 | 0.336 ProTeGi | | Standard | Codeforces | Pass@1 0,1 | 0.589 | 0.808 TextGrad | | Edit | BFCL | AST 0,1 | 0.882 | 0.968 MIPROv2 | | Standard | NesT-FuL | PMacc 0,1 | 0.375 | 0.429 TextGrad | | Standard | IFBench | Acc 0,1 | 0.498 | 0.509 GEPA | | Standard | IFEval | Strict 0,1 | 0.876 | 0.886 GPO | | Standard | MathVista | Acc 0,1 | 0.433 | 0.606 GPO | | Edit | ChartQA | Relaxed Acc 0,1 | 0.279 | 0.828 ProTeGi | | Edit | AI2D | Acc 0,1 | 0.834 | 0.824 MIPROv2 | | Edit | DeFactify | Acc 0,1 | 0.835 | 0.922 MIPROv2 | | Edit | | 0.595 | 0.765 | | The figure below shows convergence through iterations on two representative benchmarks. Promptimus edit mode reaches 90% of its final development score in a median of about 300 metric calls, faster than all baselines. Both modes typically plateau within eight iterations, with the bulk of improvement concentrated in the first three to five iterations. Importantly, dev set gains transfer to the held-out test set. Sometimes baselines match or even exceed Promptimus on dev but fall behind on test, indicating overfitting. We attribute this to edit mode's surgical modifications, which preserve generalizable prompt structure, and metric probing, which produces failure signals that transfer across examples, as opposed to memorization of dev-set patterns. We also evaluated Promptimus across multiple LLMs using a public benchmark and Amazon enterprise use cases, spanning the tasks of classification, text-to-SQL, math reasoning, coding, multimodal understanding, and complex API generation on seven target models. Promptimus improved baseline prompts on all nine tasks, with gains ranging from 3.18% to 90.27%. Dev sets ranged from 30 to 160 examples, with the majority of tasks using fewer than 100, demonstrating the system's sample efficiency. The results also highlight model-agnostic generalizability: the same optimization framework produced meaningful gains across both proprietary and open-source target models without task-specific engineering. | | | | | | Complex API call generation | GPT-OSS-120B | API Acc user-defined 0,1 | 43 | 0.45 | | Classification A | Nova Pro | F1 score and FPR score 0,1 | 210 | 0.64 | | Multimodal classification B | Haiku-4.5 | Accuracy 0,1 | 160 | 0.51 | | Classification C | Nova Lite | Accuracy 0,1 | 85 | 0.56 | | Text2sql A | Nova-Micro | Execution Accuracy 0,1 | 50 | 0.72 | | Math reasoning A | Qwen3-235B WS12 non-reasoning | Accuracy user-defined 0,1 | 30 | 0.47 | | Math reasoning B | Claude-4.5-Opus non-reasoning | Accuracy user-defined 0,1 | 30 | 0.60 | | Coding A | GPT-OSS-120B | Pass@1 0,1 | 100 | 0.26 | | Coding B | GPT-OSS-120B | Pass@1 0,1 | 31 | 0.56 | | Following are examples of how Promptimus improved already fine-grained prompts to further drive application performance for a variety of use cases. Example 1: CodeForces coding benchmark designed to evaluate LLM reasoning This use case is to use an LLM to generate a Python function based on a user-provided problem description. We used 50 dev samples sampled from the original dev set and 148 test samples with a user-defined scoring approach. The Promptimus edit mode optimization converged in five iterations. | | Example 2: Multimodal AI agent This AI agent is for Amazon to detect construction defects. The original and optimized prompts are shown below. We used the vision-language model qwen3-vl-235b-a22b on Amazon Bedrock to examine the images taken by inspectors and identify construction defect categories and risk levels. The optimization process looped in three iterations with 16 dev samples. The recommendations generated by the metric analyzer and instruction optimizer in Promptimus including providing a role, a task objective, defect categories with examples, a category disambiguation section, analysis instructions with a decision tree, output format requirements, and critical output requirements improved the image classification accuracy from 0.438 to 0.812. When we applied the optimized prompt to the test sample set 17 samples , accuracy improved from 0.471 to 0.529. Example 3: Defactify multimodal fact verification This is a comprehensive framework for evaluating an LLM’s ability to perform multimodal fact verification, detect misinformation, and identify AI-generated content. The Promptimus metric analyzer found that the model defaults to ''Real'' for photorealistic AI-generated images. The optimizer introduces an adversarial dual-hypothesis framework with asymmetric weighting that biases the model toward “AI-generated”. For example, with the original prompt, the model dismisses a clock with garbled numbers as an “artistic design choice” and is fooled by photorealistic textures. After optimization, by contrast, the adversarial dual-hypothesis protocol forces systematic signal enumeration, catching the garbled clock numerals that the baseline dismissed. Conclusion and future work Compared to other metric-driven prompt optimization approaches, Promptimus excels at preventing exploitation through targeted and exploitation-focused refinements. It is fully generalizable, adaptive to user-defined metric functions and task domains without manual engineering. The dense feedback loop drives automatic analysis on metric-function code, identifies debugging checkpoints, and generates adaptive, task-aware exploration strategies that target the specific failure modes of each prompt-and-task combination. Particularly, our approach is sample efficient, requiring only a small number of dev examples typically 20–50 to drive significant improvements, fitting it for enterprise scenarios where labeled data is scarce or expensive to obtain. Furthermore, its model-agnostic design enables it to rapidly adapt prompts to target models for seamless enterprise-level model migration. We are making this innovation available through Amazon Bedrock to enable model migration for enterprise generative-AI applications with zero manual engineering and minimal labeled datasets.