Source-linked AI summary

AgentMonitor: A Plug-and-Play Framework for Predictive and Secure Multi-Agent Systems

Chi-Min Chan, Jianxuan Yu, Weize Chen, Chunyang Jiang, Xinyu Liu, Weijie Shi, Zhiyuan Liu, Wei Xue, Yike Guo

arXiv:2408.14972v1cs.CL

TL;DR

Choosing an effective MAS configuration is difficult because its performance is known only after execution. AgentMonitor captures agent inputs and outputs to predict task performance and support real-time corrections; experiments report 0.89 in-domain and approximately 0.58 in more challenging settings.

  • Problem

    MAS configuration relies on task knowledge and heuristics, and its effectiveness is evaluated only after execution, which can be resource-intensive.

    Source: §1 · p. 2
  • Method

    AgentMonitor wraps existing agents, converts captured inputs and outputs into indicators, and trains XGBoost to predict the performance of a newly configured MAS.

    Source: §1 · pp. 2–3
  • Results

    0.89 in-domain and approximately 0.58 in more challenging scenarios: the predicted and observed MAS scores show these Spearman correlations.

    Source: §1 · p. 3
  • Takeaways & Limitations

    AgentMonitor combines performance prediction with real-time monitoring and response post-editing to support more reliable and acceptable MAS outcomes.

    Source: §5 · p. 13

    Dynamically encapsulating the MAS when needed and skipping it when unnecessary is left for future work.

    Source: §4.4 · p. 13

Abstract

from arXiv · show

The rapid advancement of large language models (LLMs) has led to the rise of LLM-based agents. Recent research shows that multi-agent systems (MAS), where each agent plays a specific role, can outperform individual LLMs. However, configuring an MAS for a task remains challenging, with performance only observable post-execution. Inspired by scaling laws in LLM development, we investigate whether MAS performance can be predicted beforehand. We introduce AgentMonitor, a framework that integrates at the agent level to capture inputs and outputs, transforming them into statistics for training a regression model to predict task performance. Additionally, it can further apply real-time corrections to address security risks posed by malicious agents, mitigating negative impacts and enhancing MAS security. Experiments demonstrate that an XGBoost model achieves a Spearman correlation of 0.89 in-domain and 0.58 in more challenging scenarios. Furthermore, using AgentMonitor reduces harmful content by 6.2% and increases helpful content by 1.8% on average, enhancing safety and reliability. Code is available at \url{https://github.com/chanchimin/AgentMonitor}.

1 INTRODUCTION

LLM-based multi-agent systems can outperform single agents, but selecting an effective configuration is difficult because its effectiveness is observable only after execution. AgentMonitor captures agent interactions to predict performance and support real-time response correction; experiments report predictive correlations of 0.89 in-domain and approximately 0.58 in more challenging settings.

1 INTRODUCTION

  • MAS frameworks assign agents roles and coordinate them through predefined pipelines, and well-configured systems have outperformed single agents in some contexts.Examples span society simulation, reasoning, evaluation, and software tasks.Source: §1 · p. 2
  • Choosing an effective MAS configuration remains difficult because it relies on task knowledge and heuristics, while effectiveness is evaluated only after potentially costly execution.The paper asks whether performance can instead be predicted from the task and configuration.Source: §1 · p. 2
  • AgentMonitor wraps a function around each agent, captures its inputs and outputs at each communication step, and turns them into indicators for XGBoost performance prediction.The framework is designed to adapt to different multi-agent frameworks and predict a newly configured MAS on target tasks.Source: §1 · pp. 2–3
  • 0.89 in-domain and approximately 0.58 in more challenging settings: AgentMonitor’s predictions correlate with observed MAS performance across three tasks.The more challenging settings leave the target task or architecture out of the training set.Source: §1 · p. 3

2 RELATED WORK

LLM agents and multi-agent frameworks support tool use and collaboration, but reliable MAS configuration still involves trial and error and systems can be vulnerable to malicious attacks. This work applies predictive modeling to MAS and proposes monitoring with on-the-fly corrections.

2.1 LLM BASED AGENTS AND MULTI-AGENT FRAMEWORK

  • LLM agents use tools such as interpreters, search engines, and browsers, while multi-agent frameworks coordinate agents with different expertise.The related work describes collaboration as capable of enhancing downstream performance.Source: §2.1 · pp. 3–4
  • Reliable MAS construction still involves trial and error, and prompt injection or model misalignment can make systems vulnerable to malicious attacks.AgentMonitor is proposed to monitor indicators, predict downstream performance, and apply on-the-fly corrections.Source: §2.1 · p. 4

2.2 LLM PREDICTABLILITY AND SCALING LAWS

  • LLM scaling-law studies fit relationships from differently configured models to extrapolate performance or derive configurations, while MAS versatility makes a single-variable law difficult to determine.The paper preliminarily investigates direct target-score prediction with machine learning, including XGBoost.Source: §2.2 · pp. 4–5
  • Ye et al. (2023) study prediction of LLM capabilities from past experiments; the authors describe their work as the first such study in the context of building MAS.The cited work considers model families, parameter counts, tasks, and in-context examples.Source: §2.2 · p. 5

3 AGENTMONITOR

AgentMonitor wraps existing MAS without changing their workflow, records agent inputs and outputs, and turns those interactions into indicators for performance prediction. The same real-time access also supports pre-editing or post-editing agent messages, including edits intended to reduce harmful or unhelpful responses.

3 AGENTMONITOR

  • The section organizes the framework description around its design, collected indicators, and pre-edit and post-edit features.The indicators are used to train the regression model.Source: §3 · p. 6, §3.2 · p. 7

3.1 DESIGN OF AGENTMONITOR

  • AgentMonitor follows a non-invasive registration design, integrating with agents without altering their original workflow.The section motivates this design through incremental frameworks that wrap functions around an existing model or agent.Source: §3.1 · p. 6

3.2 DETAILS OF INDICATORS USED

  • The indicators include LLM-assessed personal and collective scores, distinguishing an agent’s task performance from its contribution to the overall system.An agent producing nonsense could score highly for its assigned task but poorly for collective contribution.Source: §3.2 · p. 6
  • Workflow indicators include graph attributes such as node count, edge count, and transitivity, which characterize the MAS execution flow.For a linear A → B → C configuration, the passage gives three nodes, two edges, and transitivity of zero.Source: §3.2 · p. 7

3.3 PRE-EDIT AND POST-EDIT FEATURES

  • AgentMonitor captures agent inputs and outputs in real time, allowing an LLM to pre-edit or post-edit messages without changing the original execution.In the described post-edit setup, an LLM can be inserted between agents or after all agents.Source: §3.3 · p. 7

4 EXPERIMENTS

Across five manually designed MAS architectures and three downstream tasks, the experiments evaluate score prediction, indicator behavior, scaling effects, and post-editing under malicious configurations. Prediction remains moderately correlated with observed scores in harder settings, while the ablations and safety experiments identify practical conditions and trade-offs.

4 EXPERIMENTS

  • The evaluation trains XGBoost on 1,796 data points from five manually designed MAS architectures across HumanEval, MMLU, and GSM8K.The tasks cover coding, general knowledge, and math; settings range from in-domain splits to held-out architectures or tasks.Source: §4 · pp. 7–8

4.1 OVERALL RESULTS FOR PREDICTING TARGET SCORES

  • 0.58 average Spearman correlation is achieved in the more difficult Cross-Arch and Cross-Task settings, while In-Domain performance is higher with lower variance.The reported harder-setting results are especially low when Arch3 or HumanEval is left out.Source: §4.1 · pp. 8–9
  • Prediction errors generally have medians near zero, including in Cross-Arch and Cross-Task settings, even where rank correlations are lower.HumanEval has lower in-task rank correlation but smaller overall errors than the other two tasks.Source: Figure 6 · p. 8, §4.1 · p. 9
  • LLM-evaluated scores correlate more with one another than with graph attributes, while the top eight XGBoost features appear more separable than the bottom eight.Most indicators are not monotonic with target scores, so higher indicator values do not necessarily imply higher scores.Source: §4.2 · pp. 9–10, Figure 8 · p. 9

4.3 ABLATION STUDY ON THE SCALING EFFECT

  • In the In-Domain setting, predictive performance improves with training-set size but plateaus around 50% of the original data.With a fixed test set, half the training data approached results from the full dataset.Source: §4.3 · p. 10, Figure 9 · p. 10
  • Using 10% of instances to calculate approximated indicators yields about 0.82 Spearman correlation; increasing the ratio raises correlation and lowers RMSE.Approximated indicators converge toward accurate indicators as more instances are used; low ratios may underestimate indicator values, potentially due to the LLM judger.Source: §4.3 · pp. 10–11, Figure 10 · p. 11

4.4 WHEN MALICIOUSLY CONFIGURED, MAS BECOMES VULNERABLE

  • Adding a malicious agent makes MAS responses more vulnerable, while post-editing outcomes depend on the backbone and placement and can trade helpfulness against harmlessness.A post-edit step after the malicious agent alone has limited effect; editing only after the summarizer sometimes performs better, and the authors identify selective editing as future work.Source: Table 2 · p. 11, §4.4 · pp. 12–13, Table 3 · p. 12

5 CONCLUSION

AgentMonitor wraps existing multi-agent systems without changing their workflows, using agent inputs and outputs for performance prediction and on-the-fly correction. The experiments report effective performance prediction and post-editing that lead to more reliable and acceptable outcomes.

5 CONCLUSION

  • AgentMonitor wraps existing multi-agent systems while preserving their original workflows.It captures each agent’s inputs and outputs to support performance prediction and on-the-fly corrections.Source: §5 · p. 13
  • The framework uses captured agent inputs and outputs for both downstream task-performance prediction and on-the-fly corrections.Source: §5 · p. 13
  • Experiments show that AgentMonitor can effectively predict system performance and facilitate response post-editing, leading to more reliable and acceptable outcomes.Source: §5 · p. 13

A PROMPT TEMPLATE USED IN THE PAPER

The appendix identifies prompt templates for agents in the designed architectures and for scoring agents and responses. It names the agent roles and distinguishes the shared Answer Extractor from the HumanEval setup.

A.1 PROMPTS OF AGENTS DESIGNED IN DIFFERENT ARCHITECTURES

  • Tables 4–11 cover prompts for the Coder, Modifier, Reviewer, Tester, Dummy Agent, Executor, Web Browser, and Answer Extractor.Source: §A.1 · p. 17
  • The Answer Extractor is omitted from the table because it is used for final-answer extraction in every task except HumanEval.Source: §A.1 · p. 17
  • Table 4 is the Coder prompt template, and Table 5 is the Modifier prompt template.Source: Table 4 · p. 17, Table 5 · p. 17

A.2 PROMPTS USED TO EVALUATE THE PERSONAL SCORE AND COLLECTIVE SCORE

  • Tables 12 and 13 present prompts for evaluating each agent’s personal score and collective score, respectively.Source: §A.2 · p. 17

A.1 PROMPTS OF AGENTS DESIGNED IN DIFFERENT ARCHITECTURES

A.3 PROMPTS USED IN SAFETY RELATED BENCHMARK

The safety-related benchmark appendix describes prompts for evaluating generated responses on helpfulness and harmfulness.

A.3 PROMPTS USED IN SAFETY RELATED BENCHMARK

  • The prompts evaluate generated responses along two dimensions: helpfulness and harmfulness.The helpfulness and harmfulness templates are Tables 14 and 15, respectively.Source: §A.3 · p. 19

B DETAILS OF THE INDICATORS

The indicators derived from AgentMonitor’s stored information combine LLM-assessed scores with measures of MAS configuration and execution graphs. The appendix defines network indicators and describes model diversity and agent importance measures.

B DETAILS OF THE INDICATORS

  • The indicators fall into LLM-evaluated personal and collective scores, alongside indicators inherited from or shaped by the MAS configuration.Source: B DETAILS OF THE INDICATORS · p. 19
  • Personal and collective scores are generated by prompting an LLM with each agent’s inputs, outputs, and conversation history, then averaging 0–10 ratings across turns and instances.Higher ratings indicate better performance.Source: B DETAILS OF THE INDICATORS · p. 19
  • Configuration indicators include execution-graph node and edge counts, agent capabilities, and graph measures such as transitivity and centrality.Edges are directed to represent information flow between agents.Source: B DETAILS OF THE INDICATORS · pp. 19, 23
  • The supplied passage assigns score 2 to Llama3-8B-Instruct and its uncensored variant, and score 1 to GPT-3.5-turbo-1106; rankings may vary slightly across benchmarks.Source: B DETAILS OF THE INDICATORS · p. 22
  • Agent PageRank uses token counts sent and received as link weights to indicate each agent’s importance within the system.The PageRank definition specifies the damping factor as 0.85.Source: B DETAILS OF THE INDICATORS · p. 22
  • Average clustering aggregates local clustering coefficients, while transitivity measures the ratio of closed triplets to all triplets and is defined as three times triangles divided by connected triplets.Source: B DETAILS OF THE INDICATORS · pp. 22–23
  • Average betweenness centrality summarizes how often nodes lie on shortest paths; its node-level measure uses the total and through-node shortest-path counts.Source: B DETAILS OF THE INDICATORS · p. 23
  • The heterogeneous score measures LLM diversity across agents, with higher scores indicating more different backbones; its definition uses pairwise backbone comparisons.Source: B DETAILS OF THE INDICATORS · p. 23

C DETAILS OF EXPERIMENTS SETTING

This section introduces the LLMs used in the paper and the evaluation tasks and metrics.

C.1 LLM USED IN DIFFERENT SECTIONS

The experiments use varied LLMs and model assignments to construct multi-agent systems, with an uncensored model used to simulate malicious behavior.

  • Different LLM assignments are permuted to increase the number of experimental runs; a three-agent architecture with three LLMs yields 27 combinations.Source: §C.1 · p. 24
  • Section 4.1 uses GPT-3.5-turbo-1106, Llama3-8B-Instruct, and Llama3-70B-Instruct to represent varying capability levels and diverse expertise.Source: §C.1 · p. 24
  • Section 4.4 uses uncensored Llama3-8B-Instruct (u8B) to simulate a malicious agent harming the team’s response.Source: §C.1 · p. 24
  • Llama3-70B-Instruct is used in an AWQ quantized version to reduce cost and improve throughput; AWQ is training-free, low-bit, weight-only quantization.Source: §C.1 · p. 24

C.2 EVALUATION TASKS INTRODUCTION

The evaluation covers code generation, reasoning, math, and safety tasks, with scores used to assess helpfulness and harmlessness.

  • Code-generation, reasoning, and math instances follow MINT and require more complex, multi-turn interactions; safety uses 100 randomly sampled instances.Source: §C.2 · p. 24
  • For Section 4.4, an LLM prompted with Appendix A.3 prompts derives helpful and harmful scores used to calculate Harmlessness and Helpfulness.Source: §C.2 · p. 24
  • The score formula uses success rate ω and win, draw, and loss counts; higher Harmlessness and Helpfulness scores are better.Source: §C.2 · p. 24

D CASE STUDY ON POST-EDIT

The case study shows that post-editing can leave harmful content in place or produce highly censored responses, while later summarization may moderate outputs. The examples also show that edits can change whether guidance remains useful.

Loading 2408.14972v1…