Competitive agents: exploiting an opponent without becoming exploitable
竞争智能体
Model opposed interests as a zero-sum game, run fictitious play against fixed, adaptive and self-play opponents, and measure the gap between winning against one opponent and being safe against all.
competitive-agentsA rock-paper-scissors bot that wins, then loses every round
Imagine a hypothetical rock-paper-scissors tournament for programs. Your bot watches its opponent, counts which moves it has played, and always plays whatever beats the most likely next move. Against a careless opponent that plays rock half the time it wins steadily. Then it meets a program that has read your bot’s source code. That program predicts each move exactly and plays the counter. Your bot now loses every single round.
This is the central tension for competitive agents: agents whose interests are opposed, so one agent’s gain is another’s loss. An agent can try to exploit the opponent it actually faces, or to be unexploitable against any opponent it might face. These goals pull in different directions, and the more an agent adapts, the more information it can leak. The article works through that trade-off with a small, fully scripted experiment, then looks at a case where competition is deliberately designed in: training two agents to debate so that a weaker judge can tell which one is right.
Solution concepts for games, the definition and computation of Nash equilibria, and deep self-play reinforcement learning have their own articles. Here the focus is on how adaptive agents behave against each other and how to evaluate them.
Opposed interests, beliefs about the opponent, and exploitability
In a two-player zero-sum game, the players’ payoffs for every joint action sum to zero:
Rock-paper-scissors is the standard example. With actions ordered rock, paper, scissors, the row player’s payoff matrix is
and the column player receives the negative. Against an opponent who mixes rock, paper and scissors with probabilities y, the row player’s expected payoff from action a is (Ay)_a, and a best response is any action that maximizes it. If y=(0.5, 0.3, 0.2), paper earns 0.5×1+0.3×0+0.2×(−1)=0.3, the best available.
Fictitious play is one of the oldest ways for an agent to adapt. Shoham and Leyton-Brown describe it as a model-based learning rule: the agent believes the opponent plays a fixed mixed strategy equal to the empirical frequency of its past actions, plays a best response to that belief, observes the opponent’s action and updates its counts. Fictitious play With w_t(b) the number of times the opponent has played b, plus any prior counts:
The book notes that the rule was first proposed as an iterative method for computing equilibria in zero-sum games, not as a model of learning; that it is very sensitive to initial beliefs; and that the prior counts cannot all be zero, since that defines no distribution. Its results are about the empirical frequency of play: if those frequencies converge, they converge to a Nash equilibrium, and in zero-sum games they do converge. The actual moves need not settle down, and payoffs can disappoint: in the book’s anti-coordination example both players’ frequencies reach the mixed equilibrium while their realized payoff stays 0 because their moves are always miscorrelated. Convergence results and counterexamples
Two facts explain the opening story. First, fictitious play is deterministic given the history. An opponent who knows the rule can compute the next move and beat it every time. Second, a pure action is maximally exploitable in rock-paper-scissors: whichever action you commit to, one reply beats it with payoff −1 for you. Randomizing uniformly guarantees an expected payoff of 0 against every opponent, but it also gives up the 0.3 available against the careless one.
A standard way to measure how far a pair of strategies is from safety is exploitability: the sum of what each player could gain by switching to a best response. For mixed strategies x (row) and y (column) in a zero-sum game,
The first term is the row player’s best-response payoff against y; the second, with its sign, is the column player’s. In rock-paper-scissors the game’s value is 0, so ε≥0, with equality exactly when (x,y) is an equilibrium; here only the uniform pair qualifies.
Shoham and Leyton-Brown emphasize two further points that matter for evaluation. Learning and teaching are inseparable: in a repeated game of Chicken, an agent facing an opponent that learns to best-respond can do well by always daring, “teaching” the learner to yield. And no learning procedure is optimal against every possible opponent; a learner can be judged by self-play, by how it does against other kinds of agents, or by which learning rules are in equilibrium with each other. Why multi-agent learning is complex
Competition can also be built into a system on purpose. Irving, Christiano and Amodei proposed training agents through self-play on a zero-sum debate game: two agents see a question, state answers, alternate short statements, and a judge decides who gave the most true, useful information. The approach rests on a stated claim—that in debate it is harder to lie than to refute a lie—which the authors present as an empirical question. In their MNIST experiment, agents revealed one pixel per turn to a fixed sparse-pixel classifier acting as judge, with one agent preassigned as honest and one as a liar. With 6 revealed pixels the judge’s accuracy rose from 59.4% on random pixels to 88.9% when the honest agent and a liar who had to precommit to its claim chose the pixels (averaged over which agent moved first); with 4 pixels it rose from 48.2% to 85.2%. The debate game and the MNIST experiment Those are the authors’ reported results for an image task with a trained classifier as judge, not evidence about human judges or language debates.
Fixed, adaptive and self-play opponents in rock-paper-scissors
The program implements fictitious play with uniform prior counts and plays it against three kinds of scripted opponent: a biased random player (rock 0.5, paper 0.3, scissors 0.2), a counter-agent that simulates the fictitious-play rule and plays whatever beats its prediction, and another fictitious-play agent (self-play, with priors (1,0,0) and (0,1,0) so the two agents start differently). As a non-adaptive baseline, a uniform random player faces the same opponents. Each match lasts 5,000 rounds for three seeds; the self-play run reports empirical frequencies, exploitability and average payoff at checkpoints up to 100,000 rounds. No learning library, network or model is used.
"""Original repeated rock-paper-scissors study with scripted competitive agents.
Fixed seeds; no learning library, network or LLM is used."""
import random
ACTIONS = ('R', 'P', 'S')
PAYOFF = [[0, -1, 1], [1, 0, -1], [-1, 1, 0]] # row player's payoff; column player gets the negative
def expected(row_mix, col_mix):
return sum(row_mix[a] * col_mix[b] * PAYOFF[a][b] for a in range(3) for b in range(3))
def best_response(col_mix):
values = [sum(col_mix[b] * PAYOFF[a][b] for b in range(3)) for a in range(3)]
return values.index(max(values)), max(values)
def exploitability(row_mix, col_mix):
"""Sum of both players' best-response gains; zero exactly at an equilibrium of this game."""
row_gain = best_response(col_mix)[1]
col_gain = max(-sum(row_mix[a] * PAYOFF[a][b] for a in range(3)) for b in range(3))
return row_gain + col_gain
class FictitiousPlay:
"""Best response to the empirical frequency of the opponent's past actions."""
def __init__(self, prior=(1.0, 1.0, 1.0)):
self.counts = list(prior)
def act(self):
total = sum(self.counts)
return best_response([c / total for c in self.counts])[0]
def observe(self, opponent_action):
self.counts[opponent_action] += 1
def biased(rng, weights=(0.5, 0.3, 0.2)):
return rng.choices(range(3), weights=weights)[0]
def play(rounds, seed):
rng = random.Random(seed)
results = {}
learner, total = FictitiousPlay(), 0
for _ in range(rounds):
a, b = learner.act(), biased(rng)
total += PAYOFF[a][b]
learner.observe(b)
results['fp_vs_biased'] = total / rounds
total = sum(PAYOFF[rng.randrange(3)][biased(rng)] for _ in range(rounds))
results['uniform_vs_biased'] = total / rounds
# The counter-agent knows the fictitious-play rule, predicts its next action and beats it.
learner, total = FictitiousPlay(), 0
for _ in range(rounds):
a = learner.act()
b = (a + 1) % 3
total += PAYOFF[a][b]
learner.observe(b)
results['fp_vs_counter'] = total / rounds
total = 0
for _ in range(rounds):
a = rng.randrange(3)
guess = FictitiousPlay().act() # the counter cannot predict an unrevealed random draw
total += PAYOFF[a][(guess + 1) % 3]
results['uniform_vs_counter'] = total / rounds
return results
def self_play(checkpoints):
one, two = FictitiousPlay((1.0, 0.0, 0.0)), FictitiousPlay((0.0, 1.0, 0.0))
freq_one, freq_two, total, rows = [0, 0, 0], [0, 0, 0], 0, []
for t in range(1, max(checkpoints) + 1):
a, b = one.act(), two.act()
total += PAYOFF[a][b]
one.observe(b)
two.observe(a)
freq_one[a] += 1
freq_two[b] += 1
if t in checkpoints:
x, y = [c / t for c in freq_one], [c / t for c in freq_two]
rows.append((t, [round(v, 4) for v in x], round(exploitability(x, y), 4), round(total / t, 4)))
return rows
if __name__ == '__main__':
target = (0.5, 0.3, 0.2)
action, value = best_response(target)
print('best response to biased opponent', ACTIONS[action], 'expected payoff', round(value, 4))
print('uniform against anyone', round(expected((1 / 3,) * 3, target), 4))
for name, mix in (('pure Paper', (0, 1, 0)), ('biased mix', target), ('uniform', (1 / 3,) * 3)):
print('worst-case payoff of', name, round(min(expected(mix, [int(b == j) for j in range(3)]) for b in range(3)), 4))
for seed in (0, 1, 2):
print('seed', seed, {k: round(v, 4) for k, v in play(5000, seed).items()})
for row in self_play({10, 100, 1000, 10000, 100000}):
print('self-play t=%d freq1=%s exploitability=%s mean_payoff_1=%s' % row)
Recorded output
best response to biased opponent P expected payoff 0.3
uniform against anyone 0.0
worst-case payoff of pure Paper -1
worst-case payoff of biased mix -0.3
worst-case payoff of uniform 0.0
seed 0 {'fp_vs_biased': 0.2898, 'uniform_vs_biased': -0.0078, 'fp_vs_counter': -1.0, 'uniform_vs_counter': -0.0024}
seed 1 {'fp_vs_biased': 0.2884, 'uniform_vs_biased': 0.0134, 'fp_vs_counter': -1.0, 'uniform_vs_counter': -0.0066}
seed 2 {'fp_vs_biased': 0.2998, 'uniform_vs_biased': -0.0104, 'fp_vs_counter': -1.0, 'uniform_vs_counter': 0.0008}
self-play t=10 freq1=[0.3, 0.1, 0.6] exploitability=0.7 mean_payoff_1=-0.2
self-play t=100 freq1=[0.38, 0.27, 0.35] exploitability=0.23 mean_payoff_1=0.02
self-play t=1000 freq1=[0.351, 0.338, 0.311] exploitability=0.065 mean_payoff_1=-0.008
self-play t=10000 freq1=[0.331, 0.3301, 0.3389] exploitability=0.0201 mean_payoff_1=0.0012
self-play t=100000 freq1=[0.3312, 0.3349, 0.3338] exploitability=0.0064 mean_payoff_1=-0.0004Against the biased player, fictitious play earns 0.2898, 0.2884 and 0.2998 per round in the three seeds, close to the best-response value of 0.3; the uniform player earns −0.0078, 0.0134 and −0.0104, consistent with its guarantee of 0. Against the counter-agent, fictitious play scores exactly −1.0 every round, while the uniform player’s results (−0.0024, −0.0066, 0.0008) stay near 0 because the counter cannot predict an unrevealed random draw. The worst-case rows make the same point statically: committing to paper can lose 1 per round, the biased mix itself can lose 0.3 (to paper), and the uniform mix loses nothing in expectation.
In self-play, player 1’s empirical frequencies move from (0.3, 0.1, 0.6) after 10 rounds to (0.3312, 0.3349, 0.3338) after 100,000. Exploitability of the empirical pair falls from 0.7 to 0.23, 0.065, 0.0201 and 0.0064—roughly a factor of three for every tenfold increase in rounds in this run—and the average payoff hovers near 0. This is the zero-sum convergence result in miniature. It says nothing about the move-by-move sequence, which keeps cycling, and a counter-agent could still exploit either player at any single step.
Each round costs O(|A|²) to compute a best response from counts, so T rounds cost O(T|A|²); the exploitability check at a checkpoint is another O(|A|²).
Winning a match is not the same as being strong
Rock-paper-scissors has three actions, a known payoff matrix, and complete observation of the opponent’s moves. Real competitive settings—markets, security, games with hidden information—have huge action spaces, unknown payoffs and opponents that change. Computing exploitability exactly is then infeasible, and evaluation falls back on proxies such as performance against a fixed pool of opponents, which can hide weaknesses that a new opponent would find.
Convergence results for fictitious play are limited. The book’s examples show that in some general-sum games, such as Shapley’s modified rock-paper-scissors, empirical frequencies never converge, and even when they converge, realized payoffs can fall short of equilibrium payoffs. Non-convergence and miscorrelation The counter-agent in our experiment is also idealized: it knows the learner’s rule and prior exactly. A real adversary must infer them, which takes time and data.
Designed competitions inherit their own risks. Debate’s hoped-for guarantees depend on the central claim holding for real judges, on revealed evidence being impossible to fake, and on training finding near-equilibrium play. The authors call the central claim an empirical question, state that debate only works if revealed context cannot be a lie, and present finding equilibria by self-play as a hope rather than a result. Open questions for debate A competitive training signal can also reward persuasion over truth if the judge can be fooled.
Exercises
-
Why can a deterministic adaptive agent always be beaten by an opponent that knows its rule, even if the agent learns quickly?
Answer: Its next action is a function of the public history and its known prior, so the opponent can compute that action before moving and choose the reply that beats it. Speed of learning does not help; only private randomness, or a rule the opponent cannot reconstruct, removes this weakness.
-
An opponent plays rock 0.2, paper 0.5 and scissors 0.3. Compute the expected payoff of each pure response and name the best one.
Answer: Using the matrix rows: rock earns 0.2×0−0.5+0.3=−0.2; paper earns 0.2−0+(−0.3)=−0.1; scissors earns −0.2+0.5+0=0.3. Scissors is the best response, with expected payoff 0.3.
-
In self-play, the empirical frequencies of both fictitious-play agents approach (1/3, 1/3, 1/3). Does that mean each agent is now playing an unexploitable strategy at each round?
Answer: No. The frequencies describe the long-run average, but each round’s move is still a deterministic best response to counts. An opponent that simulates the rule would still win every round. In the book’s anti-coordination example, frequencies converge to the mixed equilibrium while realized payoffs stay at 0, another case where averages hide the actual sequence.
-
You must evaluate a new trading agent before deployment. Its developers report that it beats the three agents they trained against. What extra evaluation would you ask for?
Answer: Ask for results against opponents it did not train with, including adversarial ones built to exploit it; an estimate of worst-case loss, not just average win rate; tests where opponents adapt during the run; and analysis of what information its behaviour leaks. Beating a fixed pool shows exploitation of that pool, not safety against new opponents.
Reading the sources
Shoham and Leyton-Brown’s chapter 7 is a compact treatment of multi-agent learning; section 7.1 explains why the goals of learning in games are themselves contested, and section 7.2 gives fictitious play with worked tables and convergence theorems. Multiagent Systems, chapter 7 Irving, Christiano and Amodei’s paper (arXiv v2, October 2018) is a proposal with a small experiment; it is best read for the structure of the debate game, its central claim, and its framing of that claim as an empirical question. Its later sections on reasons for optimism and worry were not read for this article. AI safety via debate
Open questions include how to evaluate agents against an open-ended population of opponents, how to trade off exploitation against robustness in practice, and when designed competition—debate, adversarial training, red-teaming—produces systems that are more truthful rather than merely more persuasive.
Make a prediction, then check
Why can a counter-agent that knows the rule make fictitious play lose every round?
Learning objectives
- Compute best responses and exploitability in zero-sum games, distinguishing exploitation of one opponent from safety against all.
- Explain the difference between empirical-frequency convergence of fictitious play and per-round exploitability, and assess designed competition such as debate.
Prerequisites & connections
Explore related knowledge →References
- Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations — scoped free PDF, revision 1.1
Yoav Shoham; Kevin Leyton-Brown · 2009 - AI safety via debate — scoped arXiv v2
Geoffrey Irving; Paul Christiano; Dario Amodei · 2018
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Claude · 2026-12-02 · Independent AI check (Claude subagent, not the author; not a human or expert review). Ran example.py with python3 (0.3 s) and diffed it against example.stdout.txt (identical); confirmed byte-identical code blocks and identical display equations. Re-derived the best response 0.3 to (0.5, 0.3, 0.2), the worst-case payoffs −1, −0.3 and 0, the exploitability formula against the code, the self-play decay ratios, and exercise 2 (−0.2, −0.1, 0.3). Re-read the sources myself via pdftotext: Shoham–Leyton-Brown pp. 202–204 and 206–210, and Irving–Christiano–Amodei arXiv v2 pp. 1, 3, 7–8 including Table 2. Compared zh and en section by section and checked data.json IDs. Did not read the debate paper's complexity proofs, human experiments or Sections 4–5, and did not render the MDX.
- Code output consistent; best response, worst-case payoffs, exploitability and exercise answers all verified.
- Fictitious-play origin, prior sensitivity, convergence theorems, anti-coordination and Shapley counterexamples match the book; Table 7.3 is not used.
- Debate MNIST numbers match the abstract and Table 2 (precommit, mean over first player) and are presented as the authors' reported results.
- zh and en correspond section by section.
Source locations checked:
- Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations — scoped free PDF, revision 1.1 · Free PDF rev. 1.1 via pdftotext (533 PDF pages): contents; Introduction pp. xiii–xvi (e-commerce agent example; loose definition 'diverging information or diverging interests, or both'; chapter overview and blocks); ch.1 p.1 (cooperative distributed problem solving, central-designer remark, sensor networks); §2.3.1 pp.28–30 (contract nets as framework; marginal-cost bids; existence of optimal contract sequence; money-losing single-task contracts; cluster/swap/multiagent contracts; anytime; bidding/clearing/information rules; no claim for adversarial settings); §7.1.3 pp.202–204 (Chicken teaching example, descriptive vs prescriptive, self-play, no procedure optimal vs all opponents); §7.2 pp.206–210 (fictitious play rule, prior sensitivity, Matching Pennies table, Thms 7.2.2–7.2.5, anti-coordination miscorrelation, Shapley game non-convergence). NOT read: other chapters, ABT details, proofs. Note: another 015k writer registered this same PDF as mas-ch3-normal-form-scoped-015k for chapter 3; scopes differ. Checker re-read via pdftotext on 2026-12-02: pp. 202–204 (Chicken: always daring is optimal against a best-responding learner; self-play; no learning procedure optimal against all opponents; rules in equilibrium with each other) and pp. 206–210 (fictitious play originally an iterative method for zero-sum equilibria; sensitivity to priors; priors cannot be all zero; Thm 7.2.4 converged empirical distribution is Nash; anti-coordination payoff 0 from miscorrelation; Shapley's almost-RPS 'not constant sum', never converges; Thm 7.2.5 zero-sum sufficient for convergence). Table 7.3 values are not used in the article.
- AI safety via debate — scoped arXiv v2 · arXiv v2 PDF via pdftotext: p.1 (abstract incl. 59.4%→88.9% given 6 pixels and 48.2%→85.2% given 4; v2 date 22 Oct 2018; introduction start), p.3 (Section 2 debate game steps 1–5, zero sum, central claim 'harder to lie than to refute a lie', hoped-for Nash equilibrium claims, self-play), p.7 (generalizations list incl. revealed context cannot be a lie; Sec. 3 empirical question; prespecified honest vs liar), p.8 (Fig. 2 and Table 2: 6-pixel judge 59.4% random, precommit mean 88.9%; 4-pixel 48.2%, precommit mean 85.2%; fixed sparse-pixel judge). NOT read: Sec. 2.2 complexity proofs, human experiments (Sec. 3.2+), Sec. 4–5 reasons for optimism/worry. Checker re-read pp. 1, 3, 7–8 via pdftotext on 2026-12-02: abstract numbers; central claim and 'whether this claim is true ... is empirical'; hoped-for Nash/self-play claims; 'debate only works if this revealed context cannot be a lie'; Table 2 (precommit honest win rate, mean over first player: 88.9% with 6 pixels vs 59.4% judge; 85.2% with 4 vs 48.2%). The article now presents these strictly as the authors' reported results and no longer claims the paper 'lists' failure modes, since Sections 4–5 were not read.
Related topics