A Generalist Hanabi Agent

Arjun V Sudhakar, Hadi Nekoei, Mathieu Reymond, Miao Liu, Janarthanan Rajendran, Sarath Chandar

TL;DR

Researchers have developed R3D2, the first "generalist" agent for the cooperative card game Hanabi that can play across any player count (2 to 5) and successfully coordinate with unfamiliar AI partners. By replacing rigid bitstring observations with natural language and using a flexible neural architecture, the agent moves beyond specialized "2-player-only" models toward more human-like, adaptable cooperation.

What Problem Does This Paper Address?

In the world of Multi-Agent Reinforcement Learning (MARL), Hanabi is often considered the "final boss" of cooperation. It’s a game where you see everyone’s cards except your own, requiring players to hint, deduce, and build a "theory of mind" about their teammates.

The problem is that current state-of-the-art Hanabi AIs are incredibly brittle. They are usually trained for a specific setting (e.g., exactly 2 players) using "bitstrings"—long sequences of 1s and 0s representing the game state. If you change the number of players or pair the AI with a teammate that uses a different strategy, the bitstring representation collapses, and the agent fails. Humans don't have this problem; we use language and logic that scales. This paper aims to close that gap by creating an agent that generalizes across game configurations and novel partners.

Methods

The authors introduce Recurrent Replay Relevance Distributed DQN (R3D2). Its "secret sauce" consists of three main components:

  1. Text-based Reformulation: Instead of bitstrings, the game state and actions are converted into natural language (e.g., "Player 2 has a Red 5"). Language acts as a universal interface that stays consistent whether there are two players or five.
  2. The R3D2 Architecture:
    • Language Backbone: It uses a two-layer TinyBERT to encode text observations and actions into embeddings.
  3. Memory: An LSTM layer helps the agent remember previous turns, which is crucial for deducing hidden information in Hanabi.
  4. Dynamic Action Spaces: Most AIs have a fixed number of "output buttons." R3D2 uses a Deep Recurrent Relevance Network (DRRN) approach, calculating the "relevance" (a dot product) between the state embedding and various action embeddings. This allows it to handle a changing number of possible moves.
R3D2 Architecture using text observations and TinyBERT
  1. Variable-Player Learning: The agent is trained using a distributed RL regimen where it plays 2, 3, 4, and 5-player games concurrently, allowing it to transfer strategies from simple settings to complex ones.

Datasets and Baselines

The study primarily uses the Hanabi Learning Environment, a standard benchmark for cooperative AI. To test and fine-tune the language components, the authors utilized expert trajectories collected from Off-Belief Learning (OBL) agents, known for human-compatible strategies. They evaluated R3D2 against established algorithms like IQL, Other-Play (OP), and OBL to see how well it plays with "strangers" in Zero-Shot Coordination (ZSC) settings.

Key Insights and Ideas

  • Language as a Transfer Medium: The most striking insight is that text isn't just for humans. By using text, the agent implicitly handles game symmetries. For example, in a bitstring, "Red" and "Blue" are different indices; in text, the model learns the concept of a color, making it easier to generalize.
  • The "Generalist" Advantage: The multi-setting agent (R3D2-M) actually became more robust by training on different player counts. It learned "natural" coordination patterns that worked regardless of the team size.
  • LLMs Aren't Enough (Yet): In a fascinating side-experiment, the authors tested GPT-4 and a fine-tuned LLaMA-7B on Hanabi. Despite their language prowess, these models performed poorly (scoring ~3/25). This proves that while language is a great interface, the underlying "logic" of cooperation still requires specialized reinforcement learning.

Key Results

  • Cross-Setting Mastery: R3D2 is the first agent capable of playing all Hanabi settings (2-5 players) simultaneously without needing to be retrained.
  • Superior "Stranger" Coordination: In inter-algorithmic cross-play (playing with an AI of a completely different architecture), R3D2 significantly outperformed traditional bitstring-based agents. It achieved high scores with partners it had never encountered during training.
Cross-play evaluation heatmap showing R3D2's ability to coordinate with unfamiliar agents
  • Zero-Shot Generalization: R3D2 agents trained on 2-player games could "zero-shot" transfer to 3-player games with surprising effectiveness, a feat previously impossible for standard MARL agents.

Limitations and Future Work

While R3D2 is a leap forward, it has its hurdles:

  • Inference Latency: Using a transformer (even a tiny one like TinyBERT) inside an RL loop is computationally expensive. This makes training slower than using simple vectors.
  • Textual Bottlenecks: The authors found that including the "discard pile" in the text description doubled the sequence length without improving scores, suggesting that we still need better ways to summarize long histories in text.
  • Beyond Discrete Games: The current approach works well for card games, but adapting this to continuous environments (like robot coordination) remains an open challenge.

The researchers suggest that the next step is few-shot coordination, where an agent doesn't just play well with a stranger immediately but learns to adapt to that stranger's specific quirks over the course of a single game.

Summary updated

BibTeX
@inproceedings{sudhakar2025generalist,
  author = {Arjun V Sudhakar and Hadi Nekoei and Mathieu Reymond and Miao Liu and Janarthanan Rajendran and Sarath Chandar},
  title = {{A Generalist Hanabi Agent}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=pCj2sLNoJq},
}
Figure