MADiff: Offline Multi-agent Learning with Diffusion Models

Zhengbang Zhu, Minghuan Liu, Liyuan Mao, Bingyi Kang, Minkai Xu, Yong Yu, Stefano Ermon, Weinan Zhang

TL;DR

MADiff is the first framework to bring the power of diffusion models to the complex world of offline multi-agent learning. By combining a U-Net backbone with a novel cross-agent attention mechanism, MADiff enables agents to coordinate effectively from static datasets, outperforming traditional Q-learning and sequence-modeling baselines across diverse tasks like robot control and sports trajectory prediction.

What Problem Does This Paper Address?

Offline Reinforcement Learning (RL) is like trying to learn how to drive a car just by watching hours of dashcam footage—you cannot experiment; you can only learn from what is already there. This is notoriously difficult because of extrapolation errors: if an agent tries an action not well-represented in the data, its value estimates can become highly inaccurate.

In Multi-Agent Learning (MAL), the difficulty spikes. Agents must not only master the environment but also coordinate with teammates. Existing approaches usually fall into two camps:

  1. Independent Models: Each agent has its own model. This is simple but often leads to a "failure to communicate," where agents act at cross-purposes because they cannot predict their teammates' behaviors.
  2. Concatenated Models: All agents' data is combined into one large vector. This is computationally expensive, scales poorly, and treats agents as a single entity, ignoring the natural symmetries and individualities of a multi-agent system.

Methods

MADiff tackles these issues by treating multi-agent coordination as a conditional generative modeling problem. Instead of learning a value function (like in Q-learning), it learns to generate high-reward state trajectories directly.

MADiff Architecture

The Architecture: U-Net + Attention

The core of MADiff is a U-Net-style diffusion model. While each agent has its own "pathway" through the network to maintain its identity, the authors introduce Attention Layers before every decoder block. These layers allow agents to "talk" to each other in the latent space. Because attention is index-free, the model does not care about the order of agents, preserving the natural symmetry of the system.

The Workflow

  1. Diffusion over States: Unlike some models that diffuse over state-action pairs, MADiff diffuses only over state trajectories. This makes the modeling task smoother and easier to learn.
  2. Inverse Dynamics: To actually move in the environment, MADiff uses a separate, small Inverse Dynamics Model that looks at the current state and the predicted next state to figure out which action to take.
  3. Classifier-Free Guidance: To ensure the agents aim for the best possible outcome, the model is conditioned on "Returns." During inference, it uses classifier-free guidance to steer the generation toward high-reward trajectories.

Key Insights and Ideas

  • Teammate Modeling for Free: One of the most elegant features of MADiff is that in decentralized execution, an agent does not just plan its own path; it generates a "hallucination" of what its teammates are likely to do. This internal simulation allows the agent to correct its own behavior in real-time to maintain coordination.
  • Attention is the Secret Sauce: Ablation studies showed that without the cross-agent attention layers, performance plummeted. The attention mechanism allows for dynamic, weighted interactions—an agent can focus more on the teammate it is currently interacting with.
  • States over Actions: By diffusing over state sequences rather than action sequences, the model avoids the "jitter" often found in multi-agent action data, leading to more stable and coherent long-term planning.

Key Results

The authors put MADiff through a gauntlet of benchmarks, including Multi-agent Particle Environments (MPE), Multi-Agent Mujoco, the StarCraft Multi-Agent Challenge (SMAC), and real-world NBA player trajectory prediction.

Performance across multi-agent benchmarks

MADiff consistently outperformed state-of-the-art offline MARL baselines (like OMAR and MA-CQL) and sequence models (like MADT).

  • Superior Coordination: In the Spread task, MADiff-D (the decentralized version) achieved scores nearly double those of independent diffusion models, proving that the attention mechanism is vital for teamwork.
  • Real-world Accuracy: On the NBA dataset, MADiff-C significantly outperformed Baller2Vec++ in trajectory prediction (ADE/FDE metrics), producing smoother and more realistic player movements.
  • Efficiency: Thanks to parameter sharing and GPU acceleration, the sampling time for MADiff remains relatively flat even as the number of agents increases, making it more scalable than autoregressive models.

Limitations and Future Work

While powerful, MADiff has two main hurdles:

  1. Scalability to "Crowds": Currently, each agent infers the trajectories of all other agents. While this works for 8 agents (like in SMAC 8m), it becomes computationally prohibitive for hundreds of agents. The authors suggest moving toward a "latent representation" of teammates in the future.
  2. Stochasticity: Like many sequence-modeling approaches, MADiff can struggle in environments with extremely high randomness. In these cases, traditional Q-learning methods that focus on conservative value estimation still hold an edge.

In summary, MADiff represents a major step forward in making generative models a viable, high-performance alternative for complex multi-agent coordination in the offline world.

Summary updated

BibTeX
@inproceedings{zhu2024madiff,
  author = {Zhengbang Zhu and Minghuan Liu and Liyuan Mao and Bingyi Kang and Minkai Xu and Yong Yu and Stefano Ermon and Weinan Zhang},
  title = {{MADiff: Offline Multi-agent Learning with Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=PvoxbjcRPT},
}
Figure