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

—

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

Yihan Xia
Taotao Wang
Shengli Zhang
Zhangyuhua Weng
Bin Cao
Soung Chang Liew
Published on 12/6/2025
Equities
Stocks
AI
LLM
Multi-Agent
Machine learning
Stock picking

HiveMind is a self-adaptive framework for optimizing LLM-based multi-agent systems through contribution-guided online prompt optimization. The core innovation is DAG-Shapley, an efficient algorithm that computes exact Shapley values by exploiting the Directed Acyclic Graph structure of agent workflows. DAG-Shapley prunes non-viable coalitions and reuses intermediate outputs via hierarchical memoization, reducing LLM calls by over 80% while maintaining attribution accuracy. The framework operates in a closed loop: it measures each agent's contribution using DAG-Shapley, identifies the bottleneck agent, extracts lessons from its successes and failures via a meta-optimizer, and refines its prompt accordingly. Evaluated in a multi-agent stock trading system with seven agents (news, technical, fundamental analysts; bullish, bearish, neutral outlook agents; and a trader), HiveMind significantly outperforms static multi-agent baselines and traditional strategies (MACD, SMA, Buy & Hold) across both bull and bear markets. It achieves higher returns and positive risk-adjusted performance in adverse conditions, demonstrating the effectiveness of autonomous, contribution-driven optimization for dynamic environments.

Highlights

  • 1Introduces HiveMind, a self-adaptive framework for LLM multi-agent systems that autonomously optimizes agent prompts via contribution analysis.
  • 2Proposes DAG-Shapley, an efficient algorithm leveraging DAG structure to compute Shapley values with over 80% reduction in LLM calls while maintaining exact attribution.
  • 3Demonstrates superior performance in multi-agent stock trading across bull and bear markets, outperforming static baselines and traditional strategies.
  • 4Provides a closed-loop optimization cycle combining contribution measurement, bottleneck identification, reflection, and prompt metamorphosis.

Methods

  • M
    Contribution-Guided Online Prompt Optimization (CG-OPO): a four-stage pipeline using Shapley values to identify underperforming agents and refine prompts via LLM-driven reflection.
  • M
    DAG-Shapley: a novel algorithm that prunes non-viable coalitions and uses hierarchical memoization to compute exact Shapley values efficiently in DAG-structured workflows.
  • M
    Multi-agent system modeled as a Directed Acyclic Graph (DAG) with three layers (analysis, outlook, decision) for structured information flow and credit assignment.

Results

  • R
    CG-OPO achieves up to 209% higher returns in bull markets (e.g., META: 13.72% vs 4.44% without CG-OPO) and maintains positive returns in bear markets where baselines fail.
  • R
    DAG-Shapley reduces coalition evaluations from 128 to 49 (61.7% reduction) and LLM calls from 448 to 73 (83.7% reduction) for a 7-agent system.
  • R
    DAG-Shapley produces identical contribution scores to classical Shapley, ensuring no loss of accuracy.
  • R
    CG-OPO limits losses in bear markets (e.g., NVDA: -21.81% vs -41.71% without CG-OPO) and outperforms technical indicators (MACD, SMA) and Buy & Hold across all stocks.
0/5

Analyze Paper

Generate insights from "HiveMind: Contribution-Guided Online Prompt Optimization of ...".

Suggested Actions