MAPGD: Multi-Agent Prompt Gradient Descent for Collaborative Prompt Optimization

Yichen Han, Bojun Liu, Zhengpeng zhou, Guanyu Liu, Zeng Zhang, Yang Yang, Wenli Wang, Isaac N Shi, Yunyan, Lewei He, Tianyu ShiSEA @ NeurIPS 2025 · DOI

Introduction

Prompt engineering has long been considered a "dark art" of Large Language Model (LLM) development—a manual, time-consuming process highly sensitive to minor instructional changes. While automatic prompt optimizers have emerged, they frequently suffer from optimization instability. The core issue identified in recent research is that single-agent optimizers often receive "conflicting update signals." For instance, one error might suggest a prompt needs more detailed examples, while another suggests it should be more concise. A single-agent system attempting to reconcile these simultaneously often produces "entangled" instructions that confuse the model and waste the API budget.

The Challenge: Conflicting Update Signals

Specialized agents identifying conflicting optimization signals from model errors.

MAPGD (Multi-Agent Prompt Gradient Descent) addresses this by treating prompt refinement as a multi-vector optimization problem. Instead of viewing conflicting feedback as noise to be suppressed, MAPGD treats it as a signal that the optimization space is multi-dimensional. By disentangling these signals, the framework avoids the muddled instructions that typically plague automated prompt engineering.

The MAPGD Framework

MAPGD reformulates prompt optimization as a "hybrid discrete-continuous gradient descent" process. The workflow consists of several novel components designed to manage collaborative refinement:

The complete MAPGD architecture, including the overall workflow (a), conflict generation (b), and the core CAAW (c) and HCGC (d) mechanisms.
  1. Specialized Prompt Agents: Rather than a single general optimizer, MAPGD employs multiple agents with distinct roles, such as Instruction Specialist, Example Curator, and Format Designer. Each agent analyzes model errors and generates "textual pseudo-gradients"—specific suggestions for improvement from their unique perspective.
  2. Hypersphere-Constrained Gradient Clustering (HCGC): To resolve conflicts, the system embeds textual suggestions into a vector space and projects them onto a unit hypersphere. Using an angular margin constraint, it clusters similar ideas while separating incompatible ones. If two suggestions point in opposite semantic directions, they are treated as distinct refinement trajectories rather than being averaged into a confusing compromise.
  3. Channel-Adaptive Agent Weighting (CAAW): Recognizing that agent utility varies by task, CAAW tracks historical performance. If the Example Curator consistently drives accuracy gains on a specific dataset, its "gradient" receives higher weight in the final fusion process.
  4. Weight-Conditioned Fusion: An LLM fuses these weighted, clustered gradients into candidate prompts, which are then evaluated and selected via a bandit-based mechanism for the next iteration.

Experimental Evaluation

The authors evaluated MAPGD across classification tasks (Jailbreak, Ethos, LIAR, Sarcasm) and arithmetic reasoning benchmarks (GSM8k, AQUARAT, SVAMP).

  • Superior Accuracy: MAPGD consistently outperformed strong baselines like ProTeGi and PromptWizard. On the GSM8k reasoning task, it achieved 93.5% accuracy, a significant improvement over the 90.0% baseline.
  • Robustness to Conflict: On conflict-prone tasks like Jailbreak and LIAR, MAPGD saw its largest gains, reaching an F1 of 0.880 on Jailbreak compared to 0.833 for ProTeGi.
  • Token Efficiency: Despite the multi-agent overhead, MAPGD reduced per-iteration token costs by approximately 8% and improved "performance-per-token" by over 10% by avoiding redundant and noisy edits.

Key Insights and Theoretical Foundations

A significant contribution of this work is the theoretical proof that this discrete, natural language-based process follows a sublinear convergence rate of $O(1/\sqrt{T})$, mirroring classical stochastic gradient descent (SGD) in continuous mathematics. This bridges the gap between discrete prompt engineering and traditional optimization theory.

Furthermore, the results suggest that specialization beats generalization. By assigning specific roles like "Format Designer," the system ensures that structural improvements are preserved even when the optimization focus shifts toward content or logic.

Conclusion and Future Work

MAPGD demonstrates that treating prompt optimization as a collaborative, geometry-aware process significantly enhances performance and efficiency. While the system relies on the quality of semantic embeddings to detect conflicts, its ability to scale with agent specialization offers a robust path forward for automated prompt engineering. Future research may explore integrating external memory components or more complex agent interaction topologies to further refine the "prompt landscape" exploration.

Summary updated

BibTeX
@misc{han2025mapgd,
  author = {Yichen Han and Bojun Liu and Zhengpeng zhou and Guanyu Liu and Zeng Zhang and Yang Yang and Wenli Wang and Isaac N Shi and Yunyan and Lewei He and TIANYU SHI},
  title = {{MAPGD: Multi-Agent Prompt Gradient Descent for Collaborative Prompt Optimization}},
  year = {2025},
  eprint = {2509.11361},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.11361},
}
Figure