Sequence Modeling for N-Agent Ad Hoc Teamwork

Caroline Wang, Di Yang Shi, Elad Liebman, Ishan Durugkar, Arrasy Rahman, Peter StonearXiv 2025 · DOI

Introduction

In Multi-Agent Reinforcement Learning (MARL), the challenge of N-Agent Ad Hoc Teamwork (NAHT) represents a critical frontier. Unlike standard cooperative MARL where a single entity controls all agents, or traditional Ad Hoc Teamwork (AHT) where one agent joins a pre-existing team, NAHT involves controlling a subteam of varying size that must collaborate with an unknown number of uncontrolled teammates. Previous approaches, such as POAM, relied on independent learning, which often fails to capture the intricate inter-agent dynamics necessary for high-level coordination.

The MAT-NAHT Architecture

To address these limitations, researchers proposed MAT-NAHT (Multi-Agent Transformer for NAHT). This architecture treats multi-agent coordination as a sequence modeling problem, leveraging the inherent flexibility of transformers to handle varying input lengths and complex dependencies.

The MAT-NAHT architecture features a Transformer History Encoder to process agent trajectories and an Autoregressive Action Decoder for coordinated decision-making.

The framework consists of two primary components:

  1. Transformer History Encoder: This module processes the current observations and a historical window of the last k timesteps for all controlled agents. By encoding this history, the model can implicitly identify the strategies of uncontrolled teammates and adapt accordingly.
  2. Autoregressive Action Decoder: Actions are generated sequentially, where each agent's decision is conditioned on the actions of preceding agents in the sequence. This ensures tight coordination within the controlled subteam.

The model utilizes masking to remain agnostic to the total number of agents, allowing it to scale seamlessly across different team compositions.

Experimental Results

The performance of MAT-NAHT was evaluated on the StarCraft Multi-Agent Challenge (SMAC) using the 3s vs 5z task. The controlled subteam was trained alongside a diverse pool of uncontrolled teammates generated by various MARL algorithms (VDN, IPPO, MAPPO, IQL, and QMIX).

Sample Efficiency and Performance

As shown in the training curves, MAT-NAHT demonstrates superior sample efficiency, reaching peak performance in less than half the time required by the centralized baseline (Cent Obs POAM). The transformer-based approach consistently achieves higher mean returns, suggesting that centralized sequence modeling is more effective than independent learning for capturing joint agent dynamics.

Generalization and the Role of History

A key strength of MAT-NAHT is its ability to generalize to "unseen" teammates—those with behaviors not encountered during training. Ablation studies highlighted that the inclusion of observation history is vital; without it, the model's ability to distinguish between teammate types vanishes, leading to a significant drop in performance.

Conclusion

MAT-NAHT demonstrates that viewing multi-agent coordination through the lens of sequence modeling provides a powerful framework for ad hoc teamwork. By utilizing a transformer architecture with historical context and autoregressive decoding, the system achieves state-of-the-art performance and robust generalization. Future research will explore extending the temporal memory of these agents using state-space models and testing the architecture across more diverse environments.

Summary updated

BibTeX
@misc{wang2025sequence,
  author = {Caroline Wang and Di Yang Shi and Elad Liebman and Ishan Durugkar and Arrasy Rahman and Peter Stone},
  title = {{Sequence Modeling for N-Agent Ad Hoc Teamwork}},
  year = {2025},
  eprint = {2506.05527},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.05527},
}
Figure