AgentGrad: Intervention-Guided Prompt Optimization for Multi-Agent Systems
Jaewon Chu, Jinwoo Seo, Jaewon Cho, Jeehye Na, Yunyang Xiong, Youngdae Kim, Hyunwoo J. Kim
AgentGrad optimizes multi-agent system prompts by using sequential interventions to isolate failure sources and semantic abstraction to generalize corrective feedback.
How can we optimize prompts in multi-agent systems by identifying which specific agent's prompt caused a failure?
Multi-agent systems often fail because it is unclear which specific agent's prompt caused a system-level error, leading to inefficient or noisy optimization updates. AgentGrad identifies the responsible agent by injecting hints one by one to see which correction resolves the failure, then uses that corrected output as a pseudo-label to generate precise, actionable feedback. This approach achieves state-of-the-art performance across five benchmarks while reducing optimization time by 2.5× compared to existing textual gradient methods.
Paper Primer
Existing textual gradient methods for multi-agent systems (MAS) struggle with two bottlenecks: they cannot reliably pinpoint which agent caused a failure, and they aggregate feedback by simply concatenating random samples, which mixes unrelated failure modes. AgentGrad solves this by treating prompt optimization as a localized debugging task: it uses sequential intervention to isolate the specific agent responsible for a failure and then clusters similar corrective signals into semantic minibatches to produce generalized, coherent update instructions.
AgentGrad significantly improves optimization efficiency and task performance across diverse MAS benchmarks.
Across five benchmarks (including HotpotQA, MATH, and PUPA), AgentGrad consistently outperformed baselines like TextGrad and GEPA, achieving an average improvement of +11.76 points over no-optimization baselines with GPT-5-mini. 2.5× faster wall-clock optimization time on average compared to the next-fastest baseline.
Why is it necessary to identify a "target agent" rather than updating all agents simultaneously?
Updating all agents at once is computationally expensive and often introduces noise, as the system cannot distinguish which prompt change actually resolved the failure. By isolating the specific agent whose correction fixes the output, AgentGrad provides a direct, fine-grained signal for that agent's prompt.
How does semantic abstraction differ from standard gradient aggregation?
Standard methods aggregate gradients by randomly grouping samples, which often mixes unrelated failure modes. AgentGrad uses an aggregator LLM to cluster gradients that share a common corrective pattern, ensuring the prompt optimizer receives a coherent, generalized direction rather than a conflicting set of instructions.
For researchers building multi-agent systems, AgentGrad demonstrates that treating prompt optimization as a failure-attribution problem—rather than a black-box search—dramatically improves both the quality of the resulting prompts and the speed of the optimization process.
Introduction to AgentGrad
We expose the credit‑assignment gap in multi‑agent prompt optimization and outline our solution.
Large‑language‑model (LLM) based multi‑agent systems (MAS) decompose complex tasks into subtasks, letting each specialized agent contribute its strength. Because each agent’s behavior is driven by its prompt, prompt design becomes a critical bottleneck for overall system performance.
Existing textual‑gradient approaches suffer two intertwined problems. First, they pick a target prompt without checking whether changing that prompt actually fixes the observed failure, and they derive gradients without any agent‑level supervision of the intermediate outputs. Second, they aggregate individual gradients by random concatenation, which mixes unrelated failure modes and harms generalization.
When a multi‑agent system fails, we cannot tell which agent’s prompt caused the error, so updates end up blaming the wrong component.
**Figure 1.** Comparison of conventional textual gradient approaches and AgentGrad. In gradient extraction, conventional approaches (a) select target prompts without identifying whose modification resolves the failure and extract gradients without agent-level intermediate supervision, while AgentGrad (b) identifies the target agent via sequential intervention and extracts gradients using the intervention-adjusted output of the target agent. In gradient aggregation, conventional approaches (c) randomly group gradients causing spurious signals, while AgentGrad (d) clusters gradients by shared patterns and abstracts them into a generalized gradient.
The core problem is credit assignment in multi‑agent prompt optimization: without isolating the responsible agent, gradient‑based updates cannot reliably improve the system.
Background and Baselines
We review prior APO methods and introduce the core concepts used later.
Automatic Prompt Optimization (APO) has become the standard way to improve LLM‑driven agents by refining their textual inputs. Early APO work focused on single‑prompt settings, using black‑box search, edit‑based search, or LLM‑generated feedback. Recent extensions address compound agent systems.
Methods that automatically adjust prompts, demonstrations, or instructions to boost LLM‑agent performance, typically via black‑box search or LLM‑generated critiques.
Introduces textual gradients by interpreting natural‑language critiques of failed examples as gradient‑like directions for prompt revision.
Jointly searches instructions and demonstrations for multi‑stage LM programs using Bayesian optimization.
MIPROv2 extends the original MIPRO pipeline by incorporating sequential interventions to isolate the contribution of each agent’s prompt.
TextGrad propagates natural‑language feedback across multiple LLM components, analogous to back‑propagation in neural networks.
GEPA combines trajectory‑level reflection with evolutionary prompt search to refine agent behavior.
Failure attribution in multi‑agent systems is difficult because system‑level errors can stem from complex interactions among agents. Recent benchmarks formalize the problem by localizing failures within multi‑agent trajectories, and intervention‑driven debugging systems edit or replay executions to test causal hypotheses.
Self‑generated supervision studies how LLMs can produce rationales, feedback, or reflections that serve as optimization signals. Methods such as STaR, Reflexion, and Self‑Refine use model‑generated feedback to improve reasoning or iterative outputs, but they do not target prompt‑level updates for individual agents.
Prompt optimization seeks the set of agent prompts that maximizes expected task reward while respecting a limited rollout budget.
The textual gradient is a natural‑language analogue of a numerical gradient, describing how a prompt should change to improve a given objective.
The AgentGrad Framework
Identify the prompt whose correction alone fixes a system‑level failure.
AgentGrad isolates the responsible agent by probing agents one‑by‑one, starting from the last, and checking whether a tiny hint makes the system succeed.
We walk backward through the agents, temporarily add a corrective hint to each prompt, and see if the overall error disappears; the first agent that makes the error vanish is the one we need to update.
How does Sequential Intervention differ from ordinary gradient‑based attribution methods?
Gradient attribution spreads credit continuously across all parameters, whereas Sequential Intervention treats each agent as a discrete unit, injecting a single hint and observing a binary “fixed / not fixed” outcome. This makes the credit assignment crisp and isolates the responsible agent without needing differentiable approximations.
Compute $r(\Pi(x;P),y)=0$, so $(x,y)$ belongs to $F$.
Start with $\pi_3$: append hint $H$ to $p_3$, run $\Pi^{(3,H)}$, obtain reward $1$ → failure resolved.
Record $(x,y)$ in $T_3$, update $F_3 = F_4 \setminus T_3 = \emptyset$.
Since $F_3$ is empty, stop; $\pi_3$ is identified as the target agent.
Even a tiny hint can flip the system’s output, proving that the error originates entirely from the last agent’s prompt.
AgentGrad Algorithm
AgentGrad isolates failing agents and updates their prompts via sequential interventions.
When many agents contribute prompts, a low validation score tells us that something went wrong, but we cannot tell which agent’s prompt is to blame.
We intervene on agents one by one, from the last to the first, to pinpoint the exact prompt that caused a failure, then gather its gradient and use it to improve that prompt alone.
How does this differ from naïvely applying gradient descent to all prompts simultaneously?
Naïve joint descent treats every prompt as if its gradient were independent, which blurs the source of error; AgentGrad’s sequential intervention isolates the exact agent whose prompt caused each failure, so only the responsible prompt receives a targeted update, eliminating credit‑assignment noise.
AgentGrad core algorithm (pseudocode).
Initial failure set $F = \{(x_1,y_1), (x_2,y_2)\}$.
Agent 2: recompute failures $F_2$ after fixing $p_2$ → $F_2 = \{(x_1,y_1)\}$, so $T_2 = \{(x_2,y_2)\}$.
Run one rollout for $(x_2,y_2)$, collect gradient $δ_2^{1}$ and store in $Ω_2$.
Agent 1: recompute failures $F_1$ after fixing $p_1$ → $F_1 = \emptyset$, so $T_1 = \{(x_1,y_1)\}$.
Run one rollout for $(x_1,y_1)$, collect gradient $δ_1^{1}$ and store in $Ω_1$.
Aggregate $Ω_2$ → $\bar{δ}_2$, aggregate $Ω_1$ → $\bar{δ}_1$, then update $p_2$ then $p_1$.
By processing agents backward, each gradient is guaranteed to correspond to failures that cannot be explained by later agents, thus providing a clean credit‑assignment signal.
Sequential Intervention Mechanism
We extract agent-specific textual gradients by intervening on prompts to isolate corrective signals.
After running the current prompt set on the training data, we must pinpoint which agent’s prompt caused each failure before we can compute a corrective gradient.
Intervene on $p_3$: $f_2$ is corrected, so $T^3=\{f_2\}$, remaining $F^3=\{f_1,f_3\}$.
Intervene on $p_2$ with $F^3$: $f_1$ is corrected, yielding $T^2=\{f_1\}$, remaining $F^2=\{f_3\}$.
Intervene on $p_1$ with $F^2$: $f_3$ is corrected, so $T^1=\{f_3\}$.
Resulting assignment: $T^1\!\to\!p_1$, $T^2\!\to\!p_2$, $T^3\!\to\!p_3$.
The backward sweep guarantees that each failure is attributed to the *latest* prompt that can fix it, avoiding double‑counting of earlier agents.
How does Sequential Intervention differ from a simple ablation where each prompt is removed in isolation?
In a plain ablation we drop a prompt entirely, which changes the entire input distribution. Sequential Intervention instead injects a corrective hint $H$ while keeping the original prompt $p_n$ active, so the model sees the same input context and the observed change isolates the effect of that specific prompt alone.
**Figure 2.** **Intervention-Guided Target Identification.** AgentGrad first executes the current prompt set on $D_{train}$ to obtain the failed examples $F$. It then applies interventions to each agent in reverse execution order, progressively separating the unresolved failures into corrected subsets $T^n$ and remaining failure sets $F^n$. Here, $T^n$ denotes the subset of failures for which the $n$-th agent is identified as the target, namely those resolved by intervening on prompt $p^n$.
With the target agent’s prompt temporarily corrected by a hint, we treat the resulting output as a pseudo‑label and ask a gradient‑extractor LLM how the prompt should change to reproduce that corrected output.
These agent‑level pseudo‑labels replace the system‑wide loss used in prior textual‑gradient methods, enabling fine‑grained, sample‑specific updates without requiring a global objective.
Semantic Gradient Abstraction
We cluster sample gradients into semantic minibatches and abstract them into unified textual gradients for prompt updates.
Standard textual‑gradient methods aggregate gradients from random minibatches, which often blend unrelated failure modes and leave the prompt optimizer without a clear direction.
Instead of mixing all failure signals, we group semantically similar sample‑level gradients—like clustering similar complaints into a single ticket—so each group yields one coherent update direction.
How does this abstraction differ from the usual minibatch averaging used in standard textual‑gradient methods?
Standard averaging mixes gradients from unrelated failures, producing a noisy direction that may cancel useful signals. Here we first cluster gradients by semantic similarity, then replace each cluster with a single generalized gradient, guaranteeing that every update reflects a consistent corrective pattern.
Step 1: The aggregator groups $g_1$ and $g_2$ into Cluster A (size 2) and $g_3$ and $g_4$ into Cluster B (size 2).
Step 2: For Cluster A the aggregator synthesizes a generalized gradient $\bar{\delta}_{1, A}$ that instructs “remove personal identifiers”.
Step 3: For Cluster B it synthesizes $\bar{\delta}_{1, B}$ that instructs “mask location references”.
Step 4: The prompt optimizer will first apply $\bar{\delta}_{1, A}$ (larger cluster) then $\bar{\delta}_{1, B}$.
Clustering isolates distinct failure modes, so each abstracted gradient targets a single semantic issue rather than a tangled mixture.
**Figure 5.** Qualitative example of semantic textual gradient abstraction. Three in-cluster examples produce distinct sample-level gradients for organization-name, geolocation, and fictional-looking identifier leakage. AgentGrad abstracts these signals into a generalized redaction policy that updates the target agent prompt, while an out-of-cluster example with a different corrective signal is excluded from the abstraction.
Prompt updates are applied in decreasing order of cluster size: the optimizer LLM receives the current prompt $p_n$ and a generalized gradient $\bar{\delta}_{n,j}$, produces a candidate $p_{n,j}^{\text{new}}$, validates it on its semantic minibatch $D_{n,j}$, and, if successful, on the held‑out set $D_{\text{val}}$ before committing the change.
Experimental Setup
AgentGrad outperforms all baselines, achieving the largest improvement across five MAS benchmarks.
AgentGrad achieves the highest improvement of +11.76 over the baseline on the five MAS benchmarks.
Table 2 shows AgentGrad (Ours) with +11.76 improvement, surpassing GEPA (+9.24), TextGrad (+6.33), and MIPROv2 (+5.66).
We adopt the data splits and reward functions from prior work, guaranteeing a consistent evaluation protocol.
**Table 2.** Main results on five MAS benchmarks with Qwen3-8B. We report the mean ± standard error over three random seeds. Bold indicates the best result.
Performance Results
AgentGrad delivers top performance and fastest optimization across MAS benchmarks.
Recall that AgentGrad isolates the responsible agent via sequential interventions and abstracts gradients for targeted updates.
AgentGrad attains state‑of‑the‑art scores on all five MAS benchmarks with GPT‑5‑mini.
Table 1 shows an average gain of +11.76 points over the no‑optimization baseline, with the largest margins on HotpotQA (73.89 vs 68.33) and PUPA (95.17 vs 91.87).
**Table 3.** Ablation study of AgentGrad. We progressively add intervention-guided target identification (TI), agent-level supervision (AS), and semantic textual gradient abstraction (STGA) to a vanilla baseline.
**Figure 4.** Minibatch and validation improvement ratios. The minibatch improvement ratio is the fraction of candidate updates that improve performance on their semantic minibatch and trigger validation, while the validation improvement ratio is the fraction of validation calls that yield further improvement. (a, b) AgentGrad vs. baselines (GEPA, TextGrad). (c, d) Ablation across AgentGrad components: Vanilla, +TI, +TI&AS, +TI&STGA, and full AgentGrad. All values are averaged over HotpotQA and PUPA with GPT-5-mini.
Ablations and Transferability
We dissect each new component to see how it shapes speed, quality, and transferability.
We run ablations that remove each new component—Sequential Intervention (TI), Agent‑level Supervision (AS), and Semantic Textual Gradient Abstraction (STGA)—to measure their impact on speed, quality, and cross‑benchmark transfer.
AgentGrad reduces wall‑clock optimization time by 2.5× compared with TextGrad (88 min vs 126 min on MATH).
Measured on the MATH benchmark; all other settings kept identical.
AgentGrad attains the highest transfer performance on every unseen target benchmark, with the biggest gaps on 2WikiMultiHopQA (51.22 vs 44.89) and PUPA‑TNB (94.38 vs 91.51).
Table 5 reports mean ± SE over three seeds; bold values indicate AgentGrad’s superiority.
**Table 5.** Prompt transferability across unseen benchmarks. We evaluate the transferability of prompts optimized on the source benchmark to an unseen target benchmark within the same domain. We report the mean ± standard error over three random seeds. Bold indicates the best performance.
Questions & answers
What is AgentGrad and what does it contribute?
AgentGrad is a prompt optimization framework for LLM-based multi-agent systems (MAS) that introduces two core mechanisms: Sequential Intervention for pinpointing which agent's prompt caused a system-level failure, and Semantic Textual Gradient Abstraction (STGA) for generating coherent, targeted prompt updates. It achieves state-of-the-art performance across five benchmarks and reduces optimization time by 2.5× compared to existing textual gradient methods.
What problem does AgentGrad address?
AgentGrad addresses the credit assignment problem in multi-agent prompt optimization: existing textual gradient methods cannot reliably identify which agent's prompt caused a failure, and they aggregate feedback by randomly concatenating samples, which mixes unrelated failure modes and produces noisy optimization signals. Without isolating the responsible agent, gradient-based updates cannot reliably improve the system.
Why is identifying the responsible agent important in multi-agent systems?
Updating all agents simultaneously is computationally expensive and introduces noise because the system cannot distinguish which prompt change actually resolved the failure. By isolating the specific agent whose correction fixes the output, AgentGrad provides a direct, fine-grained signal for only that agent's prompt, eliminating credit-assignment noise.
How does Sequential Intervention work?
Sequential Intervention probes agents one-by-one, starting from the last, by injecting a corrective hint H while keeping the original prompt active, then observing a binary 'fixed / not fixed' outcome. The agent whose hint resolves the failure is identified as the responsible agent, and its corrected output is used as a pseudo-label to generate a targeted prompt update.
How does Sequential Intervention differ from standard gradient-based attribution or simple ablation?
Unlike gradient attribution, which spreads credit continuously across all parameters, Sequential Intervention treats each agent as a discrete unit and produces a crisp binary outcome without needing differentiable approximations. Unlike a simple ablation that removes a prompt entirely and changes the input distribution, Sequential Intervention injects a corrective hint while keeping the original prompt active, isolating the effect of that specific prompt alone.
What is Semantic Textual Gradient Abstraction (STGA) and how does it work?
STGA is AgentGrad's gradient aggregation method that uses an aggregator LLM to cluster individual gradients by semantic similarity, then replaces each cluster with a single generalized gradient representing a consistent corrective pattern. Prompt updates are applied in decreasing order of cluster size, and each candidate update is validated on its semantic minibatch before being committed.
How does STGA differ from standard minibatch gradient aggregation?
Standard textual gradient methods aggregate gradients by randomly grouping samples, which blends unrelated failure modes and produces noisy, potentially conflicting update directions. STGA first clusters gradients by semantic similarity so that every update reflects a coherent corrective pattern, ensuring the prompt optimizer receives a generalized rather than contradictory direction.
What are the three main components of AgentGrad that are evaluated in ablations?
The three components evaluated in ablations are Sequential Intervention (TI), Agent-level Supervision (AS), and Semantic Textual Gradient Abstraction (STGA). The ablations measure the impact of removing each component on optimization speed, prompt quality, and cross-benchmark transfer.
What are the key performance results reported for AgentGrad?
AgentGrad achieves state-of-the-art performance across five benchmarks and reduces optimization time by 2.5× compared to existing textual gradient methods. The paper does not specify the exact benchmark names or per-benchmark numerical scores in the provided text.
What benchmarks and datasets does AgentGrad use?
AgentGrad is evaluated across five benchmarks, adopting data splits and reward functions from prior work to ensure a consistent evaluation protocol. The paper does not specify the individual benchmark names or dataset details in the provided text.
How does AgentGrad compare to prior textual gradient methods?
Prior textual gradient methods pick a target prompt without verifying whether changing it fixes the observed failure, derive gradients without agent-level supervision of intermediate outputs, and aggregate gradients via random concatenation. AgentGrad improves on all three fronts by using sequential intervention for attribution, agent-level pseudo-labels for supervision, and semantic clustering for aggregation, resulting in both higher accuracy and 2.5× faster optimization.
What role do pseudo-labels play in AgentGrad?
Once Sequential Intervention identifies the responsible agent, the corrected output produced by injecting the hint serves as a pseudo-label for that agent. These agent-level pseudo-labels replace the system-wide loss used in prior textual gradient methods, enabling fine-grained, sample-specific prompt updates without requiring a global objective.
What prior work does AgentGrad build on or relate to?
AgentGrad builds on Automatic Prompt Optimization (APO) research, including black-box search, edit-based search, and LLM-generated feedback methods, as well as self-generated supervision methods such as STaR, Reflexion, and Self-Refine. It also draws on intervention-driven debugging systems that edit or replay executions to test causal hypotheses, extending these ideas to prompt-level updates for individual agents in MAS.
What are the limitations or open questions acknowledged by the paper?
The paper does not explicitly enumerate limitations in the provided text. The ablation study implies that removing any of the three components (TI, AS, STGA) degrades performance, but the paper does not discuss failure cases, scalability bounds, or scenarios where sequential intervention may be unreliable.
Who are the authors of AgentGrad and where was it published?
The paper does not state the authors' names or the publication venue in the provided text; it is available on arXiv at https://arxiv.org/abs/2609.08572.
Key terms
- Multi-Agent System (MAS)
- A system in which multiple LLM-based agents, each driven by its own prompt, collaborate by handling different subtasks of a complex problem.
- Automatic Prompt Optimization (APO)
- A class of methods that automatically refine the textual prompts given to LLM agents in order to improve their task performance, without manual prompt engineering.
- Textual Gradient
- A natural-language description of how a prompt should be changed to reduce errors, serving as the LLM analog of a numerical gradient in traditional optimization.
- Sequential Intervention
- AgentGrad's mechanism for identifying the responsible agent by injecting a corrective hint into each agent's context one at a time and observing whether the system output is fixed.
- Credit Assignment
- The problem of determining which agent or component in a multi-agent system is responsible for a given system-level error or success.
- Pseudo-label
- A model-generated target output used as a substitute for a ground-truth label, here produced by the corrected agent output after a successful intervention.
- Semantic Textual Gradient Abstraction (STGA)
- AgentGrad's aggregation method that clusters individual textual gradients by semantic similarity and replaces each cluster with a single generalized gradient to ensure coherent prompt updates.
- Agent-level Supervision (AS)
- The use of per-agent pseudo-labels derived from sequential intervention to provide fine-grained optimization signals for individual agent prompts, rather than relying on a single system-wide loss.
- Aggregator LLM
- A language model used within AgentGrad to cluster textual gradients by their semantic similarity and produce a generalized gradient for each cluster.
- Corrective Hint (H)
- A small piece of guidance injected into an agent's context during sequential intervention to test whether that agent's prompt is responsible for the observed failure.
- STaR (Self-Taught Reasoner)
- A prior method in which an LLM generates its own reasoning rationales to iteratively improve its reasoning ability, used here as a related self-generated supervision baseline.
- Reflexion
- A prior method that uses model-generated verbal reflections on past failures to guide iterative improvement of LLM outputs, cited as related self-generated supervision work.
- Self-Refine
- A prior method in which an LLM iteratively critiques and revises its own outputs, cited as related self-generated supervision work that does not target prompt-level updates for individual agents.
- Semantic Minibatch
- A subset of training samples grouped by semantic similarity of their associated gradients, used in STGA to validate candidate prompt updates before committing them.