TL;DR
AgentGrad is a novel prompt optimization framework for multi-agent systems (MAS) that tackles the tricky problem of credit assignment when a system fails. By sequentially intervening with hints in reverse execution order, AgentGrad pinpoints the exact agent responsible for a failure, generates fine-grained agent-level pseudo-labels, and clusters similar textual gradients into coherent updates. This approach achieves state-of-the-art performance across five diverse benchmarks while slashing wall-clock optimization time by 2.5× on average.
What Problem Does This Paper Address?
Large language model (LLM)-based multi-agent systems (MAS) excel at breaking down complex tasks into specialized subtasks. However, their overall success heavily depends on the prompt design of each individual agent. Automatically optimizing these prompts via "textual gradients"—using natural language feedback to iteratively refine instructions—has become a popular paradigm.
Despite its promise, current textual gradient methods suffer from two major bottlenecks:
- Uninformed Gradient Extraction (The Credit Assignment Problem): When a multi-agent system outputs an incorrect answer, it is difficult to know which agent messed up. Existing frameworks either update all agent prompts simultaneously (which is expensive and noisy) or use a naive round-robin approach without verifying if modifying a specific agent actually fixes the failure. Furthermore, they lack direct, agent-level supervision over intermediate outputs.
- Haphazard Gradient Aggregation: Individual textual gradients from different failure modes are typically grouped randomly and concatenated. This mixes unrelated errors (e.g., a math syntax error with a factual mistake), leading to incoherent prompt updates that fail to generalize.
Methods
AgentGrad introduces a two-pronged solution to fix the extraction and aggregation phases:
1. Target Prompt Identification via Sequential Intervention
To solve the credit assignment problem, AgentGrad systematically tests agents one by one to see whose correction actually resolves the system-level failure. It does this by injecting a "hint" (derived from the ground truth or task constraints) into an agent's prompt during training. Crucially, it performs this sequential intervention in reverse execution order because the authors observed that errors tend to accumulate and manifest in later agents.
2. Agent-Level Supervision & Pseudo-Labeling
Once the target agent is identified, the system compares its original failed intermediate output with its new, intervention-adjusted correct output. This corrected intermediate output acts as an agent-level pseudo-label. A gradient extractor LLM then compares the two outputs to derive a highly specific, fine-grained textual gradient ($\delta_i^n$) for that exact agent.
3. Semantic Textual Gradient Abstraction
Instead of randomly shuffling gradients together, AgentGrad uses an aggregator LLM to cluster semantically similar sample-level gradients into "semantic minibatches." It then abstracts each cluster into a single, generalized textual gradient ($\bar{\delta}_j^n$) that captures a shared corrective pattern (e.g., grouping different instances of PII leakage into a unified redaction policy). Prompts are then updated and validated in decreasing order of minibatch size.
Datasets
The authors evaluated AgentGrad across five distinct multi-agent benchmarks using both proprietary (GPT-5-mini) and open-source (Qwen3-8B) backbones:
- HotpotQA: Multi-hop question answering.
- HoVer: Many-hop claim verification.
- IFBench: Verifiable instruction following.
- PUPA: Privacy-conscious delegation.
- MATH: Complex mathematical reasoning.
To test generalizability, they also evaluated prompt transferability to unseen target datasets within the same domains: 2WikiMultiHopQA, EX-FEVER, PUPA-TNB, IFEval, and OlympiadBench.
Key Insights and Ideas
- Reverse Order Efficiency: Errors in multi-agent pipelines frequently bottleneck at the final stages. Intervening from the last agent backward drastically reduces the number of expensive LLM rollouts needed to find the culprit.
- Clean Signals Over Noisy Aggregations: Randomly combining natural language feedback creates conflicting instructions for the prompt optimizer. Clustering gradients by failure mode ensures that the prompt updates move in a semantically coherent direction.
- High-Quality Candidate Updates: Because AgentGrad targets the exact root cause of an error, its proposed prompt modifications are far more likely to pass validation checks, preventing wasted computation on bad prompt variants.
Key Results
- State-of-the-Art Accuracy: AgentGrad consistently outperformed strong optimization baselines like TextGrad and GEPA. With GPT-5-mini, it achieved an average improvement of +11.76 points over the no-optimization baseline.
- 2.5× Wall-Clock Speedup: AgentGrad cut optimization time significantly across the board. For instance, on HotpotQA, it finished optimization in 109 minutes compared to GEPA's 346 minutes (a 3.2× speedup).
- Better Generalization & Transferability: Prompts optimized by AgentGrad transferred significantly better to completely unseen datasets. For example, on 2WikiMultiHopQA, AgentGrad achieved a score of 51.22, outperforming the next-best baseline (GEPA) by over 6 points.
- Higher Validation Success: As shown in the ablation studies, combining Target Identification (TI) and Semantic Textual Gradient Abstraction (STGA) yielded a minibatch improvement ratio of 0.72, meaning nearly three-quarters of candidate updates successfully improved performance on their training subsets.
Limitations and Future Work
The authors note that hard failures—those that cannot be resolved even when hints are injected during sequential intervention—are currently excluded from the training round and revisited later. While this prevents the system from optimizing based on impossible tasks, future work could explore how to handle these deeply rooted, systemic failures more gracefully. Additionally, the framework relies on the availability of ground-truth data or clear constraints to construct the initial intervention hints.
Summary updated