TAI BUI
Back to curriculum
LearnPython

MARL — MADDPG, QMIX, MAPPO

MARL is where multi-agent coordination was worked out before LLMs, and it still shapes how LLM-agent systems get built in 2026. **MADDPG** (Lowe et al., NeurIPS 2017, arXiv:1706.02275) introduced Centralized Training, Decentralized Execution (CTDE): each critic sees every agent's state and action during training, and at test time only the local actors run. It handles cooperative, competitive, and mixed settings. **QMIX** (Rashid et al., ICML 2018, arXiv:1803.11485) is value decomposition with a monotonic mixing network. Per-agent Qs combine into a joint Q, so the `argmax` splits cleanly across agents, and it dominated the StarCraft Multi-Agent Challenge (SMAC). **MAPPO** (Yu et al., NeurIPS 2022, arXiv:2103.01955) is PPO with a centralized value function, and it turned out to be surprisingly effective on particle-world, SMAC, Google Research Football, and Hanabi with minimal tuning. Together they underpin training policies for agent teams that have to act decentrally, and MAPPO is the default 2026 cooperative-MARL baseline. This lesson builds each idea on a small grid-world toy so the patterns stick before you touch LLM-agent training.

TIME: ~90 minutesPREREQUISITES: Phase 09 (Reinforcement Learning), Phase 16 · 09 (Parallel Swarm Networks)

Learning Objectives

  • Explain why independent RL is non-stationary in a multi-agent setting and how CTDE addresses it.
  • Describe how MADDPG's centralized critic, QMIX's monotonic mixing network, and MAPPO's centralized value function each use global information during training.
  • State the failure mode of each algorithm: MADDPG's critic growth with agent count, and QMIX's monotonicity limit.
  • Run the grid-world demo, read its 3.21 vs 2.73 steps-to-goal result, and say what it does and does not show.
  • Pick a starting MARL algorithm for a given cooperative task and justify the choice.

Problem

LLM-agent systems increasingly train policies for inter-agent coordination: when to defer, when to act, which peer to call. The literature on how to train those policies is Multi-Agent Reinforcement Learning (MARL), which predates the LLM wave and has a small set of dominant algorithms.

MARL papers are painful to read without the pattern vocabulary. Centralized training with decentralized execution (CTDE), value decomposition, and centralized critics are not buzzwords. Each one answers a specific problem:

  • Independent RL (each agent learns alone) is non-stationary from each agent's perspective, because the other agents keep changing underneath it.
  • Centralized RL (one agent controls the whole team) does not scale and breaks the execution constraint that each agent acts on local information.
  • CTDE splits the difference: train with global information, deploy with local policies.
Warm-up0/3
1. In single-agent RL, why can Q-learning assume the environment is stationary?Warm-up
One agent and one Environment box exchanging actions, states and rewards, shown at an early episode and a later episode, with nothing else present in the scene.
2. A swarm of parallel agents each acts only on its own local observation. What is the most direct coordination cost?Warm-up
Two robots far apart, each with a dashed local-sensing circle that does not reach the other robot, with two loose items (A near robot 1's circle, B between them) in the open field.
3. On a grid where you can only move up, down, left, or right, how many steps does it take to get from (0,0) to (2,3)?Warm-up
A 3 by 4 grid of cells with S marking the start cell (0,0) and G marking the target cell (2,3), and a note that only up, down, left and right moves are allowed.
Check: Problem0/4
1. What is multi-agent reinforcement learning (MARL)?Define
Three separate agent boxes, each with its own policy, all connected by arrows to one shared Environment box in the middle.
2. What is centralized training with decentralized execution (CTDE)?Define
Two boxes labelled Phase 1 and Phase 2, each marked with what can be used there as a question mark, with the same two agents drawn under each phase.
3. What is non-stationarity in multi-agent learning?Define
Two boxes feeding one combined environment box from agent 1's point of view: World physics, fixed grid rules, and Agent 2's policy, marked currently as a question mark.
4. Why is having one agent control the whole team a poor fit, and what does CTDE do about it?Explain
One controller box with an arrow down to each of six agent icons in a row, all of their actions chosen by that one controller.

Concept

Three environments the papers use

  • Particle World (multi-agent particle env). Simple 2D physics with cooperative and competitive tasks. MADDPG's original testbed.
  • StarCraft Multi-Agent Challenge (SMAC). Cooperative micro-management with partial observation. QMIX's testbed. Discrete actions, continuous states.
  • Google Research Football, Hanabi, MPE. MAPPO's benchmarks.

The environments differ in action and observation types, and each algorithm is picked to match.

MADDPG (2017): the CTDE pattern

Each agent i has an actor mu_i(o_i) that maps its own observation to an action. Each agent also has a critic Q_i(x, a_1, ..., a_n) that sees all observations and all actions during training. The actor is updated by policy gradient against the critic's evaluation.

actor update:    grad_theta_i J = E[grad_theta mu_i(o_i) * grad_a_i Q_i(x, a_1..n) at a_i=mu_i(o_i)]
critic update:   TD on Q_i(x, a_1..n) given next-state joint estimate

CTDE pays off because at training time you know everyone's actions, and using them reduces the variance of each critic. At deploy time each agent sees only o_i and calls mu_i(o_i).

The failure mode is scale. Critic input grows with the number of agents (it includes all actions), so MADDPG does not scale past roughly 10 agents without approximations.

QMIX (2018): value decomposition

QMIX is cooperative only. The joint value is a monotone function of the per-agent Q-values:

Q_tot(tau, a) = f(Q_1(tau_1, a_1), ..., Q_n(tau_n, a_n)),   df/dQ_i >= 0

Monotonicity means argmax_a Q_tot can be found by each agent choosing argmax_{a_i} Q_i independently, which is the decentralized execution property you need. At training time a mixing network produces Q_tot from the per-agent Qs.

QMIX wins on SMAC because cooperative StarCraft micro-management has homogeneous agents, local observations, and a global reward, which is a natural fit for value decomposition.

The monotonicity constraint is restrictive. Some tasks have reward structures that are not monotone decomposable (one agent sacrificing for the team), and extensions like QTRAN and QPLEX relax the constraint.

MAPPO (2022): the overlooked default

Multi-Agent PPO is PPO with a centralized value function. Each agent has its own policy, and the value functions (shared or per-agent) see the full state. Yu et al. benchmarked MAPPO against MADDPG, QMIX, and their extensions on five benchmarks and found:

  • MAPPO matches or beats off-policy MARL methods on particle-world, SMAC, Google Research Football, Hanabi, and MPE.
  • It needs minimal hyperparameter tuning.
  • Training is stable and reproducible across seeds.

The community underrated on-policy MARL until this paper. In 2026 MAPPO is the default baseline for cooperative MARL, and any new method must beat it.

Why LLM-agent engineers should care

There are three direct uses:

  1. Router training. A meta-agent chooses which sub-agent handles a task. That is a MARL problem with N decentralized sub-agents and one centralized router, and MAPPO fits.
  2. Role emergence. In generative-agent simulations, training agents to adopt complementary roles over time is a MARL problem in disguise. QMIX-style value decomposition pushes toward complementarity by construction.
  3. Multi-agent tool use. When agents share tools and compete for budget, training them via CTDE produces deployable local policies that respect resource constraints.

The practical caveat: in 2026 most production LLM-agent systems prompt their policies instead of training them. MARL enters when you have lots of interaction data, a clear reward signal, and the willingness to invest in training infrastructure.

CTDE as a design pattern beyond RL

Even without training, CTDE is a useful architectural pattern. During design, assume full team visibility. At runtime, enforce decentralized execution so each agent sees only o_i.

The pattern forces you to keep per-agent state explicit and to think about partial observability up front. Many production multi-agent systems silently assume shared state everywhere, and CTDE discipline catches that early.

The non-stationarity problem

When multiple agents learn at once, each agent's environment (which includes the other agents' policies) is non-stationary, and the classical single-agent RL proofs break. The three algorithms here each address it differently:

  • MADDPG: the global critic sees all actions, so its value estimate is stationary.
  • QMIX: value decomposition moves learning into a joint-Q space where optimality is well-defined.
  • MAPPO: the centralized value function dampens variance from other agents' policy changes.

In LLM-agent systems non-stationarity shows up as "my agent worked last month, and now that the upstream agent changed, mine misbehaves." Training with CTDE is the principled fix. Prompt-level fixes are faster but less durable.

What this lesson does not cover

Training actual networks is a Phase 09 topic. The code here uses scripted-policy versions that demonstrate the CTDE, value-decomposition, and centralized-value patterns without gradient updates. Get the patterns down first, then pick up a full MARL library (PyMARL, MARLlib, RLlib multi-agent).

Check: Concept0/18
1. In MADDPG, what does each agent's critic see during training that its actor never sees at execution time?Define
One agent's actor box reading o_1 and a separate critic box marked Q_1 with a question mark for its input, both connected to one Environment box, labelled training time.
2. What is QMIX?Define
A paper card (Rashid et al., ICML 2018) and a testbed card (SMAC), above three same-type unit icons on one team.
3. What is MAPPO?Define
A paper card (Yu et al., NeurIPS 2022) and a card with the paper's own phrase about PPO in cooperative MARL, above three agent icons on one cooperative task.
4. What does value decomposition mean in cooperative MARL?Define
Three candidate cards, team reward R, joint value Q_tot and raw state s, each with an arrow into a box asking which one value decomposition actually splits, marked with a question mark.
5. How do on-policy and off-policy methods differ, as in MAPPO versus DDPG?Define
Two source boxes, the current policy's fresh rollout data and a replay buffer of older data, both with arrows into a box asking which one a given training update reads from.
6. What is SMAC?Define
Three friendly unit icons each with a dashed local-sensing circle, facing three opposing unit icons across open ground.
7. What does QMIX's monotonicity constraint (df/dQ_i >= 0) buy it at execution time?Explain
A table of illustrative Q_1 and Q_2 values over 3 actions each, a card with the monotone mixing formula, and a note asking whether each agent can search its own actions alone or must search all 9 joint actions.
8. What kind of task exposes QMIX's main limitation?Explain
Two agent icons both feeding one shared team-reward box, with a note that QMIX's monotonicity rule does not hold for every reward structure.
9. How does MADDPG's critic deal with non-stationarity?Explain
Two cards showing agent 2's policy as version A at episode 50 and version B at episode 400, both feeding one box for agent 1's critic marked with whether it needs redefinition, left as a question mark.
10. How does MAPPO use global information, and what does that do for learning?Explain
Three agent policy boxes pi_1, pi_2 and pi_3, each acting on its own observation o_i, all feeding one value function box whose input is marked with a question mark.
11. What did Yu et al. find when benchmarking MAPPO against MADDPG, QMIX, and their extensions?Explain
A five-row table of benchmark names, particle-world, SMAC, Google Research Football, Hanabi and MPE, with the comparison column left as a question mark.
12. Why does MADDPG's critic design stop scaling past roughly 10 agents?Explain
A team-size axis from 0 to 30 agents with a dashed marker at about 10, labelled as the point past which the lesson says MADDPG needs approximations.
13. Why is CTDE useful as a design pattern even when nothing is trained?Explain
Three service boxes, A, B and C, with a card posing two separate questions, what the designer can assume during design versus what each service actually receives at runtime, the second left as a question mark.
14. Agent 1 has Q-values [1, 3] over two actions and agent 2 has [2, 0], with monotone mixing. What is the joint argmax of Q_tot?Apply
A two-row table of agent 1's Q-values 1 and 3 and agent 2's Q-values 2 and 0 over action indices 0 and 1, with a note that each agent's own best action makes up the joint best.
15. An agent worked last month. After an upstream agent was updated, it misbehaves with no change to its own code. Which MARL problem is this?Analyze
An upstream agent feeding your agent, with a timeline card: last month's version A worked fine, today's updated version B, your agent's code untouched, and the result marked with a question mark.
16. A MADDPG team trains fine with 5 agents but stalls with 30. What is the most likely cause?Analyze
Two panels showing the same MADDPG critic design with 5 agents, labelled trains fine, and with 30 agents (10 shown), labelled stalls.
17. You must train a router that picks one of N sub-agents per task, with each sub-agent acting only on its own input. Which setup fits?Design
One router box with arrows down to four sub-agent boxes, each sub-agent acting only on its own input, with a note that the router sees which task is which.
18. You are designing a research agent, a summarizer and a coder. Which use of CTDE as a design pattern fits?Design
Research agent, summarizer and coder boxes in a row with arrows between them, and a card posing what the designer can assume during design versus what each agent actually receives once it runs, the second left as a question mark.

Build It

code/main.py runs four scripted policies on a tiny 2-agent cooperative grid-world. No networks are trained.

  • Environment: 2 agents and 2 pellets on a 4x4 grid. Each pellet is collected when an agent steps onto it, and the episode ends when both are gone. The score is steps to goal.
  • run_independent: each agent heads for its own nearest pellet and ignores the other agent, so both often chase the same one. Baseline.
  • run_maddpg_style: a central assignment (the stand-in for the centralized critic) gives each agent a distinct pellet by minimizing total Manhattan distance, and each actor then steps toward its own target.
  • run_qmix_style: the same assignment framed as value decomposition, with a special case when one pellet remains.
  • run_mappo_style: calls the MADDPG-style runner directly, standing in for a centralized value function.

Each runner is benchmarked on the same 500 seeded episodes and reports average steps-to-goal.

Run:

python3 code/main.py

Expected output: the independent baseline averages 3.21 steps, and the three CTDE-style runners all average 2.73. The identical numbers are expected, since the scripted variants share one assignment rule. What the gap shows is the value of coordination, not a ranking of the algorithms.

Check: Build It0/6
1. What does the grid-world toy leave out about decentralized execution?Explain
A three-step flow: agents sense the state, a middle box marked with a question mark, then each agent steps toward its target, with a note asking what decides each agent's target.
2. What does main.py's output show, and why are the three CTDE-style numbers identical?Apply
A four-row table of runner names, independent, MADDPG-style, QMIX-style and MAPPO-style, each with the average steps-to-goal column left as a question mark.
3. Agent A is at (0,0), agent B at (3,3), pellet P at (0,1), pellet Q at (3,2). The central rule minimizes total Manhattan distance. Who goes where?Apply
A 4 by 4 grid marking agent A at (0,0), agent B at (3,3), pellet P at (0,1) and pellet Q at (3,2), with a card asking for the cost of each of the two possible assignments.
4. Agents start at (0,0) and (0,2), with pellets at (0,1) and (3,3). In run_independent, what happens at the start?Apply
A 4 by 4 grid with agent 1 at (0,0), agent 2 at (0,2), pellet P at (0,1) and pellet Q at (3,3), with a card asking each agent's nearest pellet, left as a question mark.
5. Over 500 seeded episodes, about how many total steps do the CTDE-style runners save versus the independent baseline (3.21 vs 2.73 average)?Apply
A two-bar chart of average steps to goal per episode, 3.21 for independent and 2.73 for the CTDE-style runners, with a note that 500 episodes were run for each.
6. A colleague sees 2.73 steps for all three CTDE-style runners and concludes MADDPG, QMIX and MAPPO perform equally. What is wrong?Analyze
A three-row table of identical 2.73 averages for MADDPG-style, QMIX-style and MAPPO-style, with a card stating a colleague's conclusion that equal averages mean the algorithms perform equally, and a question mark on whether that is valid.

Use It

outputs/skill-marl-picker.md is a skill that picks a MARL algorithm for a given multi-agent task. It weighs cooperative versus competitive, homogeneous versus heterogeneous, action-space type, scale, and reward signal.

Ship It

MARL in production is rare. When you do use it:

  • Start with MAPPO. The 2022 paper established it as the baseline, and reproducing it first saves weeks of chasing fancier methods.
  • Log each agent's observation and action stream. Debugging MARL without per-agent traces is close to impossible.
  • Separate training code from execution code. CTDE is a discipline, so make the execution path see only o_i.
  • Watch reward shaping. MARL is very sensitive to reward design. One coordination bug in the shaping and agents learn to exploit it, so run adversarial tests.
  • For LLM agents, try prompt-level policies first. Invest in MARL training only when interaction data, a reward signal, and infrastructure are present together.
Check: Ship It0/3
1. Trained agents score high but exploit a bug in the shaped team reward instead of cooperating. Which advice addresses this failure directly?Analyze
A rising shaped-team-reward training curve next to a card asking whether a team that scores high on it is actually cooperating or exploiting the shaping, left as a question mark.
Curve is illustrative.
2. You are training 40 homogeneous cooperative agents with local observations. The best outcome requires some agents to sacrifice reward for the team. Where do you start?Design
Ten of forty identical agent icons shown on a shared field, with a card stating the best outcome needs some agents to give up their own reward for the team.
3. Your team of LLM agents coordinates poorly. You have no logged interactions and no clear reward signal. What do you do first?Design
Three agent boxes in a row, above a table listing what MARL training needs, logged interaction data marked no, a clear reward signal marked no, and training infrastructure left as a question mark.
Author's Note

I'd run main.py first and read the output skeptically. It scores 500 seeded episodes per policy, and the independent baseline lands at 3.21 steps against 2.73 for the MADDPG, QMIX, and MAPPO styles. Those three numbers are identical because run_mappo_style just calls run_maddpg_style, and the QMIX runner reuses the same _assigned_targets rule. So the benchmark can't tell you which algorithm is better. It only shows what coordination is worth.

The function worth reading closely is _assigned_targets. It compares the two possible pellet assignments by total Manhattan distance and picks the cheaper one, which is the whole centralized-information step. After that, each agent moves with step_toward using only its own target. My bet is that once you see how little code the coordination takes here, the CTDE split between what you know while designing and what each agent acts on gets much easier to hold onto.

I'd also be honest about what the toy leaves out. Nothing here learns, and the runner computes the assignment centrally at each step, so decentralized execution is described in the docstrings but not enforced by the code. If you want the algorithms to actually differ, that means real networks and one of the libraries from the last section of the Concept.

Exercises

  1. Run code/main.py. Measure the steps-to-goal gap between independent and MAPPO-style agents. Does the gap grow or shrink on a 6x6 grid?
  2. Implement a competitive variant: two agents, one pellet, only the first to reach gets reward. Which pattern handles competition cleanly? MADDPG historically.
  3. Read MADDPG (arXiv:1706.02275) Section 3. Implement the exact critic update rule symbolically in pseudocode in your own words.
  4. Read MAPPO (arXiv:2103.01955). Why do the authors argue centralized value + PPO beats off-policy MARL on their benchmarks? List the three strongest claims.
  5. Apply CTDE as a design pattern to a hypothetical LLM-agent system (e.g., research agent + summarizer + coder). What is the joint information available at design time that is not available at runtime?

Key Terms

TermWhat people sayWhat it actually means
MARL"Multi-Agent RL"Reinforcement learning for multi-agent systems.
CTDE"Centralized Training, Decentralized Execution"Train with global info; deploy with local policies.
MADDPG"Multi-Agent DDPG"CTDE with per-agent critic seeing all observations + actions.
QMIX"Value decomposition"Monotonic mixing of per-agent Qs. Cooperative.
MAPPO"Multi-Agent PPO"PPO with centralized value function. 2026 default baseline.
Value decomposition"Sum of individual Qs"Joint Q represented as a monotone function of per-agent Qs.
Non-stationarity"Moving targets"Each agent's env changes as others learn. The core MARL problem.
On-policy / off-policy"Learn from current / replay"PPO is on-policy (MAPPO); DDPG and Q-learning are off-policy.
SMAC"StarCraft Multi-Agent Challenge"Cooperative micromanagement benchmark; QMIX's homegrown ground.

Further Reading

Code

Ships With