MAPF-GPT: Imitation Learning for Multi-Agent Pathfinding at Scale

Anton Andreychuk, Konstantin S. Yakovlev, Aleksandr Panov, Alexey Skrynnik

Introduction

Multi-Agent Pathfinding (MAPF) is a critical challenge in robotics and logistics, involving the coordination of multiple agents to reach their respective goals without collisions. As an NP-hard problem, finding optimal solutions scales poorly with the number of agents. Traditional search-based algorithms often struggle with real-time constraints in large-scale deployments. While Deep Reinforcement Learning (DRL) has emerged as a promising alternative, existing DRL solvers are frequently "brittle," requiring auxiliary modules such as inter-agent communication protocols or internal single-agent planners. Moreover, these models often fail to generalize to environments outside their training distribution.

In this work, we introduce MAPF-GPT, a transformer-based foundation model that addresses these limitations through large-scale decentralized imitation learning. By treating MAPF as a sequential decision-making problem and leveraging the "GPT philosophy" of scaling data and model capacity, MAPF-GPT achieves state-of-the-art performance and remarkable zero-shot generalization without relying on complex communication or planning "crutches."

The MAPF-GPT Framework

MAPF-GPT utilizes a decoder-only Transformer architecture to predict agent actions based on local observations. The core of the approach lies in its sophisticated tokenization and the use of a high-quality expert teacher.

Pipeline Overview

The training pipeline consists of four main stages: creating MAPF scenarios using POGEMA, generating ground truth data using the expert LaCAM solver, tokenizing egocentric observations, and the final training loop using cross-entropy loss.

Overview of the MAPF-GPT training pipeline, from scenario generation to the final training loop.

Tokenization and Architecture

To process spatial pathfinding data, we developed a custom vocabulary of 67 tokens. These tokens encode local observations (an $11 \times 11$ field-of-view), numerical "cost-to-go" heuristics, relative positions of neighboring agents, and "greedy action" suggestions. The model is a decoder-only Transformer that predicts the next action within a context window of 256 tokens. We evaluated three model scales: 2M, 6M, and 85M parameters.

Large-Scale Dataset Generation

A key contribution of this work is the creation of a massive MAPF dataset. We used LaCAM to generate expert trajectories for millions of problem instances, resulting in a dataset of 1 billion observation-action pairs. Training was conducted on 10,000 maze-like maps and 2,500 maps with random obstacles, providing a diverse foundation for learning complex coordination behaviors.

Experimental Evaluation

MAPF-GPT was evaluated on both in-distribution (Random, Mazes) and out-of-distribution (Warehouse, Cities-tiles) benchmarks.

Zero-Shot Generalization

One of the most significant findings is the model's ability to generalize to unseen environments. MAPF-GPT-85M consistently outperformed specialized RL solvers like DCC and SCRIMP on Warehouse and City maps, despite never seeing these structures during training. This suggests that large-scale imitation learning captures fundamental pathfinding principles that transcend specific map geometries.

Solution Quality and Efficiency

The quality of the solutions, measured by the Sum-of-Costs (SoC) ratio relative to the expert solver, demonstrates that MAPF-GPT produces highly efficient paths across various environments.

Comparison of Sum-of-Costs (SoC) ratios across different map types. MAPF-GPT models show superior performance and stability, especially in out-of-distribution scenarios.

Furthermore, MAPF-GPT is computationally efficient during inference. In scenarios with 192 agents, the 2M and 6M models were 8 to 13 times faster than competing learning-based methods, making them highly suitable for real-time deployment.

Conclusion

MAPF-GPT demonstrates that scaling imitation learning with a Transformer architecture can solve complex multi-agent coordination problems. By integrating classical heuristics as input tokens and training on a billion-scale dataset, the model achieves robust, decentralized pathfinding with exceptional generalization capabilities. Future work will focus on closing the performance gap in lifelong MAPF scenarios and improving coordination in extremely high-density environments.

Summary updated

BibTeX
@inproceedings{andreychuk2025mapf,
  author = {Anton Andreychuk and Konstantin S. Yakovlev and Aleksandr Panov and Alexey Skrynnik},
  title = {{MAPF-GPT: Imitation Learning for Multi-Agent Pathfinding at Scale}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i22.34477},
}
Figure