Prompt Stability Matters: Evaluating and Optimizing Auto-Generated Prompt in General-Purpose Systems

arXiv:2505.13546 · cs.AI, cs.CL, cs.MA · Submitted 2025-05-19 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Today's paper: "Prompt Stability Matters".

Jane: The gist: This work introduces prompt stability as a key factor for building robust and effective prompt generation systems in general-purpose multi-agent systems,

Tom: First, who's behind it and why it matters.

Paper summary: Tom: So, looking at the whole paper, Prompt Stability Matters: Evaluating and Optimizing Auto-Generated Prompt in General-Purpose Systems, the authors really push for a fundamental change in how we think about prompt evaluation.

Jane: They’re arguing that outcome-centric evaluation is too narrow because it ignores the inherent randomness of large language models <ref:2505.13546#pg2>.

Lu: Their main contribution is proposing semantic stability as the metric to capture response consistency across repeated executions, and then building a system, Promptor, that uses this feedback to iteratively improve both prompt quality and system performance <ref:2505.13546#pg3>.

Meng: It seems like they've moved beyond just writing prompts by creating a whole loop where the AI checks its own stability and fixes itself based on that measured consistency <ref:2505.13546#pg3>.

Tom: And they successfully showed that this stability metric isn't just a theoretical concept; it has a measurable, positive impact on task success rates across general and domain-specific tasks <ref:2505.13546#pg2>.

Jane: The implication for the world is that we can start designing general-purpose multi-agent systems with this stability feedback built in from the start, focusing on long-term reliability instead of just hoping for a good first try <ref:2505.13546#pg1>.

Conclusion: Tom: So, we just finished looking at this paper, "Prompt Stability Matters." Basically, they're saying that when you're building big AI systems that do lots of different jobs—like a multi-agent system—you shouldn't just care if the first answer is right.

Jane: Right. They argue that consistency over time is way more important than getting one perfect result right now. So, they introduce this idea called semantic stability, which measures how much the AI's answers stay semantically similar when you run the same prompt again.

Lu: From a representation learning side, I found their theoretical analysis interesting. They show that the error between what you plan and what actually happens is really just driven by the variance in how those executors respond. That makes sense mathematically.

Meng: But if we're talking about shipping something to production, how do you actually measure that stability without running millions of tests? I need a practical way to know if my prompt is going to break at scale.

Lalam: From my perspective, the authors fine-tuned a LLaMA evaluator specifically for this task. It gives us an automated way to score the consistency of prompts across different tasks, which is useful for iterative refinement. I'm pretty sure the stability metric they used shows a strong positive correlation with actual task success rates.

Tom: A correlation is good, but let's look at what that means for us building general-purpose agents. If we can quantify stability, then we can build systems that don't just guess; they know which prompts are actually reliable before we spend hours training them.

Jane: Exactly. The paper shows a logical chain here where prompt stability isn't just some nice idea; it’s a necessary condition for the whole system to work effectively at the task level. It shifts the focus from hoping for a good one-off answer to building something that is reliably consistent over time.

Lu: That shift is crucial because it gives us an interpretable way to tune these systems, instead of just tweaking parameters blindly. It’s about designing for persistence rather than just immediate output accuracy.

Meng: For deployment, that means we spend less time debugging cascading failures between agents and more time ensuring the core instructions—the prompts—are stable enough to handle the inherent randomness of the LLMs. That's a real cost saver on our end.

Tom: So, if you take away everything in this paper, you can just say they’ve given us a better lens for designing prompts that actually work in complex multi-agent scenarios. It’s about moving from one-off results to persistent reliability.

Jane: It sets up the next thing we need to consider: how do we actually implement this stability feedback loop into a real system? We’ll be looking at that next.

Ke Chen, Yufei Zhou, Xitong Zhang, Haohan Wang

School of Information Sciences, University of Illinois Urbana-Champaign · Department of Economics, Duke University

cs.AI, cs.CL, cs.MA

Submitted: 2025-05-19

Updated: 2026-10-13

Project page: https://xucheng63.github.io/MyDataPilot

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 87/100

The gist: The gist: This work introduces prompt stability as a key factor for building robust and effective prompt generation systems in general-purpose multi-agent systems, arguing that consistency across

Key concepts

Prompt Stability
This refers to how consistently an LLM produces the same kind of output when given the same prompt multiple times. It measures the reliability of a prompt by checking if its responses remain semantically similar across different executions, which is crucial for building dependable AI systems.
Semantic Stability S(p)
This metric quantifies prompt stability by calculating the average pairwise cosine similarity between different outputs generated from the same prompt. A higher score indicates that the outputs are more semantically consistent, meaning the prompt reliably guides the model to produce similar results.
Stability-Guided Optimization Framework
This is a system that uses stability feedback to improve prompts and planning simultaneously. If a prompt's stability is low, an agent diagnoses the instability and revises parts of it. This iterative process aims to make prompts more consistent while also aligning the planned steps better with the desired final outcome.
Planner Alignment Objective
This objective focuses on minimizing the gap between what the system plans to do (the planner intent) and what actually happens during execution. By adjusting subtask boundaries and injecting corrective signals, this mechanism ensures that the agent's actions stay close to the original high-level goal.

Terminology

Summary

The gist: This work introduces prompt stability as a key factor for building robust and effective prompt generation systems in general-purpose multi-agent systems, arguing that consistency across repeated executions is more crucial than immediate task performance

Motivation and Problem Statement

Automatic prompt generation plays a crucial role in enabling general-purpose multi-agent systems to perform diverse tasks autonomously. Existing methods typically evaluate prompts based on their immediate task performance, overlooking the intrinsic qualities that determine their reliability. This outcome-centric view not only limits interpretability but also fails to account for the inherent stochasticity of large language models (LLMs). In multi-agent systems where agents depend on one another’s outputs, such inconsistencies can cascade. Thus, we argue that prompts should be evaluated not only for correctness or accuracy, but also for stability—their ability to consistently elicit semantically coherent responses across executions.

Theoretical Analysis of Prompt Stability

The analysis considers a planner–executor structure where the deviation between the envisioned and actual outputs is driven by the variance of executor responses. The deviation between actual and intended system outputs is given by s − ˆs = u T (X − X̂)v, which simplifies to Xn i=1 uivi(xi − xˆi). Lemma 1 establishes a bound on the probability that this deviation exceeds a threshold epsilon, showing s − ˆs P (s − ˆs ≥ ϵ) ≤ 2 exp-epsilon squared / (2 Pn i=1(uivi) squared Var(xi)). This analysis shows that the deviation between actual and intended system outputs is primarily driven by the variance of executor responses.

Semantic Stability as a Metric

To capture the consistency of outputs generated from the same prompt, semantic stability S(p) is defined as the average pairwise cosine similarity of sampled outputs. This metric is computed using embeddings, where each sampled output yi is encoded into a semantic vector vi = ϕ(yi). The definition of semantic stability S(p) is S(p) = 1 − 2 / N(N − 1) X i<j d ij, where d ij is the cosine distance between output pairs. Higher values of S(p) indicate greater semantic consistency and thus stronger prompt stability. Empirical results show a strong positive correlation (r = 0.73) between semantic stability and task success rate, confirming that more stable prompts are significantly more likely to succeed.

Stability-Guided Optimization Framework

The system jointly optimizes two objectives: (1) Stability Objective: max pi S(pi), which reduces execution variance via stability-aware prompt generation; and (2) Planner Alignment Objective: min pi s⋆′− ˆs, which improves task decomposition by minimizing the gap between planner intent and idealized output. To reduce execution deviation, prompts with S(pi) < τ trigger a Reviewer Agent that diagnoses instability and revises the unstable subcomponent z ∈ q i, i i, k i, or h i to form an updated prompt p'i. To reduce planner error s⋆′− ˆs, mechanisms like Subtask Optimization adjust subtask boundaries and the Plan Updater injects corrective signals ∆t into future subtasks based on execution feedback.

Empirical Validation

The framework was tested using GPT-4o as the language model backbone across general-purpose tasks like math reasoning, data analysis, code generation, and machine learning. Promptor outperformed baselines such as AutoGen and DI in mathematical reasoning (MR) and achieved a high similarity score of 0.88 on the InfiAgent-DABench benchmark for data analysis (DA). In professional domains, Promptor achieved an accuracy of 86% on single-cell RNA sequencing (scRNA-seq) analysis and the highest accuracy among tested systems on the SMILES-to-molecular formula (S2MF) task in chemistry. Ablation studies confirmed that each module in the framework plays a critical role, and replacing semantic stability with token-level KL divergence hurt results, confirming S(p) as a more effective refinement signal.

Conclusion

This paper introduces prompt stability as a core design principle for general-purpose multi-agent systems. Through theoretical analysis and empirical validation, we show that semantic stability provides a practical and interpretable proxy for measuring output variance and guiding prompt optimization. Our proposed system, Promptor, integrates stability-aware refinement and feedback-driven planning to improve execution consistency and task success. These findings suggest that prompt stability offers a robust foundation for scaling multi-agent coordination in LLM-based systems.

--- Page 1 ---

arXiv:2505.13546v1 [cs.AI] 19 May 2025

Prompt Stability Matters: Evaluating and Optimizing Auto-Generated Prompt in General-Purpose Systems

Ke Chen Yufei Zhou Xitong Zhang Haohan Wang

Abstract

Automatic prompt generation plays a crucial role in enabling general-purpose multi-agent systems to perform diverse tasks autonomously. Existing methods typically evaluate prompts based on their immediate task performance, overlooking the intrinsic qualities that determine their reliability. This outcome-centric view not only limits interpretability but also fails to account for the inherent stochasticity of large language models (LLMs). In this work, we bring attention to prompt stability—the consistency of model responses across repeated executions—as a key factor for building robust and effective prompt generation systems. To quantify this, we propose semantic stability as a criterion for assessing the response consistency of prompts, and fine-tune a LLaMA-based evaluator to measure it automatically across tasks. These components have enabled us to develop the first stability-aware general-purpose prompt generation system that leverages stability feedback to iteratively enhance both prompt quality and system-level performance. Furthermore, we establish a logical chain between prompt stability and task success by analyzing the structural dependencies within our system, proving stability as a necessary condition for effective system-level execution. Empirical results across general and domain-specific tasks demonstrate that our stability-aware framework improves both accuracy and output consistency. By shifting the focus from one-off results to persistent reliability, our work offers a new perspective on prompt design and contributes practical tools for building more trustworthy general-purpose systems.

1 Introduction

Imagine a project manager acting as a planner. The project’s success hinges on the clarity of these instructions—any ambiguity may lead to misinterpretation, misalignment, and ultimately, failure to realize the original vision. Now, imagine the same scenario with a twist: both the project manager and the team are highly versatile, capable of handling tasks across diverse domains. This general-purpose setting magnifies the challenge, as domain-specific language increases the risk of misunderstanding. In such context, instructions must be precise, consistent, and unambiguous.

This is no longer hypothetical. While human teams rarely have such general-purpose abilities, AI agents increasingly do. General-purpose multi-agent systems built on large language models (LLMs) assign roles and responsibilities via prompts [5, 6, 8, 7], which define agent behavior, interaction and decision-making.

Improvements for AI systems

  1. Prompt refinement via semantic stability: Implement a mechanism where prompts are iteratively revised until their semantic stability S(p) ≥ τ is met, as this serves as a practical proxy for output variance in stochastic LLM settings. This directly reduces execution deviation by targeting the variance of executor responses.

  2. Joint optimization of stability and alignment: Design Promptor to simultaneously optimize two objectives: (1) Stability Objective: max pi S(pi) and (2) Planner Alignment Objective: min pi s⋆′− ˆs. This ensures that prompt quality is judged not only by outcome success, but also by the ability to achieve it consistently under varying conditions.

  3. Dynamic subtask refinement: Implement a Plan Updater that injects a corrective signal ∆t into future subtasks based on execution feedback, refining the planner’s trajectory ˆs. This mechanism aims to minimize the gap between planner intent and the ideal output by adjusting subtask boundaries, types, and I/O specifications.

  4. Structured output constraint: Enforce explicit input-output specifications for each subtask to constrain distributions such that xi ∼ Λ(i) (pi xi ∈ C). This restriction is designed to reduce semantic variance and improve stability across executions by limiting the range of possible outputs.

  5. Context retention via summarization: Integrate a Summarizer Agent that distills raw outputs into structured summaries, which serve as compact memory units, enhancing context retention and reducing semantic drift in downstream subtasks. This ensures long-horizon tasks maintain coherence by preserving relevant information for subsequent steps.

Abstract

Automatic prompt generation plays a crucial role in enabling general-purpose multi-agent systems to perform diverse tasks autonomously. Existing methods typically evaluate prompts based on their immediate task performance, overlooking the intrinsic qualities that determine their reliability. This outcome-centric view not only limits interpretability but also fails to account for the inherent stochasticity of large language models (LLMs). In this work, we bring attention to prompt stability-the consistency of model responses across repeated executions-as a key factor for building robust and effective prompt generation systems. To quantify this, we propose semantic stability as a criterion for assessing the response consistency of prompts. Based on the proposed metric, we developed the first stability-aware general-purpose prompt generation system that leverages stability feedback to iteratively enhance both prompt quality and system-level performance. Furthermore, we establish a logical chain between prompt stability and task success by analyzing the structural dependencies within our system, proving stability as a necessary condition for effective system-level execution. Empirical results across general and domain-specific tasks demonstrate that our stability-aware framework improves both accuracy and output consistency. By shifting the focus from one-off results to persistent reliability, our work offers a new perspective on prompt design and contributes practical tools for building more trustworthy general-purpose systems. The UI and source code for our system are publicly available at: https://xucheng63.github.io/MyDataPilot/.

Sources

Related papers