Simple Algorithm
Artificial Intelligence · Deep Layer · 28 min

Multi-Agent Learning & Game Theory

Nash equilibria, self-play and cooperation.

Two Q-learners in one world each see the other as part of a moving environment, and their learning can cycle forever where a single learner would converge. Game theory supplies the right targets, equilibria, and some of the right algorithms: Shapley's value iteration for zero-sum games, no-regret dynamics, and the population training behind superhuman poker and StarCraft agents. This lesson proves the core results and maps what is still open.

What you’ll learn

  • Define Markov games and Nash, correlated and coarse correlated equilibria, and state what is known about their existence and computational complexity.
  • Prove that Shapley's operator is a γ\gamma-contraction for zero-sum Markov games, and explain why minimax-Q inherits its convergence while Nash-Q does not.
  • Show that gradient play cycles in matching pennies, and prove that the average play of no-regret learners is an approximate Nash equilibrium of a zero-sum game.
  • Explain centralized training with decentralized execution, prove that monotonic value mixing makes individually greedy actions jointly greedy, and exhibit a game it cannot represent.
  • Describe self-play and population methods, from fictitious play to AlphaStar and OpenAI Five, and the open problems of general-sum learning.

Solution concepts and their complexity

Concept (normal form)Exists?Computing oneReached by learning?
Nash, two-player zero-sumyes (von Neumann, 1928)a linear program, polynomial timeyes: time averages of no-regret play (proved below)
Nash, general-sumyes, in mixed strategies (Nash, 1950)PPAD-complete, even for two players (Daskalakis, Goldberg & Papadimitriou, 2009; Chen, Deng & Teng, 2009)no uncoupled dynamics converge in every game (Hart & Mas-Colell, 2003)
Correlated equilibriumyes (it contains Nash)a linear program in σ\sigmatime averages of no-swap-regret play (Foster & Vohra, 1997; Hart & Mas-Colell, 2000)
Coarse correlatedyesa linear program in σ\sigmatime averages of no-external-regret play
Markov games add a twist. Stationary Nash equilibria exist in discounted games (Fink, 1964), yet computing even a stationary CCE of a general-sum discounted game is PPAD-hard (Daskalakis, Golowich & Zhang, 2023), while in finite-horizon games history-dependent CCE can be learned with a number of samples that scales with the largest individual action set rather than the joint one (V-learning; Jin, Liu, Wang & Yu, 2021).
Check your understanding

Two drivers reach an intersection. If both go they crash (−10-10 each); if one goes it gets 1 and the other 0; if both stop, 0 each. A traffic light recommends (go, stop) or (stop, go) with probability 12\tfrac12 each, and each driver sees only its own signal. Why is obeying the light a correlated equilibrium but not a Nash equilibrium?

  1. It is also a Nash equilibrium, since every correlated equilibrium is one
  2. Obeying is a best response to each signal, given what the signal reveals about the other driver, but the distribution, all mass on (go, stop) and (stop, go), is not a product of independent mixed strategies
  3. It is not a correlated equilibrium either: a driver told to stop should go, because going pays more
  4. Correlated equilibria require the drivers to talk before the game
Show the answer

B. Obeying is a best response to each signal, given what the signal reveals about the other driver, but the distribution, all mass on (go, stop) and (stop, go), is not a product of independent mixed strategies

A driver told "go" knows the other was told "stop": going pays 1, stopping 0. A driver told "stop" knows the other goes: stopping pays 0, going −10-10. So obeying is optimal. Independent mixing cannot produce perfectly anti-correlated actions, and the light does better than any Nash equilibrium that treats the drivers alike: the symmetric mixed one has each driver go with probability 111\tfrac1{11}, crashes occasionally and pays each 0 in expectation, while the light pays each 12\tfrac12.

Zero-sum Markov games: Shapley's operator

For two players with r1=−r2=rr_1=-r_2=r, where player 1 maximizes, define for any V:S→RV:\mathcal S\to\R the stage game at ss, QV(s,a,b)=r(s,a,b)+γ∑s′P(s′∣s,a,b)V(s′)Q_V(s,a,b)=r(s,a,b)+\gamma\sum_{s'}P(s'\mid s,a,b)V(s'), and the Shapley operator (TV)(s)=val QV(s,⋅,⋅)(TV)(s)=\mathrm{val}\,Q_V(s,\cdot,\cdot), where val(M)=max⁡x∈Δmin⁡y∈Δx⊤My\mathrm{val}(M)=\max_{x\in\Delta}\min_{y\in\Delta}x^\top My is the value of the matrix game MM, computed by a linear program. With one player it reduces to the Bellman optimality operator.

DerivationProof
  1. ∣val(M)−val(M′)∣≤max⁡a,b∣Mab−Mab′∣\big|\mathrm{val}(M)-\mathrm{val}(M')\big|\le\max_{a,b}\big|M_{ab}-M'_{ab}\big|

    The value of a matrix game is 1-Lipschitz in the max norm. For mixed strategies x,yx,y, x⊤My≤x⊤M′y+∥M−M′∥max⁡x^\top My\le x^\top M'y+\norm{M-M'}_{\max}, because x⊤(M−M′)yx^\top(M-M')y is an average of entries. Taking min⁡y\min_y and then max⁡x\max_x preserves the inequality, and swapping MM and M′M' gives

  2. ∣QV(s,a,b)−QV′(s,a,b)∣=γ∣∑s′P(s′∣s,a,b)(V(s′)−V′(s′))∣≤γ∥V−V′∥∞\big|Q_V(s,a,b)-Q_{V'}(s,a,b)\big|=\gamma\Big|\sum_{s'}P(s'\mid s,a,b)\big(V(s')-V'(s')\big)\Big|\le\gamma\norm{V-V'}_\infty

    Contraction. The stage games of VV and V′V' differ entrywise by a discounted average of V−V′V-V':

  3. ∥TkV−V∗∥∞≤γk∥V−V∗∥∞\norm{T^kV-V^*}_\infty\le\gamma^k\norm{V-V^*}_\infty

    So ∣(TV)(s)−(TV′)(s)∣≤γ∥V−V′∥∞|(TV)(s)-(TV')(s)|\le\gamma\norm{V-V'}_\infty at every state. By Banach's fixed-point theorem TT has a unique fixed point V∗V^*, and value iteration converges geometrically from any start:

  4. (Tx∗V∗)(s)=min⁡yx∗(s)⊤QV∗(s,⋅,⋅) y=val QV∗(s,⋅,⋅)=V∗(s)■(T_{x^*}V^*)(s)=\min_yx^*(s)^\top Q_{V^*}(s,\cdot,\cdot)\,y=\mathrm{val}\,Q_{V^*}(s,\cdot,\cdot)=V^*(s)\qquad\blacksquare

    Optimality. Fix player 1's stationary policy x∗x^*. Player 2 then faces an ordinary MDP, minimizing player 1's return, with Bellman optimality operator (Tx∗V)(s)=min⁡yx∗(s)⊤QV(s,⋅,⋅) y(T_{x^*}V)(s)=\min_yx^*(s)^\top Q_V(s,\cdot,\cdot)\,y. Because x∗(s)x^*(s) is maximin in QV∗(s,⋅,⋅)Q_{V^*}(s,\cdot,\cdot), V∗V^* is a fixed point of Tx∗T_{x^*}, hence the optimal value of player 2's MDP: no policy of player 2, even a history-dependent one, holds player 1 below V∗V^*. The symmetric argument for y∗y^* gives the matching upper bound.

Minimax-Q (Littman, 1994) is the sample-based version. After observing (s,a,b,r,s′)(s,a,b,r,s') it updates Q(s,a,b)←(1−α)Q(s,a,b)+α[r+γ val Q(s′,⋅,⋅)]Q(s,a,b)\leftarrow(1-\alpha)Q(s,a,b)+\alpha\big[r+\gamma\,\mathrm{val}\,Q(s',\cdot,\cdot)\big], solving one small linear program per update, and it converges under the usual step-size and visitation conditions because its expected backup is a contraction (Littman & Szepesvári, 1996). The construction fails for general-sum games. Nash-Q (Hu & Wellman, 2003) replaces val by the payoff of a Nash equilibrium of each stage game, but convergence was proved only under strong conditions, for example that every stage game met during learning has a global optimum or a saddle point. No efficient algorithm is known for stationary equilibria of general-sum Markov games, and PPAD-hardness makes one unlikely.

Think first Exactly where does Shapley's argument break for a general-sum game, even with two players?

It used two properties of val: it is single-valued, and it is 1-Lipschitz. A general-sum stage game can have several Nash equilibria with different payoffs, and as QQ moves continuously, equilibria can appear, vanish or swap, so any rule that selects "the" equilibrium payoff can jump. Without a Lipschitz backup there is no contraction, and Nash-Q's iterates can fail to converge.

Learning dynamics: cycles and no-regret

The target is an equilibrium, but learners adapt to each other, so the data each one sees depends on how the others learn. The smallest zero-sum game already shows what can go wrong.

DerivationGradient play cycles in matching pennies
  1. U(x,y)=(2x−1)(2y−1),player 2 receives −U(x,y)U(x,y)=(2x-1)(2y-1),\qquad\text{player 2 receives }-U(x,y)

    Each player shows heads or tails; player 1 wins 1 if they match and loses 1 otherwise. If the players show heads with probabilities xx and yy, player 1's expected payoff is

  2. ξ˙=∂U∂x=2(2y−1)=4ζ,ζ˙=−∂U∂y=−2(2x−1)=−4ξ\dot\xi=\frac{\partial U}{\partial x}=2(2y-1)=4\zeta,\qquad\dot\zeta=-\frac{\partial U}{\partial y}=-2(2x-1)=-4\xi

    The unique equilibrium is x=y=12x=y=\tfrac12. Let each player follow the gradient of its own payoff, the infinitesimal gradient ascent analyzed by Singh, Kearns & Mansour (2000). In the coordinates ξ=x−12\xi=x-\tfrac12, ζ=y−12\zeta=y-\tfrac12:

  3. ddt(ξ2+ζ2)=2ξ⋅4ζ+2ζ⋅(−4ξ)=0\frac{d}{dt}\big(\xi^2+\zeta^2\big)=2\xi\cdot4\zeta+2\zeta\cdot(-4\xi)=0

    The squared distance to the equilibrium is conserved, so the strategies orbit (12,12)(\tfrac12,\tfrac12) forever without converging (until an orbit large enough to reach the boundary of the unit square is clipped there):

  4. ξk+12+ζk+12=(1+16η2)(ξk2+ζk2)\xi_{k+1}^2+\zeta_{k+1}^2=\big(1+16\eta^2\big)\big(\xi_k^2+\zeta_k^2\big)

    Simultaneous discrete steps of size η\eta do worse: (ξ,ζ)↦(ξ+4ηζ, ζ−4ηξ)(\xi,\zeta)\mapsto(\xi+4\eta\zeta,\ \zeta-4\eta\xi) spirals outward. Singh et al. showed that in two-player, two-action games gradient play still converges either to an equilibrium or, failing that, in average payoff to an equilibrium's payoffs. The same rotational dynamics trouble GAN training (Generative Adversarial Networks).

DerivationProof
  1. max⁡xx⊤Ayˉ=max⁡x1T∑tx⊤Ayt≤1T∑txt⊤Ayt+ϵ1≤min⁡y1T∑txt⊤Ay+ϵ1+ϵ2\max_xx^\top A\bar y=\max_x\frac1T\sum_tx^\top Ay_t\le\frac1T\sum_tx_t^\top Ay_t+\epsilon_1\le\min_y\frac1T\sum_tx_t^\top Ay+\epsilon_1+\epsilon_2

    Use linearity in yy, then player 1's regret, then player 2's:

  2. max⁡xx⊤Ayˉ−ϵ1−ϵ2 ≤ min⁡yxˉ⊤Ay ≤ xˉ⊤Ayˉ ≤ max⁡xx⊤Ayˉ\max_xx^\top A\bar y-\epsilon_1-\epsilon_2\ \le\ \min_y\bar x^\top Ay\ \le\ \bar x^\top A\bar y\ \le\ \max_xx^\top A\bar y

    By linearity in xx the last minimum is min⁡yxˉ⊤Ay\min_y\bar x^\top Ay, which is at most xˉ⊤Ayˉ\bar x^\top A\bar y, which is at most max⁡xx⊤Ayˉ\max_xx^\top A\bar y. So the whole chain fits in a window of width ϵ1+ϵ2\epsilon_1+\epsilon_2:

  3. Multiplicative weights (Hedge) over nn actions, with payoffs in [0,1][0,1], has average regret O(log⁡n/T)\order{\sqrt{\log n/T}} against any sequence of opponent strategies, so self-play with Hedge drives the averages to equilibrium at that rate. Because such algorithms exist, letting T→∞T\to\infty also proves von Neumann's minimax theorem, max⁡xmin⁡yx⊤Ay=min⁡ymax⁡xx⊤Ay\max_x\min_yx^\top Ay=\min_y\max_xx^\top Ay.

Outside zero-sum games the same averaging shows that the empirical distribution of joint play converges to the set of CCE under no-external-regret learning and to the set of CE under no-swap-regret learning, though day-to-day strategies need not settle. In extensive-form games of imperfect information, counterfactual regret minimization (CFR; Zinkevich et al., 2007) runs a regret minimizer at every information set, and its average strategy converges to a Nash equilibrium in two-player zero-sum games. CFR variants, with abstraction and real-time search, powered Libratus, which beat top professionals at heads-up no-limit Texas hold'em in 2017 (Brown & Sandholm, 2018), and Pluribus, which beat elite professionals at six-player no-limit hold'em, where no equilibrium guarantee applies (Brown & Sandholm, 2019).

Deep MARL: centralized critics, factored values, populations

In cooperative and mixed games with partial observability, agent ii must act on its own observation history τi\tau_i, but during training, usually in simulation, everything is visible. Centralized training with decentralized execution (CTDE) exploits the asymmetry: a critic conditioned on the global state and the joint action faces stationary targets, because given all the actions, transitions and rewards no longer depend on anyone's policy.

MADDPG (Lowe et al., 2017) gives each agent a deterministic actor μi(oi)\mu_i(o_i) and a centralized critic Qi(x,a1,…,aN)Q_i(x,a_1,\dots,a_N), trained with the deterministic policy gradient (Actor–Critic & Soft Actor–Critic):

∇θiJi=E[∇θiμi(oi) ∇aiQi(x,a1,…,aN)∣ai=μi(oi)].\nabla_{\theta_i}J_i=\E\Big[\nabla_{\theta_i}\mu_i(o_i)\,\nabla_{a_i}Q_i(x,a_1,\dots,a_N)\big|_{a_i=\mu_i(o_i)}\Big].

COMA (Foerster et al., 2018) attacks credit assignment in teams with a counterfactual baseline that marginalizes out only agent ii's action: Ai(s,a)=Q(s,a)−∑ai′πi(ai′∣τi) Q(s,(ai′,a−i))A_i(s,\mathbf a)=Q(s,\mathbf a)-\sum_{a_i'}\pi_i(a_i'\mid\tau_i)\,Q\big(s,(a_i',\mathbf a_{-i})\big).

For teams with a shared reward, a joint value Qtot(τ,a)Q_{\mathrm{tot}}(\boldsymbol\tau,\mathbf a) ranges over ∏i∣Ai∣\prod_i|\mathcal A_i| joint actions. Decentralized execution needs the individual–global max (IGM) property: the agents' individually greedy actions must together maximize QtotQ_{\mathrm{tot}}. VDN (Sunehag et al., 2018) sums the utilities, Qtot=∑iQiQ_{\mathrm{tot}}=\sum_iQ_i. QMIX (Rashid et al., 2018) mixes them with a network whose weights, generated from the global state by hypernetworks, are non-negative, so that ∂Qtot/∂Qi≥0\partial Q_{\mathrm{tot}}/\partial Q_i\ge0.

DerivationProof, and what it cannot represent
  1. Qtot(τ,a)≤Qtot(τ,a∗)for every a■Q_{\mathrm{tot}}(\boldsymbol\tau,\mathbf a)\le Q_{\mathrm{tot}}(\boldsymbol\tau,\mathbf a^*)\qquad\text{for every }\mathbf a\qquad\blacksquare

    Take any joint action a\mathbf a and replace its coordinates by the greedy ones, one at a time. Each replacement swaps Qi(τi,ai)Q_i(\tau_i,a_i) for Qi(τi,ai∗)≥Qi(τi,ai)Q_i(\tau_i,a_i^*)\ge Q_i(\tau_i,a_i) in one argument of ff, which cannot decrease ff. After NN replacements:

  2. Qtot(A,B)<Qtot(B,B)⇒Q1(A)<Q1(B),Qtot(A,A)>Qtot(B,A)⇒Q1(A)>Q1(B)Q_{\mathrm{tot}}(\mathrm A,\mathrm B)<Q_{\mathrm{tot}}(\mathrm B,\mathrm B)\Rightarrow Q_1(\mathrm A)<Q_1(\mathrm B),\qquad Q_{\mathrm{tot}}(\mathrm A,\mathrm A)>Q_{\mathrm{tot}}(\mathrm B,\mathrm A)\Rightarrow Q_1(\mathrm A)>Q_1(\mathrm B)

    The converse fails: monotone mixtures of per-agent utilities cannot express every team payoff. Take two agents with actions A, B, C and shared payoff 8 for (A, A), −12-12 whenever exactly one agent plays A, and 0 otherwise (Son et al., 2019). Representing it exactly would need two contradictory comparisons of agent 1's utilities, with agent 2's action held fixed:

  3. Each implication is the contrapositive of monotonicity: if Q1(A)≥Q1(B)Q_1(\mathrm A)\ge Q_1(\mathrm B) then f(Q1(A),q)≥f(Q1(B),q)f(Q_1(\mathrm A),q)\ge f(Q_1(\mathrm B),q) for any fixed q=Q2(⋅)q=Q_2(\cdot). In experiments with uniform exploration, VDN and QMIX learned value tables whose greedy joint action was not (A, A); QTRAN (Son et al., 2019) and QPLEX (Wang et al., 2021) enlarge the class of representable games while keeping decentralized greedy execution.

In two-player zero-sum games the opponent can be oneself, which is self-play. Fictitious play (Brown, 1951) best-responds to the opponent's empirical average strategy, and Robinson (1951) proved that its averages converge to equilibrium in zero-sum games, though slowly. Training only against the latest copy can instead chase its own tail in non-transitive games, where strategies beat each other in cycles like rock–paper–scissors. Policy-space response oracles (PSRO; Lanctot et al., 2017) generalize fictitious play: keep a population of policies, solve the empirical meta-game among them for a mixture, train a deep-RL best response to that mixture, add it to the population, and repeat. AlphaStar (Vinyals et al., 2019) trained a league of main agents and dedicated exploiter agents with prioritized fictitious self-play and reached Grandmaster level in StarCraft II with all three races. OpenAI Five (Berner et al., 2019) trained with PPO at very large scale, mostly against its current self and partly against past versions, and defeated the reigning world-champion Dota 2 team in 2019.

Key takeaways

  • Markov games extend MDPs to several reward-maximizing players. The targets are equilibria (Nash ⊆\subseteq CE ⊆\subseteq CCE); zero-sum Nash is a linear program, general-sum Nash is PPAD-complete.
  • Shapley's operator puts a matrix-game value inside a Bellman backup and is a γ\gamma-contraction because val is 1-Lipschitz; minimax-Q samples it, while general-sum stage games have no such backup.
  • Gradient play rotates around mixed equilibria and spirals outward in discrete time, but the averages of no-regret learners form an (ϵ1+ϵ2)(\epsilon_1+\epsilon_2)-Nash equilibrium of a zero-sum game, the principle behind CFR and superhuman poker.
  • Centralized critics make training targets stationary; monotonic mixing (QMIX) makes greedy actions decentralizable, at the cost of representing only monotone interactions.
  • Fictitious play, PSRO, AlphaStar's league and OpenAI Five's self-play answer non-transitivity in practice; general-sum learning, coordination with new partners and evaluation remain open.

Check yourself

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

Question 1

Which property of the matrix-game value drives the proof that Shapley's operator is a contraction?

  1. The value is linear in the payoff matrix
  2. The value changes by at most the largest entrywise change in the matrix: ∣val(M)−val(M′)∣≤max⁡a,b∣Mab−Mab′∣|\mathrm{val}(M)-\mathrm{val}(M')|\le\max_{a,b}|M_{ab}-M'_{ab}|
  3. Every matrix game has a pure equilibrium
  4. The value of a zero-sum game is always zero
Show the answer

B. The value changes by at most the largest entrywise change in the matrix: ∣val(M)−val(M′)∣≤max⁡a,b∣Mab−Mab′∣|\mathrm{val}(M)-\mathrm{val}(M')|\le\max_{a,b}|M_{ab}-M'_{ab}|

Combine this 1-Lipschitz property with the fact that the stage games of VV and V′V' differ entrywise by at most γ∥V−V′∥∞\gamma\norm{V-V'}_\infty, and the contraction follows; nothing more about val is needed. A general-sum stage game has no single-valued, Lipschitz analogue of val, which is why the argument does not extend.

Question 2

Players of matching pennies follow continuous-time gradient play from x=0.6x=0.6, y=0.5y=0.5, where xx and yy are their probabilities of showing heads. What happens?

  1. They converge to the equilibrium (12,12)(\tfrac12,\tfrac12)
  2. They converge to a pure strategy profile
  3. They orbit the equilibrium at the constant distance (x−12)2+(y−12)2=0.1\sqrt{(x-\tfrac12)^2+(y-\tfrac12)^2}=0.1 forever
  4. Player 1's strategy converges while player 2's keeps oscillating
Show the answer

C. They orbit the equilibrium at the constant distance (x−12)2+(y−12)2=0.1\sqrt{(x-\tfrac12)^2+(y-\tfrac12)^2}=0.1 forever

With ξ=x−12\xi=x-\tfrac12 and ζ=y−12\zeta=y-\tfrac12, the dynamics ξ˙=4ζ\dot\xi=4\zeta, ζ˙=−4ξ\dot\zeta=-4\xi conserve ξ2+ζ2\xi^2+\zeta^2, so the strategies circle the equilibrium. Their time averages do approach it, which is the no-regret phenomenon; the strategies themselves never do.

Question 3

Both players of a zero-sum game run algorithms whose average regret after TT rounds is at most 0.01. What can you conclude about their average strategies (xˉ,yˉ)(\bar x,\bar y)?

  1. They form an exact Nash equilibrium
  2. Each is within 0.02 of a best response to the other
  3. Nothing, unless the last iterates also converge
  4. They are within 0.01 of the uniform strategy
Show the answer

B. Each is within 0.02 of a best response to the other

Freund and Schapire's argument gives max⁡xx⊤Ayˉ−min⁡yxˉ⊤Ay≤ϵ1+ϵ2=0.02\max_xx^\top A\bar y-\min_y\bar x^\top Ay\le\epsilon_1+\epsilon_2=0.02: the averages form a 0.02-Nash equilibrium, even if the day-to-day strategies cycle.

Question 4

What does QMIX's monotonic mixing guarantee, and what does it give up?

  1. It guarantees the optimal joint policy in every cooperative game
  2. Individually greedy actions are jointly greedy for the learned QtotQ_{\mathrm{tot}}, but payoff structures in which one agent's best action depends on another's action cannot be represented
  3. It removes the need for any centralized information during training
  4. It makes the environments of independent learners stationary
Show the answer

B. Individually greedy actions are jointly greedy for the learned QtotQ_{\mathrm{tot}}, but payoff structures in which one agent's best action depends on another's action cannot be represented

Monotonicity makes the joint argmax decompose, so execution is decentralized and linear in NN. The price is representational: in the 8/−12/08/{-12}/0 game, agent 1's utility would have to rank A above B when agent 2 plays A and below B when agent 2 plays B, which no per-agent utility can do.

Further reading

  • L. S. Shapley, "Stochastic games," Proceedings of the National Academy of Sciences (1953).
  • M. L. Littman, "Markov games as a framework for multi-agent reinforcement learning," ICML (1994).
  • Y. Freund & R. E. Schapire, "Adaptive game playing using multiplicative weights," Games and Economic Behavior (1999).
  • T. Rashid, M. Samvelyan, C. Schroeder de Witt, G. Farquhar, J. Foerster & S. Whiteson, "QMIX: Monotonic value function factorisation for deep multi-agent reinforcement learning," ICML (2018).
  • S. V. Albrecht, F. Christianos & L. Schäfer, Multi-Agent Reinforcement Learning: Foundations and Modern Approaches (MIT Press, 2024).