Modeladvanced
Bayesian persuasion
Also called information design, Kamenica-Gentzkow persuasion.
A sender commits to a signaling scheme about a state to sway a receiver's action. The optimal scheme is found by concavification or an LP.
Bayesian persuasion is a model of strategic communication with commitment. A sender knows, or will learn, a payoff-relevant state; a receiver takes an action that affects both of them. Before the state is drawn, the sender commits to a signaling scheme, a rule that maps each state to a random signal. The receiver sees the signal, updates its belief by Bayes' theorem and takes its best action. The sender cannot lie about the scheme and cannot pay the receiver; its only tool is the choice of what information to reveal. Kamenica and Gentzkow (2011) showed that the sender's best value is the concave closure of its value as a function of the receiver's belief, and with finitely many states and actions the optimal scheme is the solution of a small linear program.
The machine
Players. A sender and a receiver. The model extends to several receivers, which is then called information design.
Primitives. A finite set of states with a common prior , a finite set of receiver actions, and utilities for the receiver and for the sender. Both utilities depend on the state and the action only, not on the signal.
Timing.
- The sender chooses a signaling scheme : a finite signal set and, for each state , a distribution over . The scheme is public.
- Nature draws .
- A signal is drawn and shown to the receiver.
- The receiver forms the posterior and takes an action that maximizes . Ties are broken in favor of the sender.
- The payoffs are and .
Information. The receiver knows the prior and the scheme, and sees only the signal. The sender commits before it learns the state, so the scheme cannot depend on the state that occurs except through . This commitment is what separates the model from cheap talk.
Payoffs. Write for the sender's expected utility when the receiver holds belief . A scheme induces a distribution over posteriors, and the sender's expected utility is .
What it counts
The quantity of interest is the sender's best expected utility over all schemes,
and a scheme that attains it. Secondary quantities are the value of persuasion , the gain over revealing nothing, and the number of signals an optimal scheme needs. In computational work the measure is the time to compute an optimal or near-optimal scheme as a function of and , or of a succinct description of the state space.
Example (the prosecutor). The state is guilty with prior or innocent with prior . A judge convicts if and only if its belief in guilt is at least , and acquits otherwise; the prosecutor wants a conviction in every state. With no information the judge acquits, and the prosecutor gets 0. With full information the conviction rate is . The optimal scheme sends "convict" always when guilty and with probability when innocent. The posterior after "convict" is , so the judge convicts, and the conviction rate is . The judge is not fooled: it knows the scheme and is exactly indifferent after "convict".
Relation to other models
- Mechanism design. A mechanism designer controls outcomes and payments, given the agents' private information. A persuader controls information, given that the receiver chooses the outcome. Both use a revelation principle and commitment, and both lead to LPs with incentive constraints. Automated mechanism design and the persuasion LP are close relatives.
- Correlated equilibrium. The obedience constraints of the persuasion LP have the same form as those of a correlated equilibrium: a mediator recommends actions and nobody wants to deviate. With several receivers, the outcomes that some information structure can induce are the Bayes correlated equilibria of Bergemann and Morris.
- Stackelberg games. The sender moves first and commits, so it is a leader in a Stackelberg sense. The receiver's best response is to the scheme, not to an action of the sender.
- Cheap talk. In the model of Crawford and Sobel the sender chooses its message after it learns the state and cannot commit. The equilibria there are partitions of the state space and give the sender less in general. Persuasion is the case of full commitment.
- Bayesian games. Fixing a scheme turns the interaction into a Bayesian game of the receiver alone, with the signal as its type.
Known results in the model
Bayes plausibility (theorem). A distribution over posteriors can be induced by some scheme if and only if . Necessity is the law of total probability. For sufficiency, given with finite support, send signal in state with probability ; Bayes' theorem then gives posterior .
Concavification (theorem; Kamenica and Gentzkow, Corollary 1). , where is the smallest concave function above , that is . This follows from Bayes plausibility: the sender picks any distribution of posteriors with mean , and the best average of over such distributions is the concave closure. The idea goes back to Aumann and Maschler's work on repeated games with incomplete information. In the prosecutor example, for and below, its concave closure is on , and .
When the sender benefits (theorem; Corollary 2). The sender gains from persuasion, , if and only if there is a Bayes-plausible distribution of posteriors that does better than the prior, that is if and only if is not equal to its concave closure at . For example, if the sender's utility does not depend on the state and the receiver's action at the prior is already the sender's favorite, there is no gain.
Recommendations suffice (theorem; Proposition 1). There is an optimal scheme whose signals are action recommendations that the receiver follows, so at most signals are needed. Merging all signals that lead to the same action keeps the posterior mean in the region where that action is optimal, because these regions are convex. By Carathéodory's theorem, there is also an optimal scheme with at most signals.
A linear program (theorem). With recommendations as signals, let . Then the optimal scheme is
for all and all . It has variables and obedience constraints, so it is solved in polynomial time in the explicit input.
PERSUASION-LP(μ0, u_R, u_S)- 1
make variables z(ω, a) ≥ 0, the probability of state ω and recommendation a - 2
for each state ω: add Σ_a z(ω, a) = μ0(ω) ▷ the signals average back to the prior - 3
for each pair of actions a ≠ b: add Σ_ω z(ω, a) (u_R(ω, a) - u_R(ω, b)) ≥ 0 ▷ obedience - 4
solve: maximize Σ_ω Σ_a z(ω, a) u_S(ω, a) - 5
π(a | ω) ← z(ω, a) / μ0(ω) for each state ω with μ0(ω) > 0 - 6
return π and the optimal value
The scheme that reveals nothing, with , is always feasible, so the LP is never infeasible. The tests check the LP against a brute-force concave closure for two states, which takes the best chord of between the points , and the beliefs where the receiver is indifferent between two actions.
Aligned interests (theorem). If , revealing the state fully is optimal, because full information maximizes the receiver's expected utility over all schemes.
Computation at scale. When the state space is large and given implicitly, for example as a product of independent components, the explicit LP is too big. Dughmi and Xu (2016) studied this regime and gave both efficient algorithms and hardness results, depending on how the input is represented. With many receivers, private signals and public signals lead to different problems, which is an active research area.
Code
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Shared helper of the algorithmic game theory pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Exact linear programming in Fraction, by the two-phase simplex method with Bland's rule.
lp_max(c, A_ub, b_ub, A_eq=None, b_eq=None) maximizes c x subject to A_ub x <= b_ub,
A_eq x = b_eq and x >= 0. lp_min does the same for minimization. Free variables must be
split by the caller (x = x+ - x-). Every input number is converted to Fraction, so the
result is exact: there is no tolerance anywhere.
Both functions return (status, x, value, dual). status is "optimal", "infeasible" or
"unbounded". When status is not "optimal", x, value and dual are None. dual has one entry
per constraint, the A_ub rows first and then the A_eq rows. It is the vector of shadow
prices: the value is sum_i b_i dual_i (strong duality). For lp_max, dual_i >= 0 on the
A_ub rows and A^T dual >= c. For lp_min, dual_i <= 0 on the A_ub rows and A^T dual <= c.
The entries for the A_eq rows have no sign condition.
Bland's rule (the smallest improving column enters, and among the rows with the smallest
ratio the one with the smallest basic variable leaves) makes the method finite on every
input, degenerate inputs included. There is no game algorithm in this module.
"""
from fractions import Fraction
def _frac(v):
return v if isinstance(v, Fraction) else Fraction(v)
def _pivot(T, obj, basis, r, j):
p = T[r][j]
row = [v / p for v in T[r]]
T[r] = row
for k in range(len(T)):
f = T[k][j]
if k != r and f != 0:
T[k] = [a - f * b for a, b in zip(T[k], row)]
f = obj[j]
if f != 0:
obj[:] = [a - f * b for a, b in zip(obj, row)]
basis[r] = j
def _simplex(T, obj, basis, ncols):
"""Maximize. obj[j] is the reduced cost of column j and obj[-1] is minus the value."""
while True:
enter = next((j for j in range(ncols) if obj[j] > 0), None)
if enter is None:
return "optimal"
best = None
for r, row in enumerate(T):
a = row[enter]
if a > 0:
key = (row[-1] / a, basis[r])
if best is None or key < best[0]:
best = (key, r)
if best is None:
return "unbounded"
_pivot(T, obj, basis, best[1], enter)
def _objective_row(cost, T, basis):
obj = list(cost) + [Fraction(0)]
for r, j in enumerate(basis):
f = obj[j]
if f != 0:
obj = [a - f * b for a, b in zip(obj, T[r])]
return obj
def _any_solution(M, rhs, nvars):
"""Return one solution y of M y = rhs (a consistent system), with the free variables 0."""
rows = [list(M[k]) + [rhs[k]] for k in range(len(M))]
pivots = []
r = 0
for col in range(nvars):
p = next((k for k in range(r, len(rows)) if rows[k][col] != 0), None)
if p is None:
continue
rows[r], rows[p] = rows[p], rows[r]
pv = rows[r][col]
rows[r] = [v / pv for v in rows[r]]
for k in range(len(rows)):
f = rows[k][col]
if k != r and f != 0:
rows[k] = [a - f * b for a, b in zip(rows[k], rows[r])]
pivots.append(col)
r += 1
if r == len(rows):
break
y = [Fraction(0)] * nvars
for k, col in enumerate(pivots):
y[col] = rows[k][-1]
return y
def _matrix(A, width, name):
A = [[_frac(v) for v in row] for row in (A or [])]
if any(len(row) != width for row in A):
raise ValueError(name + " must have one column per variable")
return A
def lp_max(c, A_ub, b_ub, A_eq=None, b_eq=None):
"""Maximize c x subject to A_ub x <= b_ub, A_eq x = b_eq and x >= 0, exactly."""
c = [_frac(v) for v in c]
n = len(c)
A_ub = _matrix(A_ub, n, "A_ub")
A_eq = _matrix(A_eq, n, "A_eq")
b_ub = [_frac(v) for v in (b_ub or [])]
b_eq = [_frac(v) for v in (b_eq or [])]
if len(b_ub) != len(A_ub) or len(b_eq) != len(A_eq):
raise ValueError("b_ub and b_eq must have one entry per row")
m1, m2 = len(A_ub), len(A_eq)
m = m1 + m2
width = n + m1
# Rows in the original orientation, with a slack column for each A_ub row.
orig = [A_ub[i] + [Fraction(int(k == i)) for k in range(m1)] for i in range(m1)]
orig += [A_eq[i] + [Fraction(0)] * m1 for i in range(m2)]
rhs = b_ub + b_eq
# A row gets an artificial variable if it is an equation or if its right side is negative.
need = [i >= m1 or rhs[i] < 0 for i in range(m)]
nart = sum(need)
T, basis = [], []
a = 0
for i in range(m):
sign = -1 if rhs[i] < 0 else 1
row = [sign * v for v in orig[i]] + [Fraction(0)] * nart + [sign * rhs[i]]
if need[i]:
row[width + a] = Fraction(1)
basis.append(width + a)
a += 1
else:
basis.append(n + i)
T.append(row)
if nart:
# Phase 1: maximize minus the sum of the artificial variables.
obj = _objective_row([Fraction(0)] * width + [Fraction(-1)] * nart, T, basis)
_simplex(T, obj, basis, width + nart)
if obj[-1] != 0:
return "infeasible", None, None, None
keep = []
for r in range(m):
if basis[r] >= width:
j = next((j for j in range(width) if T[r][j] != 0), None)
if j is None:
continue # the row is a combination of the other rows
_pivot(T, [Fraction(0)] * (width + nart + 1), basis, r, j)
keep.append(r)
T = [T[r][:width] + [T[r][-1]] for r in keep]
basis = [basis[r] for r in keep]
# Phase 2: the original objective, without the artificial columns.
cost = c + [Fraction(0)] * m1
obj = _objective_row(cost, T, basis)
if _simplex(T, obj, basis, width) == "unbounded":
return "unbounded", None, None, None
x = [Fraction(0)] * n
for r, j in enumerate(basis):
if j < n:
x[j] = T[r][-1]
value = sum((ci * xi for ci, xi in zip(c, x)), Fraction(0))
# The dual solves y^T A_B = c_B, where A_B holds the basic columns of the original rows.
M = [[orig[i][j] for i in range(m)] for j in basis]
dual = _any_solution(M, [cost[j] for j in basis], m)
return "optimal", x, value, dual
def lp_min(c, A_ub, b_ub, A_eq=None, b_eq=None):
"""Minimize c x subject to A_ub x <= b_ub, A_eq x = b_eq and x >= 0, exactly."""
status, x, value, dual = lp_max([-_frac(v) for v in c], A_ub, b_ub, A_eq, b_eq)
if status != "optimal":
return status, None, None, None
return status, x, -value, [-v for v in dual]
bayesian_persuasion.py 81 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/bayesian-persuasion/. The authors are listed in prov/7DNF62.jsonl.
"""Optimal Bayesian persuasion with finite states and actions, by linear programming.
prior[w] is the prior probability of state w. receiver[w][a] and sender[w][a] are the
utilities of the receiver and the sender when the state is w and the receiver takes action
a. By the revelation principle for persuasion, it is enough to consider schemes whose
signals are action recommendations that the receiver is willing to follow. The variables are
z(w, a) = Pr[state w and recommendation a], and the problem is one LP, solved exactly in
Fraction by agtlp. Ties of the receiver are broken in favor of the sender, as usual.
"""
from fractions import Fraction
from agtlp import lp_max
def optimal_scheme(prior, receiver, sender):
"""Return (value, scheme) where scheme[w][a] = Pr[recommend a | state w]."""
S, A = len(prior), len(receiver[0])
prior = [Fraction(p) for p in prior]
if any(p < 0 for p in prior) or sum(prior) != 1:
raise ValueError("prior must be a probability vector")
var = {(w, a): w * A + a for w in range(S) for a in range(A)} # @line L1
nv = S * A
A_eq, b_eq = [], []
for w in range(S): # @line L2
row = [Fraction(0)] * nv
for a in range(A):
row[var[w, a]] = Fraction(1)
A_eq.append(row)
b_eq.append(prior[w])
A_ub, b_ub = [], []
for a in range(A): # @line L3
for b in range(A):
if b != a:
row = [Fraction(0)] * nv
for w in range(S):
# Obedience written as sum_w z(w, a) (u_R(w, b) - u_R(w, a)) <= 0.
row[var[w, a]] = Fraction(receiver[w][b]) - Fraction(receiver[w][a])
A_ub.append(row)
b_ub.append(Fraction(0))
c = [Fraction(sender[w][a]) for w in range(S) for a in range(A)] # @line L4
status, z, value, _ = lp_max(c, A_ub, b_ub, A_eq, b_eq)
assert status == "optimal" # the scheme that reveals nothing is always feasible
scheme = []
for w in range(S): # @line L5
if prior[w] > 0:
scheme.append([z[var[w, a]] / prior[w] for a in range(A)])
else:
scheme.append([Fraction(int(a == 0)) for a in range(A)])
return value, scheme # @line L6
def receiver_action(belief, receiver, sender):
"""Best action of the receiver at a belief, with ties broken in favor of the sender."""
S, A = len(belief), len(receiver[0])
def key(a):
return (sum(belief[w] * Fraction(receiver[w][a]) for w in range(S)),
sum(belief[w] * Fraction(sender[w][a]) for w in range(S)))
return max(range(A), key=key)
def sender_value(belief, receiver, sender):
"""The sender's expected utility when the receiver holds this belief and acts on it."""
a = receiver_action(belief, receiver, sender)
return sum(Fraction(belief[w]) * Fraction(sender[w][a]) for w in range(len(belief)))
def posteriors(prior, scheme):
"""The signal probabilities and posteriors induced by a scheme, one per signal used."""
S, A = len(prior), len(scheme[0])
out = []
for a in range(A):
p = sum(Fraction(prior[w]) * scheme[w][a] for w in range(S))
if p > 0:
out.append((a, p, [Fraction(prior[w]) * scheme[w][a] / p for w in range(S)]))
return out
test_bayesian_persuasion.py 124 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/bayesian-persuasion/. The authors are listed in prov/7DNF62.jsonl.
import random
from fractions import Fraction
from bayesian_persuasion import optimal_scheme, posteriors, receiver_action, sender_value
F = Fraction
SEED = 20251120
def test_prosecutor_example():
# States: 0 innocent, 1 guilty. Actions: 0 acquit, 1 convict.
prior = [F(7, 10), F(3, 10)]
judge = [[1, 0], [0, 1]]
prosecutor = [[0, 1], [0, 1]]
value, scheme = optimal_scheme(prior, judge, prosecutor)
assert value == F(3, 5)
assert scheme[1] == [0, 1] and scheme[0] == [F(4, 7), F(3, 7)]
# The posterior after "convict" makes the judge exactly indifferent.
post = {a: q for a, _, q in posteriors(prior, scheme)}
assert post[1] == [F(1, 2), F(1, 2)] and post[0] == [1, 0]
# Without information the judge acquits; with full information the conviction rate is 3/10.
assert sender_value(prior, judge, prosecutor) == 0
def concave_closure_binary(mu0, receiver, sender):
"""Brute force: the concave closure of the sender's value at mu0 for two states."""
A = len(receiver[0])
points = {F(0), F(1)}
for a in range(A):
for b in range(A):
d0 = F(receiver[0][a] - receiver[0][b])
d1 = F(receiver[1][a] - receiver[1][b])
if d0 != d1:
mu = d0 / (d0 - d1)
if 0 <= mu <= 1:
points.add(mu)
def v(mu):
return sender_value([1 - mu, mu], receiver, sender)
best = v(mu0) if mu0 in points else None
for lo in points:
for hi in points:
if lo <= mu0 <= hi and lo < hi:
val = v(lo) + (v(hi) - v(lo)) * (mu0 - lo) / (hi - lo)
best = val if best is None else max(best, val)
return best
def test_matches_concavification_two_states():
rng = random.Random(SEED)
for _ in range(25):
A = rng.randint(2, 4)
receiver = [[rng.randint(-4, 4) for _ in range(A)] for _ in range(2)]
sender = [[rng.randint(-4, 4) for _ in range(A)] for _ in range(2)]
mu0 = F(rng.randint(1, 9), 10)
value, _ = optimal_scheme([1 - mu0, mu0], receiver, sender)
assert value == concave_closure_binary(mu0, receiver, sender)
def random_instance(rng, S, A):
weights = [rng.randint(1, 5) for _ in range(S)]
prior = [F(w, sum(weights)) for w in weights]
receiver = [[rng.randint(-3, 3) for _ in range(A)] for _ in range(S)]
sender = [[rng.randint(-3, 3) for _ in range(A)] for _ in range(S)]
return prior, receiver, sender
def test_scheme_is_obedient_and_attains_value():
rng = random.Random(SEED + 1)
for _ in range(15):
prior, receiver, sender = random_instance(rng, rng.randint(2, 4), rng.randint(2, 4))
value, scheme = optimal_scheme(prior, receiver, sender)
for row in scheme:
assert all(p >= 0 for p in row) and sum(row) == 1
total = F(0)
for a, p, post in posteriors(prior, scheme):
best = max(sum(post[w] * receiver[w][b] for w in range(len(prior))) for b in range(len(receiver[0])))
assert sum(post[w] * receiver[w][a] for w in range(len(prior))) == best
total += p * sender_value(post, receiver, sender)
# Bayes plausibility: the posteriors average back to the prior.
for w in range(len(prior)):
assert sum(p * post[w] for _, p, post in posteriors(prior, scheme)) == prior[w]
assert total == value
def test_at_least_no_information_and_full_information():
rng = random.Random(SEED + 2)
for _ in range(15):
S = rng.randint(2, 4)
prior, receiver, sender = random_instance(rng, S, rng.randint(2, 4))
value, _ = optimal_scheme(prior, receiver, sender)
no_info = sender_value(prior, receiver, sender)
full = sum(prior[w] * sender_value([F(int(k == w)) for k in range(S)], receiver, sender) for w in range(S))
assert value >= no_info and value >= full
assert value <= sum(prior[w] * max(sender[w]) for w in range(S))
def test_aligned_interests_reveal_everything():
rng = random.Random(SEED + 3)
for _ in range(10):
S = rng.randint(2, 4)
prior, receiver, _ = random_instance(rng, S, rng.randint(2, 4))
value, _ = optimal_scheme(prior, receiver, receiver)
full = sum(prior[w] * max(receiver[w]) for w in range(S))
assert value == full
def test_receiver_action_breaks_ties_for_sender():
receiver = [[1, 0], [0, 1]]
sender = [[0, 1], [0, 1]]
assert receiver_action([F(1, 2), F(1, 2)], receiver, sender) == 1
assert receiver_action([F(3, 5), F(2, 5)], receiver, sender) == 0
def test_bad_prior():
try:
optimal_scheme([F(1, 2), F(1, 3)], [[0], [0]], [[0], [0]])
except ValueError:
return
raise AssertionError("expected ValueError")
References
- Emir Kamenica and Matthew Gentzkow, Bayesian persuasion, American Economic Review 101(6) (2011), 2590-2615, the prosecutor example; Proposition 1 (p. 2595) on recommendation schemes; Corollary 1 (p. 2596) on the value as the concave closure; Corollary 2 (p. 2597) on when the sender benefits
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag 7DNF62 Edit this page History Report an error Markdown