Core idea: a Markov decision process assumes that a single agent acts in an environment. Multi-agent reinforcement learning studies sequential decision problems in which several agents act at the same time, and each agent’s learning changes the effective environment seen by the others.
26.1 Learning goals
After reading this chapter, students should be able to:
define finite Markov games precisely;
distinguish cooperative, competitive, and general-sum objectives;
derive Bellman equations for fixed joint policies;
derive the Shapley optimality equation for two-player zero-sum Markov games;
compute mixed strategies in small matrix games;
explain why independent learners face a nonstationary environment;
compare independent learning, minimax learning, centralized training with decentralized execution, and mean-field approximation;
implement small multi-agent examples in Python.
26.2 23.1 From MDPs to Markov games
A finite discounted MDP has one decision maker. At each time \(t\), the agent observes \(S_t\), chooses \(A_t\), receives reward \(R_{t+1}\), and the next state is drawn from \(P(s' \mid s,a)\).
In a multi-agent problem, several agents choose actions simultaneously. For two agents, a finite discounted Markov game is a tuple
\[
M = (S, A_1, A_2, P, r_1, r_2, \gamma),
\]
where:
\(S\) is a finite state space;
\(A_i\) is the finite action space of agent \(i\);
\(P(s' \mid s,a_1,a_2)\) is the controlled transition kernel;
\(r_i(s,a_1,a_2)\) is the expected one-step reward for agent \(i\);
This joint-action dependence is mathematically simple but algorithmically difficult: the effective environment seen by agent \(i\) depends on the policies of all other agents.
26.3 23.2 Joint policies
A stationary randomized policy for agent \(i\) is a conditional distribution
Fixed joint policy reduction. A Markov game plus a fixed joint policy becomes a Markov reward process for each agent.
26.4 23.3 Types of multi-agent objectives
Multi-agent problems are usually classified by the reward structure.
26.4.1 Fully cooperative games
In a fully cooperative game, all agents share the same reward:
\[
r_1(s,a_1,a_2)=r_2(s,a_1,a_2)=r(s,a_1,a_2).
\]
The goal is to maximize a common return. This setting appears in distributed robotics, traffic control, multi-agent resource allocation, and team decision problems.
26.4.2 Two-player zero-sum games
In a two-player zero-sum game,
\[
r_1(s,a_1,a_2) = -r_2(s,a_1,a_2).
\]
Agent 1 is the maximizer and agent 2 is the minimizer. This setting is mathematically clean because it leads to minimax Bellman equations and saddle-point values.
26.4.3 General-sum games
In a general-sum game, the rewards have no special relation. Agents may have partially aligned and partially conflicting objectives. This setting is the most realistic but also the most mathematically delicate because equilibrium selection becomes important.
26.5 23.4 Matrix games as one-state Markov games
Before studying dynamic games, it is useful to study a one-state simultaneous game. Suppose agent 1 chooses a row action and agent 2 chooses a column action. The payoff matrix for agent 1 is
If the game is zero-sum, agent 2 receives payoff \(-G_{ij}\).
A mixed strategy for the row player is \(x \in \Delta(A_1)\) and a mixed strategy for the column player is \(y \in \Delta(A_2)\). The expected payoff to the row player is
Von Neumann’s minimax theorem says that, for finite zero-sum games,
\[
\max_x\min_y x^TGy = \min_y\max_x x^TGy.
\]
This equality is not just an algebraic curiosity. It is the equilibrium condition that lets us write Bellman optimality equations for zero-sum Markov games.
26.5.1 Interactive: payoff landscape for a matrix game
The graph shows the expected payoff \(x^TGy\) as the two mixed strategies vary.
26.6 23.5 Solving a two-action zero-sum matrix game
For a \(2 \times 2\) zero-sum game, write the row player’s strategy as
\[
x = (p,1-p),
\]
and the column player’s strategy as
\[
y = (q,1-q).
\]
If the row player chooses \(p\), the expected payoff against column 1 is
\[
L_1(p)=pG_{11}+(1-p)G_{21},
\]
and against column 2 is
\[
L_2(p)=pG_{12}+(1-p)G_{22}.
\]
The column player chooses the smaller of these two quantities, so the row player maximizes
The point is not the numerical value but the equilibrium principle: the row player chooses a strategy that maximizes the payoff guaranteed against the worst column response.
26.8 23.7 Zero-sum Markov games and the Shapley equation
For a discounted two-player zero-sum Markov game, let \(r(s,a_1,a_2)\) denote agent 1’s reward. Agent 2 receives \(-r(s,a_1,a_2)\).
If the current value estimate is \(V\), define the state-wise matrix
This is the one-step reward plus the discounted continuation value. At state \(s\), the two players face a matrix game with payoff matrix \(M_V(s)\). The optimal Bellman-Shapley operator is
The operator \(T\) is a \(\gamma\)-contraction in the sup norm:
\[
\|TV-TW\|_\infty \leq \gamma\|V-W\|_\infty.
\]
The reason is that changing \(V\) to \(W\) changes every entry of every continuation payoff matrix by at most \(\gamma\|V-W\|_\infty\). Taking a max-min value of a matrix cannot amplify entrywise perturbations. Therefore value iteration converges:
\[
V_{k+1}=TV_k,
\qquad
V_k \to V^*.
\]
26.8.1 Interactive: value iteration for a zero-sum Markov game
This demonstration shows convergence of the Shapley value iteration in a small two-state game.
26.9 23.8 Python example: Shapley value iteration
The following code uses a grid search over mixed strategies for each state-wise \(2 \times 2\) matrix game. This is not the best method for large games, but it makes the mathematics transparent.
The update has the same outer structure as ordinary value iteration, but the inner maximization over actions is replaced by the solution of a state-wise matrix game.
26.10 23.9 General-sum Markov games and Nash equilibria
In a general-sum game, each agent has its own reward. A joint policy \(\pi^*=(\pi_1^*,\pi_2^*)\) is a Markov perfect Nash equilibrium if, for every state \(s\),
This means no agent can improve its own value by changing its policy alone. Unlike zero-sum games, there may be many Nash equilibria, and they may have different values. This creates an equilibrium-selection problem.
A one-state coordination game illustrates the issue. Suppose both players receive payoff \(1\) if they choose the same action and \(0\) otherwise. Both \((A,A)\) and \((B,B)\) are Nash equilibria. Learning dynamics may converge to either equilibrium depending on initialization, exploration, and noise.
26.10.1 Interactive: coordination and equilibrium selection
The graph shows how different initial conditions can lead to different equilibria in a simple coordination learning dynamic.
26.11 23.10 Independent learners and nonstationarity
A tempting approach is to let each agent ignore the learning process of the others and run a single-agent RL algorithm. For agent 1, the effective transition kernel under agent 2’s current policy is
If \(\pi_2\) were fixed, agent 1 would face an ordinary MDP. But if agent 2 is also learning, then \(\pi_2\) changes with time. Therefore agent 1 does not observe data from a stationary MDP.
This is the basic nonstationarity problem in multi-agent reinforcement learning:
The update is simple and often useful in practice, but the usual single-agent convergence theorem no longer applies directly because the environment is nonstationary.
Independent Q-learning is best understood as a heuristic approximation. It can work when:
other agents change slowly;
the interaction is weak;
experience replay and parameter sharing stabilize learning;
a centralized training signal reduces nonstationarity.
It can fail when:
strategic coupling is strong;
multiple equilibria are present;
exploration by one agent changes the reward landscape for another;
agents overfit to each other’s transient behavior.
26.13 23.12 Centralized training with decentralized execution
In cooperative multi-agent RL, one important framework is centralized training with decentralized execution, often abbreviated CTDE.
During training, a centralized critic may use the full state and joint action:
\[
Q(s,a_1,\ldots,a_m).
\]
During execution, each agent uses only local information, such as its observation \(o_i\):
\[
a_i \sim \pi_i(\cdot \mid o_i).
\]
The mathematical advantage is that the critic can evaluate the joint effect of all actions while the final policies remain decentralized.
A typical actor update for agent \(i\) has the form
where \(\widehat A_i\) is an advantage estimate computed using a centralized critic.
26.14 23.13 Difference rewards and credit assignment
In a cooperative game with team reward \(R\), an individual agent may not know whether its action helped the team. This is the credit-assignment problem.
A difference reward compares the team reward with and without agent \(i\)’s contribution:
\[
D_i(z)=G(z)-G(z_{-i},c_i),
\]
where \(z\) is the full system trajectory or state-action configuration, \(z_{-i}\) removes agent \(i\)’s contribution, and \(c_i\) is a baseline action or counterfactual contribution.
The purpose is to reduce variance while preserving the direction of useful improvement. This is closely related to baselines in policy-gradient methods.
26.15 23.14 Mean-field approximation
When the number of agents is large, the joint action space becomes enormous. If there are \(m\) agents and each has \(k\) actions, then the number of joint actions is
\[
k^m.
\]
Mean-field methods approximate the influence of other agents by an aggregate distribution. Suppose agent \(i\) interacts with many statistically similar agents. Instead of conditioning on every other action, we use a mean action distribution
This reduces the dependence on the full joint action \((a_1,\ldots,a_m)\) to the dependence on one agent’s action and the empirical population distribution.
26.15.1 Interactive: mean-field approximation
The plot compares the exact empirical fraction of one action with its mean-field limit.
26.16 23.15 Python example: independent learners in a repeated game
The following example simulates two independent learners in matching pennies. The row player receives \(1\) if the actions match and \(-1\) otherwise. The column player receives the negative payoff.
Final row Q: [-0.188 -0.25 ]
Final column Q: [ 0.296 -0.317]
Best row action: 0
Best column action: 0
This small example should not be interpreted as a stable algorithm for zero-sum games. It illustrates the difficulty: each learner treats the other learner as part of the environment, but that environment keeps changing.
This is not ordinary gradient ascent on one scalar potential unless the game has special structure. Cycles can occur.
26.18 23.17 Statistical viewpoint
For MA Applied Math and MS Statistics students, several statistical issues are especially important.
First, the data are dependent because they come from trajectories. Second, the data are nonstationary because policies change during learning. Third, the target may be an equilibrium rather than a single optimum. Fourth, counterfactual estimation is difficult because each trajectory only contains one realized joint action at each time.
From a statistical perspective, the central questions are:
What distribution generated the data?
Is that distribution stationary?
Which policy profile is being evaluated?
What counterfactual action profiles are supported by the data?
Is the target a value, a best response, or an equilibrium?
These questions are often more important than the choice of algorithm.
26.19 23.18 AI-assisted learning components
26.19.1 AI-assisted derivation check
Ask an AI assistant to derive the fixed-joint-policy Bellman equation for agent \(i\) in a two-agent Markov game. Then check whether the derivation correctly sums over both agents’ actions and whether it distinguishes \(P_\pi\) from \(P(s' \mid s,a_1,a_2)\).
26.19.2 AI-assisted modeling critique
Describe a multi-agent system such as traffic lights, two trading algorithms, or teams of delivery robots. Ask an AI assistant to identify the state, observations, actions, rewards, and whether the problem is cooperative, competitive, or general-sum. Then critique whether the proposed state is Markov.
26.19.3 AI-assisted debugging task
Give an AI assistant code for independent Q-learning and ask it to explain why the single-agent Q-learning convergence theorem does not directly apply. A good answer should mention nonstationarity caused by changing policies of the other agents.
26.20 23.19 Summary
Multi-agent reinforcement learning generalizes MDPs by allowing several agents to act simultaneously. Under a fixed joint policy, a Markov game reduces to an MRP for each agent. In two-player zero-sum games, the Shapley optimality equation replaces the single-agent maximization with a state-wise minimax matrix game. In cooperative games, centralized critics can help solve credit assignment and nonstationarity during training. In general-sum games, Nash equilibria replace optimal policies, and equilibrium selection becomes a central issue.
The main mathematical lesson is that multi-agent RL is not just RL with more actions. The object of interest changes from a single optimal policy to a policy profile, equilibrium, or population-level fixed point.
26.21 Exercises
26.21.1 Conceptual exercises
Explain why a fixed joint policy turns a Markov game into an MRP for each agent.
Give one example of a cooperative Markov game, one zero-sum Markov game, and one general-sum Markov game.
Why does independent Q-learning violate the stationarity assumptions behind the usual single-agent convergence theorem?
Explain the difference between an optimal policy and a Nash equilibrium.
Why is equilibrium selection difficult in coordination games?
26.21.2 Mathematical exercises
Derive the expression for \(P_\pi(s,s')\) under a two-agent randomized stationary joint policy.
Derive the expression for \(r_{i,\pi}(s)\).
Prove that, for a fixed joint policy, \(V_i^\pi=(I-\gamma P_\pi)^{-1}r_{i,\pi}\).
For a \(2 \times 2\) zero-sum matrix game, derive the row player’s interior mixed strategy formula.
Prove that the Shapley operator for a discounted zero-sum Markov game is a \(\gamma\)-contraction in the sup norm.
26.21.3 Computational exercises
Implement exact fixed-joint-policy evaluation for a two-state, two-agent Markov game.
Implement Shapley value iteration for a two-state zero-sum Markov game using a grid search over mixed strategies.
Simulate independent Q-learning in a repeated coordination game. Study how the final equilibrium depends on initialization.
Compare independent Q-learning and minimax value iteration on a small zero-sum Markov game.
Simulate a mean-field population model and compare the empirical action distribution with its limiting deterministic update.
26.21.4 AI-assisted exercises
Ask an AI assistant to design a Markov game for classroom group work. Critique whether the reward structure is cooperative or general-sum.
Ask an AI assistant to explain CTDE to a statistics student. Improve the explanation by adding the conditional expectation view of a centralized critic.
Ask an AI assistant to write code for a matrix-game solver. Test it on matching pennies and a coordination game.
Ask an AI assistant to propose diagnostics for nonstationarity in multi-agent learning data.
26.22 Instructor notes
This chapter is best taught as a bridge between dynamic programming, game theory, and modern multi-agent learning. Students should first master the fixed-joint-policy reduction because it reuses Markov reward process theory. The zero-sum case gives the cleanest extension of Bellman optimality. General-sum games should be introduced carefully: the target is no longer simply \(\max_\pi J(\pi)\) but an equilibrium concept.