Table of Contents
Fetching ...

HiveMind: Contribution-Guided Online Prompt Optimization of LLM Multi-Agent Systems

Yihan Xia, Taotao Wang, Shengli Zhang, Zhangyuhua Weng, Bin Cao, Soung Chang Liew

TL;DR

HiveMind tackles autonomous runtime optimization and fair credit assignment in LLM-based multi-agent systems. It introduces CG-OPO to refine underperforming agents' prompts guided by Shapley-based contributions, and DAG-Shapley to compute exact attributions efficiently by exploiting DAG workflow structure. The approach yields superior trading performance and substantial computational savings (over 80% fewer LLM calls) while maintaining attribution accuracy. Findings indicate robust real-time optimization potential in dynamic MAS, with practical impact in finance and other collaborative AI domains.

Abstract

Recent advances in LLM-based multi-agent systems have demonstrated remarkable capabilities in complex decision-making scenarios such as financial trading and software engineering. However, evaluating each individual agent's effectiveness and online optimization of underperforming agents remain open challenges. To address these issues, we present HiveMind, a self-adaptive framework designed to optimize LLM multi-agent collaboration through contribution analysis. At its core, HiveMind introduces Contribution-Guided Online Prompt Optimization (CG-OPO), which autonomously refines agent prompts based on their quantified contributions. We first propose the Shapley value as a grounded metric to quantify each agent's contribution, thereby identifying underperforming agents in a principled manner for automated prompt refinement. To overcome the computational complexity of the classical Shapley value, we present DAG-Shapley, a novel and efficient attribution algorithm that leverages the inherent Directed Acyclic Graph structure of the agent workflow to axiomatically prune non-viable coalitions. By hierarchically reusing intermediate outputs of agents in the DAG, our method further reduces redundant computations, and achieving substantial cost savings without compromising the theoretical guarantees of Shapley values. Evaluated in a multi-agent stock-trading scenario, HiveMind achieves superior performance compared to static baselines. Notably, DAG-Shapley reduces LLM calls by over 80\% while maintaining attribution accuracy comparable to full Shapley values, establishing a new standard for efficient credit assignment and enabling scalable, real-world optimization of multi-agent collaboration.

HiveMind: Contribution-Guided Online Prompt Optimization of LLM Multi-Agent Systems

TL;DR

HiveMind tackles autonomous runtime optimization and fair credit assignment in LLM-based multi-agent systems. It introduces CG-OPO to refine underperforming agents' prompts guided by Shapley-based contributions, and DAG-Shapley to compute exact attributions efficiently by exploiting DAG workflow structure. The approach yields superior trading performance and substantial computational savings (over 80% fewer LLM calls) while maintaining attribution accuracy. Findings indicate robust real-time optimization potential in dynamic MAS, with practical impact in finance and other collaborative AI domains.

Abstract

Recent advances in LLM-based multi-agent systems have demonstrated remarkable capabilities in complex decision-making scenarios such as financial trading and software engineering. However, evaluating each individual agent's effectiveness and online optimization of underperforming agents remain open challenges. To address these issues, we present HiveMind, a self-adaptive framework designed to optimize LLM multi-agent collaboration through contribution analysis. At its core, HiveMind introduces Contribution-Guided Online Prompt Optimization (CG-OPO), which autonomously refines agent prompts based on their quantified contributions. We first propose the Shapley value as a grounded metric to quantify each agent's contribution, thereby identifying underperforming agents in a principled manner for automated prompt refinement. To overcome the computational complexity of the classical Shapley value, we present DAG-Shapley, a novel and efficient attribution algorithm that leverages the inherent Directed Acyclic Graph structure of the agent workflow to axiomatically prune non-viable coalitions. By hierarchically reusing intermediate outputs of agents in the DAG, our method further reduces redundant computations, and achieving substantial cost savings without compromising the theoretical guarantees of Shapley values. Evaluated in a multi-agent stock-trading scenario, HiveMind achieves superior performance compared to static baselines. Notably, DAG-Shapley reduces LLM calls by over 80\% while maintaining attribution accuracy comparable to full Shapley values, establishing a new standard for efficient credit assignment and enabling scalable, real-world optimization of multi-agent collaboration.

Paper Structure

This paper contains 27 sections, 12 equations, 1 figure, 2 tables, 4 algorithms.

Figures (1)

  • Figure 1: Overall system architecture showing the closed-loop optimization cycle.