Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

Multi-Agent Policy Gradients: COMA, MADDPG & MAPPO

Centralized critics, counterfactual baselines and the surprising strength of PPO.

Give each agent its own policy and follow the gradient of the team's return, and two problems appear at once: each agent's gradient estimate drowns in the noise of everyone else's random actions, and improvements made by different agents at the same time can cancel out. Centralized critics, counterfactual baselines and sequential trust-region updates are the answers. This lesson derives them, proves that COMA's baseline leaves the gradient unbiased, asks what made plain PPO so strong, and proves the advantage decomposition behind the improvement guarantee of HATRPO and HAPPO.

What you’ll learn

  • Write the policy gradient of decentralized policies, and compute how rarely a naive estimate carries signal as the number of agents grows.
  • Derive COMA's counterfactual advantage, prove that its baseline keeps the gradient unbiased, and state what partial observability requires of the critic.
  • Explain MADDPG's per-agent centralized critics for mixed cooperative–competitive games, and what is known about when centralized critics help.
  • Describe MAPPO's and IPPO's implementation findings, and what they do and do not show.
  • Prove the multi-agent advantage decomposition, and use it to explain why sequential updates improve the joint policy where simultaneous ones can fail.

The multi-agent policy gradient

Each agent ii has a policy πθi(ai∣τi)\pi_{\theta_i}(a_i\mid\tau_i) on its own history, and in decentralized execution the agents randomize independently given their histories, so the joint policy factorizes and log⁡π(a∣τ)=∑ilog⁡πθi(ai∣τi)\log\pi(\mathbf a\mid\boldsymbol\tau)=\sum_i\log\pi_{\theta_i}(a_i\mid\tau_i). The policy gradient theorem (The Policy Gradient Theorem & REINFORCE) applied to the joint policy then splits into one gradient per agent, each using the team's action value:

∇θiJ(θ)=Eπ[∑tγt ∇θilog⁡πθi(Ati∣τti) Qπ(Ht,At)]\nabla_{\theta_i}J(\boldsymbol\theta)=\E_{\pi}\Big[\sum_t\gamma^t\,\nabla_{\theta_i}\log\pi_{\theta_i}\big(A^i_t\mid\tau^i_t\big)\,Q^{\pi}\big(H_t,\mathbf A_t\big)\Big]
HtH_t stands for everything the expected return depends on, the state and all agents' histories; in a fully observed problem it is the state. Replacing QπQ^\pi by the sampled return gives independent REINFORCE, which treats teammates' random actions as noise in each agent's signal.
DerivationHow rarely a naive estimate carries signal
  1. Pr⁡(g^i≠0)=Pr⁡(a1=⋯=aN)=2⋅2−N=21−N\Pr\big(\hat g_i\ne0\big)=\Pr(a_1=\dots=a_N)=2\cdot2^{-N}=2^{1-N}

    Lowe et al. (2017) use a stark example to argue for centralized critics. NN agents choose binary actions with Pr⁡(ai=1)=θi\Pr(a_i=1)=\theta_i, and the team receives 1 only if all agents choose the same action. Near the uninformed start θi=12\theta_i=\tfrac12, a single-sample REINFORCE estimate R ∇θilog⁡πθi(ai)R\,\nabla_{\theta_i}\log\pi_{\theta_i}(a_i) is non-zero only when the reward is, that is, when all actions agree:

  2. With 10 agents, fewer than 0.2% of samples carry any signal; with 20, about two in a million. The difficulty is not the gradient, which a centralized critic can estimate from all the samples it sees, but the Monte Carlo estimate that conditions each agent's update on the team's sparse outcome.

A centralized critic Qϕ(s,a)Q_\phi(s,\mathbf a), trained by TD on the shared reward with access to the state and the joint action, replaces the sampled return. Given the joint action, transitions and rewards no longer depend on anyone's policy, so the critic's regression targets are far more stable than those an independent learner sees; only the next actions in its bootstrap target move with the policies. A careful analysis tempers the usual story, though. Lyu, Xiao, Daley & Amato (2021) prove that, with critics that have converged and the same policy parameterization, centralized and decentralized critics give the same expected policy gradient, and the centralized critic's gradient variance is at least as large along every dimension. The case for centralized critics is therefore about learning the critic, not about the variance of the policy gradient it produces.

COMA: the counterfactual baseline

DerivationThe counterfactual baseline leaves the gradient unbiased
  1. Write the subtracted term as a baseline bi(s,τ,a−i)=∑ai′πi(ai′∣τi)Q(s,(a−i,ai′))b_i(s,\boldsymbol\tau,\mathbf a_{-i})=\sum_{a_i'}\pi_i(a_i'\mid\tau_i)Q\big(s,(\mathbf a_{-i},a_i')\big). It depends on the state, the histories and the teammates' actions, but not on aia_i.

  2. Eai∼πi(⋅∣τi)[∇θilog⁡πi(ai∣τi) bi]=bi∑ai∇θiπi(ai∣τi)=bi ∇θi∑aiπi(ai∣τi)=bi ∇θi1=0\E_{a_i\sim\pi_i(\cdot\mid\tau_i)}\big[\nabla_{\theta_i}\log\pi_i(a_i\mid\tau_i)\,b_i\big]=b_i\sum_{a_i}\nabla_{\theta_i}\pi_i(a_i\mid\tau_i)=b_i\,\nabla_{\theta_i}\sum_{a_i}\pi_i(a_i\mid\tau_i)=b_i\,\nabla_{\theta_i}1=0

    Condition on everything except aia_i. Under decentralized execution ai∼πi(⋅∣τi)a_i\sim\pi_i(\cdot\mid\tau_i) independently of a−i\mathbf a_{-i}, so the baseline comes out of the expectation, and the score function averages to zero:

  3. E[∇θilog⁡πi(ai∣τi) Ai(s,a)]=E[∇θilog⁡πi(ai∣τi) Q(s,a)]\E\big[\nabla_{\theta_i}\log\pi_i(a_i\mid\tau_i)\,A_i(s,\mathbf a)\big]=\E\big[\nabla_{\theta_i}\log\pi_i(a_i\mid\tau_i)\,Q(s,\mathbf a)\big]

    Hence replacing QQ by Ai=Q−biA_i=Q-b_i changes the variance of the estimate but not its mean. Two conditions were used: agents randomize independently given their histories (no shared randomness within a step), and the baseline ignores aia_i. A baseline that used aia_i, such as Q(s,a)Q(s,\mathbf a) itself, would bias the gradient.

Unbiased relative to the gradient computed from QQ is not the same as unbiased for the true gradient: that also needs QQ to be the right action value. Under partial observability the return depends on what each agent has seen, not only on the state, and a 2024 erratum to the arXiv version of the COMA paper notes that its convergence argument needs a critic that conditions on the joint history as well as the state. COMA was evaluated on decentralized StarCraft micromanagement with limited fields of view, a precursor of SMAC.

Check your understanding

Which of these baselines would bias agent ii's policy gradient?

  1. ∑ai′πi(ai′∣τi) Q(s,(a−i,ai′))\sum_{a_i'}\pi_i(a_i'\mid\tau_i)\,Q\big(s,(\mathbf a_{-i},a_i')\big)
  2. V(s)V(s), a learned state value
  3. Q(s,(a−i,ai))Q\big(s,(\mathbf a_{-i},a_i)\big), the critic's value of the joint action actually taken
  4. A running average of past team returns
Show the answer

C. Q(s,(a−i,ai))Q\big(s,(\mathbf a_{-i},a_i)\big), the critic's value of the joint action actually taken

A baseline is harmless only if it does not depend on agent ii's own action, so that it factors out of Eai[∇log⁡πi(ai∣τi) b]\E_{a_i}[\nabla\log\pi_i(a_i\mid\tau_i)\,b]. The value of the joint action taken depends on aia_i; subtracting it would cancel the very signal the gradient needs.

MADDPG: centralized critics for mixed games

MADDPG (Lowe, Wu, Tamar, Harb, Abbeel & Mordatch, 2017) extends DDPG (Deterministic Policy Gradients: DDPG & TD3) to many agents. Each agent has a deterministic actor μθi(oi)\mu_{\theta_i}(o_i) on its own observation and its own centralized critic Qi(x,a1,…,aN)Q_i(x,a_1,\dots,a_N), where xx collects the information available in training (for instance all observations). Because each critic is trained on its own agent's reward, the method applies to competitive and mixed settings as well as to teams. The actor follows the deterministic policy gradient through its critic:

∇θiJi=E[∇θiμθi(oi) ∇aiQi(x,a1,…,aN)∣ai=μθi(oi)],yi=ri+γ Qi′(x′,μ1′(o1′),…,μN′(oN′))\nabla_{\theta_i}J_i=\E\Big[\nabla_{\theta_i}\mu_{\theta_i}(o_i)\,\nabla_{a_i}Q_i(x,a_1,\dots,a_N)\big|_{a_i=\mu_{\theta_i}(o_i)}\Big],\qquad y_i=r_i+\gamma\,Q_i'\big(x',\mu_1'(o_1'),\dots,\mu_N'(o_N')\big)
The critic's target uses all agents' target actors. When other agents' policies are unknown, MADDPG fits approximations of them from their observed actions; to stay robust to opponents that change, each agent can train an ensemble of policies and use one at random per episode. Experiments were on the multi-agent particle environments: cooperative communication, predator–prey, and deception games.

In competitive and mixed games, centralized critics do not make the learning problem stationary for the actors, who still chase each other; they make the critic's regression well posed. The questions of Learning Dynamics in Games, cycling and convergence to equilibria, remain, which is why MADDPG adds ensembles and why later work on self-play and populations (Self-Play & Populations) matters for mixed settings.

MAPPO and IPPO: the strength of plain PPO

MAPPO is PPO (PPO: Clipping & the Details That Matter) with decentralized actors, usually sharing parameters, and a centralized value function used to compute advantages. Yu, Velu, Vinitsky, Gao, Wang, Bayen & Wu (2022) found it competitive with or better than the off-policy methods designed for cooperative MARL on the multi-agent particle environments, SMAC, Google Research Football and Hanabi, with little hyperparameter tuning, provided five implementation choices are made well:

  1. Normalize the value targets (they use PopArt) to stabilize value learning.
  2. Give the value function both global and agent-specific features, such as an agent-specific global state, rather than the bare global state or a concatenation of all observations.
  3. Reuse data sparingly: at most about 10 epochs on hard tasks and 15 on easy ones, and avoid splitting the batch into mini-batches.
  4. Keep the clipping parameter below 0.2.
  5. Use large batches.

They also replace the value input of agents that have died with a zero state containing only the agent's ID (death masking). Earlier, Schroeder de Witt et al. (2020) had reported that fully independent PPO (IPPO), with no centralized component at all, matched or beat QMIX and MAPPO on several hard SMAC maps.

Check your understanding

Independent PPO matched QMIX and MAPPO on several hard SMAC maps. Which conclusion is warranted?

  1. Centralized training is never needed in cooperative MARL
  2. On those tasks, independent on-policy learning with a careful implementation was competitive, which makes it a necessary baseline
  3. Value factorization is incorrect
  4. Non-stationarity does not occur with PPO
Show the answer

B. On those tasks, independent on-policy learning with a careful implementation was competitive, which makes it a necessary baseline

A result on particular benchmarks supports a claim about those benchmarks and makes the simple method a baseline to beat. Tasks that require tight coordination, such as the climbing game or Hanabi's conventions, can still defeat independent learners.

Sequential trust regions: HATRPO and HAPPO

Single-agent TRPO guarantees improvement because each update stays in a trust region where the surrogate objective is accurate (TRPO & Monotonic Improvement). With several agents updating at once, each agent's surrogate assumes that the others keep their old policies, and the guarantee breaks. A two-agent team shows how: the team earns 0 for (A, A), 2 for (A, B) or (B, A), and 1 for (B, B). Both agents currently play B. Each sees that switching to A, against its teammate's B, raises the reward from 1 to 2, so each switches, and the team lands on (A, A), worth 0.

DerivationMulti-agent advantage decomposition (Kuba et al., 2022, Lemma 1)
  1. Aij(s,ai1:j−1,aij)=Qi1:j(s,ai1:j)−Qi1:j−1(s,ai1:j−1)A^{i_j}\big(s,\mathbf a^{i_{1:j-1}},a^{i_j}\big)=Q^{i_{1:j}}\big(s,\mathbf a^{i_{1:j}}\big)-Q^{i_{1:j-1}}\big(s,\mathbf a^{i_{1:j-1}}\big)

    For an ordered list of agents i1,…,imi_1,\dots,i_m let Qi1:m(s,ai1:m)Q^{i_{1:m}}(s,\mathbf a^{i_{1:m}}) be the joint action value with the remaining agents' actions averaged over their current policies, so that Q∅=VπQ^{\varnothing}=V^\pi, and define the advantage of agent iji_j given the actions of the agents before it:

  2. Ai1:m(s,ai1:m)=Qi1:m(s,ai1:m)−Vπ(s)=∑j=1m[Qi1:j−Qi1:j−1]=∑j=1mAij(s,ai1:j−1,aij)■A^{i_{1:m}}\big(s,\mathbf a^{i_{1:m}}\big)=Q^{i_{1:m}}\big(s,\mathbf a^{i_{1:m}}\big)-V^\pi(s)=\sum_{j=1}^m\Big[Q^{i_{1:j}}-Q^{i_{1:j-1}}\Big]=\sum_{j=1}^mA^{i_j}\big(s,\mathbf a^{i_{1:j-1}},a^{i_j}\big)\qquad\blacksquare

    The joint advantage of the first mm agents telescopes into these conditional advantages:

  3. So the team improves if every agent, in turn, picks a policy with nonnegative expected conditional advantage given the already updated policies of the agents before it. In the example: the first agent switches to A (joint value 2); the second, given A, sees A2(s,A,A)=0−2<0A^{2}(s,\mathrm A,\mathrm A)=0-2<0 and stays with B. The team ends at 2.

Predict before you look

In the example above (0 for (A, A), 2 for a mismatch, 1 for (B, B)), suppose both agents must use the same stochastic policy, playing A with probability pp, with no agent ID to tell them apart. What is the best expected team reward? (Separate policies can earn 2.)

Show the answer

1.33

The expected reward is 2⋅2p(1−p)+(1−p)2=1+2p−3p22\cdot2p(1-p)+(1-p)^2=1+2p-3p^2, maximized at p=13p=\tfrac13 with value 43≈1.33\tfrac43\approx1.33. Identical policies cannot reliably produce the asymmetric joint action the team needs. In practice, shared networks are given the agent's ID as an input for exactly this reason.

Key takeaways

  • The policy gradient of decentralized policies splits into per-agent terms that all use the team's action value; naive Monte Carlo estimates can carry signal exponentially rarely as teams grow (21−N2^{1-N} in the all-agree game).
  • COMA's counterfactual baseline marginalizes only the agent's own action, so it leaves the expected gradient unchanged; correctness under partial observability also needs a critic that conditions on histories, not only the state.
  • MADDPG gives each agent a centralized critic over all actions, applicable to mixed games; with converged critics, centralized critics give the same expected gradient as decentralized ones and no lower variance, so their value lies in learning the critic.
  • MAPPO (PPO with a centralized value function) and even independent PPO are strong on cooperative benchmarks when value normalization, value inputs, data reuse, clipping and batch size are chosen well; these results establish baselines, not the irrelevance of coordination.
  • The joint advantage telescopes into agents' conditional advantages, so updating agents in sequence, each against its predecessors' new policies, improves the team monotonically (HATRPO, HAPPO), where simultaneous improvements can cancel.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why does COMA's counterfactual baseline leave agent ii's expected policy gradient unchanged?

  1. Because the critic is trained by TD learning
  2. Because the baseline does not depend on agent ii's own action, and the score function ∇log⁡πi(ai∣τi)\nabla\log\pi_i(a_i\mid\tau_i) has zero mean under πi\pi_i
  3. Because the baseline averages over all agents' actions
  4. Because the advantage is clipped as in PPO
Show the answer

B. Because the baseline does not depend on agent ii's own action, and the score function ∇log⁡πi(ai∣τi)\nabla\log\pi_i(a_i\mid\tau_i) has zero mean under πi\pi_i

Eai[∇log⁡πi(ai∣τi) b]=b ∇∑aiπi(ai∣τi)=0\E_{a_i}\big[\nabla\log\pi_i(a_i\mid\tau_i)\,b\big]=b\,\nabla\sum_{a_i}\pi_i(a_i\mid\tau_i)=0 for any bb that does not depend on aia_i. COMA's baseline marginalizes aia_i under agent ii's policy and keeps the teammates' actual actions, which is allowed because agents randomize independently.

Question 2

Ten agents start with uniformly random binary actions, and the team is rewarded only when all ten choose the same action. What fraction of single-sample REINFORCE estimates is non-zero?

  1. About 50%
  2. About 10%
  3. About 1%
  4. About 0.2%
Show the answer

D. About 0.2%

All actions agree with probability 2⋅2−10=2−9≈0.2%2\cdot2^{-10}=2^{-9}\approx0.2\%, and only then is the reward, and hence the estimate, non-zero. The signal each agent receives decays exponentially with team size, which motivates learned centralized critics.

Question 3

Two agents both play B in a team game paying 0 for (A, A), 2 for a mismatch and 1 for (B, B). Each agent takes a trust-region step that improves the team reward against the other's current policy. What happens if they update simultaneously, and what if they update in sequence?

  1. Simultaneously both switch to A and the team gets 0; in sequence the second agent, seeing the first's new A, stays with B and the team gets 2
  2. Both orders reach a mismatch worth 2
  3. Simultaneous updates reach 2; sequential updates get stuck at 1
  4. Neither changes, because (B, B) is an equilibrium
Show the answer

A. Simultaneously both switch to A and the team gets 0; in sequence the second agent, seeing the first's new A, stays with B and the team gets 2

Each agent's improvement is computed against the other's old action, and both switching makes both computations wrong at once. The advantage decomposition fixes this: the second agent evaluates its advantage given the first agent's updated action, so the sum of the conditional advantages, and hence the team's improvement, is nonnegative.

Question 4

What did Lyu, Xiao, Daley & Amato (2021) prove about centralized and decentralized critics, assuming converged critics and the same policy parameterization?

  1. Centralized critics give unbiased gradients and decentralized ones biased gradients
  2. Centralized critics always reduce the variance of the policy gradient
  3. Both give the same expected policy gradient, and the centralized critic's gradient variance is at least as large in every dimension
  4. Decentralized critics cannot converge in cooperative games
Show the answer

C. Both give the same expected policy gradient, and the centralized critic's gradient variance is at least as large in every dimension

Averaging a centralized critic over the teammates' actions and the hidden state gives the decentralized critic's value, so the expected gradients coincide; conditioning on more random quantities adds variance. Whatever centralized critics buy comes from learning the critic, not from the gradient they produce once learned.

Further reading

  • J. N. Foerster, G. Farquhar, T. Afouras, N. Nardelli & S. Whiteson, "Counterfactual multi-agent policy gradients," Proceedings of the AAAI Conference on Artificial Intelligence 32, 2974–2982 (2018).
  • R. Lowe, Y. Wu, A. Tamar, J. Harb, P. Abbeel & I. Mordatch, "Multi-agent actor-critic for mixed cooperative-competitive environments," Advances in Neural Information Processing Systems 30 (2017).
  • X. Lyu, Y. Xiao, B. Daley & C. Amato, "Contrasting centralized and decentralized critics in multi-agent reinforcement learning," Proceedings of the 20th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), 844–852 (2021).
  • C. Yu, A. Velu, E. Vinitsky, J. Gao, Y. Wang, A. Bayen & Y. Wu, "The surprising effectiveness of PPO in cooperative multi-agent games," Advances in Neural Information Processing Systems 35, Datasets and Benchmarks Track (2022).
  • J. G. Kuba, R. Chen, M. Wen, Y. Wen, F. Sun, J. Wang & Y. Yang, "Trust region policy optimisation in multi-agent reinforcement learning," International Conference on Learning Representations (2022).