SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2024.findings-emnlp.407 · EMNLP Findings · 2024

MultiAgent Collaboration Attack: Investigating Adversarial Attacks in Large Language Model Collaborations via Debate

William Wang, Wenyue Hua, Xianjun Yang, Santa Uc, Barbara, Liangming Pan, Alfonso Amayuelas, Antonis Antoniades

Open in the Atlas

Code that ran

9 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 6 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2024.findings-emnlp.407.json · badge: /api/ran/2024.findings-emnlp.407.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
amayuelas/multi-agent-attack canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
is_equiv Ran
ran, violated the contract we drafted
amayuelas/multi-agent-attack/multiagent_debate/math_equivalence.py
code served (permissive licence) · get_code("4fa5d4203318fbad")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Setup code for is_equiv function

ARGS = {
    'str1': '\\frac{1}{2}',
    'str2': '0.5',
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
last_boxed_only_string Ran
ran; our contract draft was wrong, not the code
amayuelas/multi-agent-attack/multiagent_debate/math_parsing.py
code served (permissive licence) · get_code("0b14c648516c38a7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Analyzing the function: last_boxed_only_string
# The function takes a single parameter 'string' which is a string
# It searches for '\boxed' or '\fbox' in the string and extracts the boxed content
# The function uses string methods: rfind, len, indexing

ARGS = {
    "string": r"Some text before \boxed{answer here} and some text after"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/evaluate.py
code served (permissive licence) · get_code("5dca32fc2ac478d3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary file with JSONL content
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, 'test_data.jsonl')

# Write some sample JSONL data
with open(test_file, 'w') as f:
    f.write(json.dumps({'id': 1, 'text': 'hello'}) + '\n')
    f.write(json.dumps({'id': 2, 'text': 'world'}) + '\n')

# Construct the filename in the expected format (with at least one '/')
filename = f'{temp_dir}/test_data.jsonl'

ARGS = {
    'filename': filename
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_math Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/advers.py
code served (permissive licence) · get_code("0e8d4da901ba6fa7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def parse_math(text):
    pattern = '\\\\boxed\\{([^{}]*(?:\\{[^{}]*\\}[^{}]*)*)\\}'
    matches = re.findall(pattern, text)
    return matches[-1]

# Setup code to construct valid arguments
text_with_boxed = r"Some math here \boxed{x^2 + y^2} and more \boxed{a + b + c}"

ARGS = {
    "text": text_with_boxed
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_math Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/math_parsing.py
code served (permissive licence) · get_code("59bc31f77b362454")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

def last_boxed_only_string(string):
    idx = string.rfind('\\boxed')
    if idx < 0:
        idx = string.rfind('\\fbox')
        if idx < 0:
            return None
    i = idx
    right_brace_idx = None
    num_left_braces_open = 0
    while i < len(string):
        if string[i] == '{':
            num_left_braces_open += 1
        if string[i] == '}':
            num_left_braces_open -= 1
            if num_left_braces_open == 0:
                right_brace_idx = i
                break
        i += 1
    if right_brace_idx == None:
        retval = None
    else:
        retval = string[idx:right_brace_idx + 1]
    return retval

def remove_boxed(s):
    left = '\\boxed{'
    try:
        assert s[:len(left)] == left
        assert s[-1] == '}'
        return s[len(left):-1]
    except:
        return None

def parse_math(text):
    return remove_boxed(last_boxed_only_string(text))

# Setup: Create a valid string argument with LaTeX boxed content
test_text = "Here is some math: \\boxed{42}"

ARGS = {
    'text': test_text
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_mmlu Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/evaluate.py
code served (permissive licence) · get_code("ebf9d916bf955825")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def parse_mmlu(text, task_info):
    pattern = '\\((\\w+)\\)|(\\w+)\\)'
    matches = re.findall(pattern, text)
    matches = [match[0] or match[1] for match in matches]
    solution_by_re = None
    for match_str in matches[::-1]:
        solution_by_re = match_str.upper()
        if solution_by_re >= 'A' and solution_by_re <= 'D':
            break
        else:
            solution_by_re = None
    solution_by_item = [-1, -1, -1, -1]
    idx = 0
    for item in task_info[1:-1]:
        pos = text.lower().rfind(item.lower().strip())
        if pos >= 0:
            solution_by_item[idx] = pos
        idx += 1
    if max(solution_by_item) == -1:
        solution_by_item = None
    else:
        solution_by_item = ['A', 'B', 'C', 'D'][solution_by_item.index(max(solution_by_item))]
    if solution_by_item is None and solution_by_re is not None:
        return solution_by_re
    elif solution_by_item is not None and solution_by_re is None:
        return solution_by_item
    elif solution_by_item is None and solution_by_re is None:
        return None
    elif solution_by_item is not None and solution_by_re is not None:
        if solution_by_item == solution_by_re:
            return solution_by_item
        else:
            return solution_by_item


# Setup code
text = "The correct answer is (B). Option A is incorrect, option B is correct, option C is wrong, and (D) is also incorrect."

task_info = [
    "Question",
    "A) Option A description",
    "B) Option B description",
    "C) Option C description",
    "D) Option D description",
    "Explanation"
]

ARGS = {
    "text": text,
    "task_info": task_info
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
query_hf_model Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/commons.py
code served (permissive licence) · get_code("68dde5ad75a618e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Stand-in tokenizer class
class StandInTokenizer:
    def __init__(self):
        self.eos_token_id = 2
        self.pad_token_id = 0
    
    def apply_chat_template(self, agent_context, add_generation_prompt=False, return_tensors=None):
        # Return a small tensor of input_ids
        input_ids = torch.tensor([[101, 2054, 2003, 2009, 102]], dtype=torch.long)
        return input_ids
    
    def convert_tokens_to_ids(self, token):
        # Return a dummy token id for special tokens
        return 128001
    
    def decode(self, token_ids, skip_special_tokens=False):
        return "This is a generated response from the model."


# Stand-in model class
class StandInModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.name_or_path = "meta-llama/Llama-2-7b"
        self.device = torch.device('cpu')
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, max_new_tokens=1000, eos_token_id=None, do_sample=False):
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        # Generate a sequence of tokens: original + some new tokens
        new_tokens = torch.randint(0, 100, (batch_size, 20), dtype=torch.long)
        output_ids = torch.cat([input_ids, new_tokens], dim=1)
        return output_ids


# Agent context (list of dicts for chat template)
agent_context = [
    {"role": "user", "content": "What is the meaning of life?"},
    {"role": "assistant", "content": ""}
]

# Construct ARGS
ARGS = {
    "model": StandInModel(),
    "tokenizer": StandInTokenizer(),
    "agent_context": agent_context
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
query_model Ran
ran on a synthesized input
amayuelas/multi-agent-attack/multiagent_debate/commons.py
code served (permissive licence) · get_code("1730bf85e8c595b0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock, MagicMock

# Create a mock OpenAI client with the expected interface
client = Mock()

# Mock the chat.completions.create method
mock_completion = Mock()
mock_message = Mock()
mock_message.content = "This is a mock response from the model"
mock_choice = Mock()
mock_choice.message = mock_message
mock_completion.choices = [mock_choice]
client.chat.completions.create = Mock(return_value=mock_completion)

# Create agent_context as a list of message dicts (expected by OpenAI API)
agent_context = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "What is the capital of France?"}
]

# Define the model_name parameter
model_name = 'gpt-3.5-turbo-0125'

# Construct the ARGS dictionary
ARGS = {
    'client': client,
    'agent_context': agent_context,
    'model_name': model_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_boxed Ran
ran; our contract draft was wrong, not the code
amayuelas/multi-agent-attack/multiagent_debate/math_parsing.py
code served (permissive licence) · get_code("f3bbe264b05aadd3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Analyze the function
# remove_boxed(s) takes a string parameter 's'
# It checks if the string starts with '\boxed{' and ends with '}'
# If so, it returns the content between them
# Otherwise it returns None

# Create test cases for the ARGS dict
ARGS = {
    "s": "\\boxed{answer}"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_dataset Not yet run
unverified (harvested, no recorded run)
amayuelas/multi-agent-attack/multiagent_debate/dataloader.py
code served (permissive licence) · get_code("ddc1c7e01b4d6316")
How it ran

no invocation recorded.

load_model_tokenizer Not yet run
unverified (harvested, no recorded run)
amayuelas/multi-agent-attack/multiagent_debate/commons.py
code served (permissive licence) · get_code("71cb68d1cfb69511")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 3 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
remove_boxed 20 other papers
5 dated earlier, 6 later, 9 same year, order not determinable · 1 only as an assembly brick
2103.03874 (2021-03)
Measuring Mathematical Problem Solving With the MATH Dataset
2309.06275 (2023-09)
Re-Reading Improves Reasoning in Large Language Models
2309.12284 (2023-09)
MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models
and 17 more not named here
last_boxed_only_string 17 other papers
2 dated earlier, 8 later, 7 same year, order not determinable
2309.06275 (2023-09)
Re-Reading Improves Reasoning in Large Language Models
2310.05914 (2023-10)
NEFTune: Noisy Embeddings Improve Instruction Finetuning
2404.02078 (2024-04)
Advancing LLM Reasoning Generalists with Preference Trees
and 14 more not named here
is_equiv 11 other papers
2 dated earlier, 5 later, 4 same year, order not determinable
2310.05914 (2023-10)
NEFTune: Noisy Embeddings Improve Instruction Finetuning
2310.09168 (2023-10)
EXPLORE-INSTRUCT: Enhancing Domain-Specific Instruction Coverage through Active Exploration
2402.05120 (2024-02)
More Agents Is All You Need
and 8 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) have shown exceptional results on current benchmarks when working individually. The advancement in their capabilities, along with a reduction in parameter size and inference times, has facilitated the use of these models as agents, enabling interactions among multiple models to execute complex tasks. Such collaborations offer several advantages, including the use of specialized models (e.g. coding), improved confidence through multiple computations, and enhanced divergent thinking, leading to more diverse outputs. Thus, the collaborative use of language models is expected to grow significantly in the coming years. In this work, we evaluate the behavior of a network of models collaborating through debate under the influence of an adversary. We introduce pertinent metrics to assess the adversary's effectiveness, focusing on system accuracy and model agreement. Our findings highlight the importance of a model's persuasive ability in influencing others. Additionally, we explore inference-time methods to generate more compelling arguments and evaluate the potential of promptbased mitigation as a defensive strategy.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2024.findings-emnlp.407")
get_code_for_paper("2024.findings-emnlp.407")
have("2024.findings-emnlp.407")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2024.findings-emnlp.407.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2024.findings-emnlp.407.svg)](https://syntology.ai/paper/2024.findings-emnlp.407)

Connect an agent — have() is free.