Cooperation on the Fly: Exploring Language Agents for Ad Hoc Teamwork in the Avalon Game

Zijing Shi, Meng Fang, Shunfeng Zheng, Shilong Deng, Ling Chen, Yali DuarXiv 2023 · DOI

Abstract

This paper investigates Ad Hoc Teamwork (AHT)—the capacity for agents to collaborate with unfamiliar teammates without prior coordination—within the context of Large Language Models (LLMs). By introducing the AvalonPlay benchmark, based on the social deduction game The Resistance: Avalon, the authors evaluate the strategic reasoning of LLMs in deceptive environments. They propose CodeAct, a framework that utilizes Python-based executable reasoning and a specialized memory system to mitigate common LLM failures such as memory loss and logical hallucinations.

Introduction

Effective collaboration often occurs in "ad hoc" settings where agents must work with others whose roles, intentions, and strategies are unknown. In social deduction games like Avalon, this challenge is amplified by hidden identities and deliberate misinformation. "Just" players must identify "Evil" saboteurs through observation and deduction, while "Evil" players attempt to remain undetected. Standard LLMs often struggle in these scenarios, frequently succumbing to "memory forgetting" of early-game clues or "cascading hallucinations" that lead to strategic incoherence.

The AvalonPlay Benchmark

To study these dynamics, the researchers developed AvalonPlay, a language-based multi-agent platform. The environment simulates a seven-player game with six distinct roles: Merlin, Percival, and Loyal Servants (the "Just" side), and Morgana, the Assassin, and Minions (the "Evil" side).

The AvalonPlay environment overview, showing roles and the iterative game pipeline.

The game proceeds through five rounds of team selection, discussion, and quest execution. Success for the "Just" side requires passing three quests, while the "Evil" side wins if three quests fail or if the Assassin correctly identifies Merlin at the end of the game.

The CodeAct Framework

To address the limitations of traditional text-based prompting (like Chain-of-Thought), the authors introduced CodeAct. This framework shifts the agent's reasoning from purely semantic text to executable code.

The CodeAct framework, illustrating the integration of game history, code-driven reasoning, and self-debugging.

CodeAct consists of three core components:

  1. Dual-Memory System: The agent maintains a Global Memory for recent interactions and a Leader-Specific Memory that retrieves factual historical data to anchor reasoning.
  2. Code-driven Reasoning: Instead of generating natural language thoughts, the agent writes Python scripts to deduce roles. For instance, it might iterate through player combinations to find those consistent with known quest outcomes.
  3. Execution and Self-Debugging: The agent executes its code in a Python REPL. If errors occur, the agent uses the feedback to self-debug, ensuring the final strategic output is logically sound.

Experimental Results and Insights

The study compared CodeAct against standard prompting techniques using GPT-3.5, GPT-4, and LLaMA 2 (13B).

  • Performance Gains: CodeAct achieved a Team Selection Accuracy of 0.830, significantly higher than Chain-of-Thought (0.707). This translated to a "Just" side win rate of 63.3%, compared to 53.3% for standard methods.
  • Code as a Logic Anchor: Forcing reasoning into code reduces the "fuzziness" of natural language, providing a formal structure that minimizes logical contradictions.
  • The Communication Paradox: Interestingly, open discussion did not always help. In deceptive games, "Evil" agents use communication to spread misinformation, which can confuse even advanced models like GPT-4.
  • Model Capabilities: GPT-4 was the only model to show significant strategic adaptation over time. GPT-3.5 and LLaMA 2 often failed to adhere to basic game rules, highlighting the high reasoning bar required for AHT in complex environments.

Conclusion

CodeAct demonstrates that executable reasoning can significantly enhance the performance of LLM agents in ad hoc teamwork scenarios. While the framework excels in agent-only environments, future research is needed to explore human-agent interaction, where deception and unpredictability are even more pronounced. Improving real-time fact verification and autonomous communication strategies remains a priority for developing truly robust collaborative agents.

Summary updated

BibTeX
@misc{shi2023cooperation,
  author = {Zijing Shi and Meng Fang and Shunfeng Zheng and Shilong Deng and Ling Chen and Yali Du},
  title = {{Cooperation on the Fly: Exploring Language Agents for Ad Hoc Teamwork in the Avalon Game}},
  year = {2023},
  eprint = {2312.17515},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.17515},
}
Figure