Simple Algorithm
Reinforcement Learning · Bootstrapping · 24 min

Imperfect-Information Games: Poker

Hidden information, counterfactual regret minimization and superhuman poker.

In chess both players see the whole board, so an endgame can be solved by itself. In poker the decisive facts are hidden: what a bet is worth depends on what your opponent believes about your cards, and those beliefs depend on how you would play every other hand. This lesson builds the model for such games, solves a three-card poker game by hand, derives counterfactual regret minimization, the algorithm inside every superhuman poker program, and follows it from limit hold'em, essentially solved in 2015, to six-player no-limit hold'em in 2019.

What you’ll learn

  • Model a game with hidden information as an extensive-form game with chance, information sets and behavioral strategies, and explain what perfect recall and Kuhn's theorem buy.
  • Solve Kuhn poker by indifference: derive the one-third bluffing and calling frequencies, the one-parameter family of equilibria and the value −118-\tfrac1{18}.
  • Show with a computed example why a subgame of an imperfect-information game cannot be solved on its own, and price the mistake.
  • Define counterfactual values and regrets, implement CFR, and explain why its average strategy converges to a Nash equilibrium while its current strategy need not.
  • Describe what Cepheus, DeepStack, Libratus and Pluribus each added, and what their results do and do not establish.

Games with hidden information

The Markov games of Games, Equilibria & Markov Games let every player see the state. Poker does not: you see your cards, not your opponent's, and you face a history of bets that many different hands could have produced. Games with imperfect information are modeled as extensive-form games, trees of sequential decisions in which a player cannot always tell which node she is at.

A player has perfect recall if she never forgets what she observed or did: all histories in one of her information sets pass through the same sequence of her own earlier information sets and actions. Card games played honestly have it. Perfect recall matters because of Kuhn's theorem (Kuhn, 1953): every mixed strategy, a probability distribution over complete contingency plans, then has a behavioral strategy that produces the same distribution over terminal histories against every opponent. The savings are exponential. A player with nn binary decisions has 2n2^n pure strategies, but a behavioral strategy is nn numbers.

For two-player zero-sum games with perfect recall, the sequence form (von Stengel, 1996) writes equilibrium computation as a linear program whose size is linear in the game tree. The catch is the tree: heads-up no-limit Texas hold'em has more than 1016010^{160} decision points. Everything in this lesson is about working on such trees a piece at a time.

Progress is measured by exploitability. For a profile σ\sigma of a two-player zero-sum game it is the total that the two players could gain by switching, one at a time, to a best response:

e(σ)=max⁡σ1′u1(σ1′,σ2)+max⁡σ2′u2(σ1,σ2′).e(\sigma)=\max_{\sigma_1'}u_1(\sigma_1',\sigma_2)+\max_{\sigma_2'}u_2(\sigma_1,\sigma_2').

Since u1(σ)+u2(σ)=0u_1(\sigma)+u_2(\sigma)=0, each term is a gain over current play, so e(σ)≥0e(\sigma)\ge0, with equality exactly at a Nash equilibrium. This is the quantity also called NashConv; OpenSpiel reports half of it, and the widgets of this topic report ee.

Check your understanding

In Kuhn poker (rules in the next step), player 1 acts at 6 information sets with 2 actions each: for each of the three cards, the opening decision and the decision after check, bet. How many pure strategies does player 1 have, and how many numbers describe a behavioral strategy?

  1. 6 pure strategies; 12 numbers
  2. 12 pure strategies; 6 numbers
  3. 64 pure strategies; 6 numbers
  4. 64 pure strategies; 64 numbers
Show the answer

C. 64 pure strategies; 6 numbers

A pure strategy picks one of 2 actions at each of the 6 information sets, so there are 26=642^6=64 of them. A behavioral strategy needs one probability per information set (the other action gets the complement): 6 numbers. In large games the gap is astronomical, which is why every algorithm below stores one distribution per information set.

Kuhn poker, solved by hand

Kuhn poker (Kuhn, 1950) is poker cut to the bone. The deck is J < Q < K. Each player antes 1 chip and receives one card; the third card is not used. Player 1 (P1) checks or bets 1. After a bet, the other player folds, losing the ante, or calls. After a check, player 2 (P2) checks or bets 1, and P1 then folds or calls. The six deals are equally likely, and each player has six information sets, one per card at each of two decision points: twelve in all.

Betting sequenceResult for P1
check, checkshowdown: +1+1 or −1-1
bet, fold+1+1
bet, callshowdown: +2+2 or −2-2
check, bet, fold−1-1
check, bet, callshowdown: +2+2 or −2-2
Net payoffs: the winner takes the loser's ante, plus the bet if one was called. P2 receives the negative.

Some decisions are easy: a K always calls, P2 always bets a K after a check, and a J never calls. The interesting ones are the bluff, betting a J, which wins only if a Q folds, and the bluff-catch, calling with a Q, which beats only a bluff. Equilibrium mixing is found the standard way: a player mixes only between actions of equal value, so each mixing frequency must make the opponent indifferent.

DerivationBluffing and calling by indifference
  1. 2β−21+β⏟call=−12β1⏟fold⟺β=13\underbrace{\frac{2\beta-2}{1+\beta}}_{\text{call}}=\underbrace{-1\vphantom{\frac{2\beta}{1}}}_{\text{fold}}\qquad\Longleftrightarrow\qquad\beta=\tfrac13

    P1 holds Q after check, bet. P2 bets every K and bluffs a J with probability β\beta, so given the bet, P2 holds J with probability β/(1+β)\beta/(1+\beta). Calling wins 2 against a J and loses 2 against a K; folding loses the ante. P1 can mix only if

  2. 12(−2)+12(η⋅(−2)+(1−η)⋅1)=−1+12(1−3η)=−1⟺η=13\tfrac12(-2)+\tfrac12\big(\eta\cdot(-2)+(1-\eta)\cdot1\big)=-1+\tfrac12(1-3\eta)=-1\qquad\Longleftrightarrow\qquad\eta=\tfrac13

    P1 holds J. Checking loses 1 whatever P2 holds: a Q checks behind and wins the showdown, a K bets and the J folds. Betting loses 2 to a K and wins 1 when a Q folds. If P2 calls with Q with probability η\eta:

  3. 2α−2γα+γ=−1⟺γ=3α\frac{2\alpha-2\gamma}{\alpha+\gamma}=-1\qquad\Longleftrightarrow\qquad\gamma=3\alpha

    P2's mixing must be justified in turn. P2 holds Q facing a bet; P1 bets a J with probability α\alpha and a K with probability γ\gamma. Calling wins 2 against a J and loses 2 against a K; folding loses 1:

  4. (1−3ζ)+(1−3α)(−2)1+(1−3α)=−1⟺ζ=α+13\frac{(1-3\zeta)+(1-3\alpha)(-2)}{1+(1-3\alpha)}=-1\qquad\Longleftrightarrow\qquad\zeta=\alpha+\tfrac13

    P2 holds J after a check. P1 checks every Q and checks a K with probability 1−3α1-3\alpha, and calls a bet with Q with probability ζ\zeta. Checking behind loses 1. A bluff earns 1−3ζ1-3\zeta against a Q and −2-2 against a K, so indifference requires

Deal (P1, P2)Play at α=0\alpha=0P1's expected payoff
J, Qcheck, check; Q wins−1-1
J, Kcheck, bet, fold−1-1
Q, Jcheck; P2 bluffs 13\tfrac13; P1 calls 13\tfrac1323⋅1+13(13⋅2+23⋅(−1))=23\tfrac23\cdot1+\tfrac13\big(\tfrac13\cdot2+\tfrac23\cdot(-1)\big)=\tfrac23
Q, Kcheck, bet; P1 calls 13\tfrac1313⋅(−2)+23⋅(−1)=−43\tfrac13\cdot(-2)+\tfrac23\cdot(-1)=-\tfrac43
K, Jcheck; P2 bluffs 13\tfrac13; P1 calls13⋅2+23⋅1=43\tfrac13\cdot2+\tfrac23\cdot1=\tfrac43
K, Qcheck, check; K wins+1+1
The six payoffs sum to −13-\tfrac13, so the value is −13/6=−118≈−0.056-\tfrac13/6=-\tfrac1{18}\approx-0.056. The one-third bluffs and calls keep both sides honest: change any of them and the other side gains by adjusting.
Predict before you look

In an equilibrium in which P1 bets its K 60% of the time, how often does P1 call with Q after check, bet?

Show the answer

0.53

A K bet of 3α=0.63\alpha=0.6 means α=0.2\alpha=0.2: P1 bluffs with J 20% of the time and must call with Q with probability α+13≈0.533\alpha+\tfrac13\approx0.533. The more often P1 bets its K, the fewer Ks remain among its checks, so its checking range is weaker, and it must defend that range by calling more often.

Why a subgame cannot be solved alone

In a perfect-information game the tree below a node can be solved without looking anywhere else: its value depends only on what can happen below it, which is why chess engines and AlphaZero search from the current position. In an imperfect-information game this fails. After check, bet, a P1 holding Q does not know which history of its information set it is at. The probabilities of those histories come from P2's betting frequencies with J and K, and P2 chose those by weighing payoffs in other branches, such as checking behind.

DerivationAn unsafe re-solve in Kuhn poker
  1. 2(0.3)−21.3≈−1.077<−1⟹fold every Q\frac{2(0.3)-2}{1.3}\approx-1.077<-1\qquad\Longrightarrow\qquad\text{fold every Q}

    Suppose P1 carries a precomputed strategy, a blueprint, and on reaching check, bet with a Q it re-solves that spot, assuming P2 plays its blueprint. If the blueprint bluffs J with β=0.3\beta=0.3, a little below 13\tfrac13, calling is worth less than folding:

  2. 16[−1⏟J,Q −1⏟J,K −1⏟Q,J −1⏟Q,K +2⏟K,J +1⏟K,Q]=−16\tfrac16\big[\underbrace{-1}_{\text{J,Q}}\ \underbrace{-1}_{\text{J,K}}\ \underbrace{-1}_{\text{Q,J}}\ \underbrace{-1}_{\text{Q,K}}\ \underbrace{+2}_{\text{K,J}}\ \underbrace{+1}_{\text{K,Q}}\big]=-\tfrac16

    But P2 is not bound to its blueprint. Against a P1 that folds every Q, a bluff with J after a check wins 1 against a Q and loses 2 against a K, worth −12-\tfrac12 against −1-1 for checking, so P2 bluffs every J and still bets every K. With P1 checking every hand (α=0\alpha=0), the six deals now pay P1

  3. P1 now loses three times the equilibrium amount of 118\tfrac1{18}: the re-solve, correct against the assumed blueprint, opened a hole worth 19\tfrac19 per hand. The opposite deviation, calling with every Q, is punished just as hard (P2 stops bluffing and keeps value-betting its K), and also leaves P1 at −16-\tfrac16. Only the calling frequency α+13\alpha+\tfrac13 is safe, and it is pinned down by P2's incentives with a J, that is, by payoffs outside the subgame.

Check your understanding

A poker program re-solves the last betting round assuming the opponent reached it with the hands its blueprint says, and finds that folding a medium-strength hand to every bet is optimal. Why can deploying this be a mistake?

  1. Folding is never correct in poker
  2. The opponent can change how often it arrives there with bluffs, and folding every medium hand invites it to bluff with everything
  3. The re-solve used too few iterations
  4. Re-solving is valid only in games that are not zero-sum
Show the answer

B. The opponent can change how often it arrives there with bluffs, and folding every medium hand invites it to bluff with everything

The conclusion holds only for the assumed arrival probabilities, and those are the opponent's to choose. A best response to one assumption can be exploited by an opponent who adapts, as in Kuhn poker, where folding every Q loses 16\tfrac16 per hand instead of 118\tfrac1{18}. Safe re-solving guards against this.

Counterfactual regret minimization

Two learners whose regret grows sublinearly produce, on average, an approximate equilibrium of a zero-sum game: the argument of Adversarial Bandits & EXP3. Running one regret minimizer over the whole game would need an "arm" for every pure strategy, exponentially many. Counterfactual regret minimization (CFR; Zinkevich, Johanson, Bowling & Piccione, 2007) runs a small regret minimizer at every information set instead, on a local notion of value.

The value is counterfactual because player ii's own reach is left out: it asks what ii would earn at II if she played to get there. Information sets that her current strategy almost never visits therefore still receive full-strength regrets and are still learned. (Zinkevich et al. normalize the value by π−iσ(I)\pi^\sigma_{-i}(I) and multiply the regrets by it again; the unnormalized form above, from Lanctot et al. (2009), gives the same regrets.) The average needs the reach weights because a decision deep in the tree matters only as often as the strategy gets there: with them, σˉT\bar\sigma^T plays exactly like picking one of σ1,…,σT\sigma^1,\dots,\sigma^T uniformly at random before the game starts.

python
import itertools
import numpy as np

R, S = {}, {}          # per information set: cumulative regrets, reach-weighted strategy sums

def payoff(c, h):      # to player 0 at a terminal history; 'p' = check/fold, 'b' = bet/call
    if h in ('bp', 'pbp'): return 1 if h == 'bp' else -1           # someone folded
    return (2 if 'b' in h else 1) * (1 if c[0] > c[1] else -1)      # showdown

def cfr(c, h, pi, sigma, dR):    # pi = reach of player 0, player 1, chance; returns u_0
    if h in ('pp', 'bp', 'pbp', 'bb', 'pbb'): return payoff(c, h)
    i = len(h) % 2; I = 'JQK'[c[i]] + h         # player to act; own card + public actions
    s, sign = sigma[I], (1, -1)[i]              # zero-sum: player 1 receives -u_0
    u = np.array([sign * cfr(c, h + a, [p * s[k] if j == i else p for j, p in enumerate(pi)],
                             sigma, dR) for k, a in enumerate('pb')])
    dR[I] = dR.get(I, 0) + pi[1 - i] * pi[2] * (u - s @ u)    # counterfactual regrets
    S[I] = S.get(I, 0) + pi[i] * s                            # average weighted by own reach
    return sign * (s @ u)

for t in range(10_000):          # both players update from the same profile sigma^t
    sigma = {}
    for I in [c + h for c in 'JQK' for h in ('', 'p', 'b', 'pb')]:   # the 12 information sets
        r = np.maximum(R.get(I, np.zeros(2)), 0)
        sigma[I] = r / r.sum() if r.sum() > 0 else np.full(2, 0.5)   # regret matching
    dR = {}
    for c in itertools.permutations(range(3), 2):                    # the 6 deals
        cfr(c, '', [1, 1, 1 / 6], sigma, dR)
    for I, d in dR.items(): R[I] = R.get(I, 0) + d

Vanilla CFR on Kuhn poker. Players 0 and 1 are P1 and P2; 'p' is check or fold and 'b' bet or call. Each iteration fixes the profile σt\sigma^t by regret matching, walks all six deals, and only then adds the regrets, so both players update from the same profile. After 10,000 iterations the reach-weighted average in S (normalize each entry) is exploitable by about 0.0046, the same run as in the widgets, and plays Kuhn's family with α≈0.21\alpha\approx0.21.

Predict before you look

Kuhn poker has ∣I1∣=∣I2∣=6\abs{\mathcal I_1}=\abs{\mathcal I_2}=6, two actions at every information set, and payoffs from −2-2 to 22. What exploitability does the theorem guarantee for CFR's average strategy after T=10,000T=10{,}000 iterations?

Show the answer

0.68

Δ=4\Delta=4, so the bound is 4⋅12⋅2/104≈0.684\cdot12\cdot\sqrt2/\sqrt{10^4}\approx0.68. The widget measures 0.0046, about 150 times less. The bound is a worst case over games and opponents; in practice CFR beats its guarantee by a wide margin, and its variants beat CFR.

From Kuhn poker to superhuman play

Kuhn poker has 12 information sets. Heads-up limit Texas hold'em has 3.19×10143.19\times10^{14} decision points, and heads-up no-limit (HUNL), where bets can be any size up to the stacks, more than 1016010^{160}. Two ideas carried CFR to these games. Abstraction solves a smaller game, bucketing similar hands and allowing only a few bet sizes, and maps the solution back. Search re-solves the part of the game actually reached, during play and in more detail, with safe subgame solving. Results are reported in milli-big-blinds per game (mbb/g): thousandths of the big blind won per hand.

ProgramGameKey ideasResult
Cepheus (Bowling, Burch, Johanson & Tammelin, 2015)Heads-up limit hold'emCFR+ on the full game (symmetries removed, values compressed); about 900 core-years on 4,800 cores over 68 daysExploitability 0.986 mbb/g, "essentially weakly solved"; the dealer wins 87.7–89.7 mbb/g
DeepStack (Moravčík et al., 2017)HUNLContinual re-solving with a depth-limited lookahead; neural networks estimate counterfactual values at the depth limit; one GPU at play time44,852 hands against 33 professionals (Nov–Dec 2016): +486 mbb/g with variance reduction
Libratus (Brown & Sandholm, 2018)HUNLBlueprint from a Monte Carlo CFR variant on an abstraction; nested safe subgame solving; overnight self-improvement on the bet sizes opponents usedJanuary 2017: 120,000 hands against four top heads-up specialists, +147 mbb/game (p≈0.0002p\approx0.0002)
Pluribus (Brown & Sandholm, 2019)Six-player no-limit hold'emBlueprint from Monte Carlo Linear CFR (12,400 CPU core hours); depth-limited search in which every player chooses among four continuation strategies at the leaves; two CPUs at play time+48 mbb/game (standard error 25) over 10,000 hands against five professionals at a time, from a pool of 13
The subtopic lessons take each ingredient apart: CFR+ and Monte Carlo CFR in Counterfactual Regret Minimization, abstraction and safe, nested and depth-limited solving in Subgame Solving: Libratus & Pluribus, and continual re-solving and its successors in Search with Imperfect Information: DeepStack & ReBeL.

Key takeaways

  • Imperfect-information games are extensive-form games with information sets. With perfect recall, behavioral strategies (one distribution per information set) lose nothing (Kuhn's theorem), and exploitability measures the distance from equilibrium.
  • Kuhn poker is solved by indifference: P2 bluffs with J and calls with Q one-third of the time; P1's equilibria form a family indexed by its J-bluff frequency α∈[0,13]\alpha\in[0,\tfrac13], with K bets 3α3\alpha, Q calls α+13\alpha+\tfrac13 and value −118-\tfrac1{18}.
  • A subgame's solution depends on how likely each hand is to arrive there, which strategies elsewhere determine; re-solving with those probabilities fixed is exploitable (folding every Q in Kuhn poker triples P1's loss).
  • CFR runs regret matching on counterfactual regrets at every information set; its reach-weighted average strategy has exploitability O(1/T)O(1/\sqrt T) in two-player zero-sum games, while its current strategy can cycle.
  • CFR+ on the full game essentially solved heads-up limit hold'em (Cepheus, 2015); adding safe re-solving and search beat professionals at heads-up no-limit (DeepStack, Libratus, 2017) and six-player no-limit (Pluribus, 2019), the last without any equilibrium guarantee.

Check yourself

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

Question 1

In CFR's counterfactual value vi(σ,I)v_i(\sigma,I), how are the histories h∈Ih\in I weighted?

  1. By πσ(h)\pi^\sigma(h), the probability that play reaches hh under σ\sigma
  2. By π−iσ(h)\pi^\sigma_{-i}(h), the probability contributed by chance and the opponent, as if player ii had played to reach II
  3. By πiσ(h)\pi^\sigma_i(h), player ii's own probability of reaching hh
  4. Uniformly, since player ii cannot tell them apart
Show the answer

B. By π−iσ(h)\pi^\sigma_{-i}(h), the probability contributed by chance and the opponent, as if player ii had played to reach II

Leaving out player ii's own reach makes the value counterfactual: it measures what ii would earn at II if she aimed for it, so information sets her current strategy rarely visits still get full-strength regrets. The opponent's and chance's probabilities still say which histories in II are likely.

Question 2

In a Kuhn-poker equilibrium, P1 bluffs with its J 10% of the time. How often does it bet its K, and how often does it call with Q after check, bet?

  1. K 10%; call with Q 43%
  2. K 30%; call with Q 33%
  3. K 90%; call with Q 10%
  4. K 30%; call with Q 43%
Show the answer

D. K 30%; call with Q 43%

α=0.1\alpha=0.1 gives a K bet of 3α=0.33\alpha=0.3, which keeps P2's Q indifferent between calling and folding (bluffs and value bets in the ratio 1 : 3), and a Q call of α+13≈0.433\alpha+\tfrac13\approx0.433, which keeps P2's J indifferent about bluffing.

Question 3

After 10,000 iterations of vanilla CFR on Kuhn poker, which strategy should you play?

  1. The current strategy σT\sigma^T, because it reflects the most recent regrets
  2. The uniform strategy, because it cannot be exploited
  3. Either one: both have converged to the same equilibrium
  4. The average strategy σˉT\bar\sigma^T, weighted by each player's own reach probabilities
Show the answer

D. The average strategy σˉT\bar\sigma^T, weighted by each player's own reach probabilities

The guarantee is for the average: CFR is a no-regret learner, and in a two-player zero-sum game the average profile of no-regret learners is an approximate equilibrium. In the widget, CFR's current strategy stays nearly pure and exploitable by 0.3 to 0.5, while the average reaches 0.0046 after 10,000 iterations. The reach weighting makes the averaged behavioral strategy play like a uniform mixture of the iterates.

Question 4

Why can a chess program solve an endgame position by itself, while a poker program cannot solve the final betting round of a hand by itself?

  1. Poker has chance nodes and chess does not
  2. Poker's final round is larger than a chess endgame
  3. The value of poker's final round depends on how likely each player is to hold each hand there, which the strategies played earlier determine
  4. Poker programs cannot compute best responses
Show the answer

C. The value of poker's final round depends on how likely each player is to hold each hand there, which the strategies played earlier determine

A perfect-information position has a value of its own. A poker subgame's value, and its optimal strategy, depend on the distribution of hands that reach it, which both players' earlier strategies produce and which an opponent can change. Fixing that distribution from a blueprint is unsafe subgame solving.

Question 5

Which statement about Pluribus (Brown & Sandholm, 2019) is accurate?

  1. It computed a Nash equilibrium of six-player no-limit hold'em
  2. It needed a large GPU cluster to play in real time
  3. It beat elite professionals by a statistically significant margin, although no known algorithm guarantees an equilibrium in six-player poker, or that playing one would be safe
  4. It learned by imitating millions of hands played by humans
Show the answer

C. It beat elite professionals by a statistically significant margin, although no known algorithm guarantees an equilibrium in six-player poker, or that playing one would be safe

Over 10,000 hands against professionals, five at a time from a pool of 13, it won 48 milli-big-blinds per game with a standard error of 25 (with variance reduction), and it also won when one professional sat with five copies of it. Its blueprint took 12,400 CPU core hours and it played on two CPUs. Outside two-player zero-sum games, CFR-style methods carry no equilibrium guarantee, and equilibria chosen independently by different players need not combine into an equilibrium.

Go deeper

Further reading

  • H. W. Kuhn, "A simplified two-person poker," in Contributions to the Theory of Games I, Annals of Mathematics Studies 24, 97–103 (Princeton University Press, 1950).
  • M. Zinkevich, M. Johanson, M. Bowling & C. Piccione, "Regret minimization in games with incomplete information," Advances in Neural Information Processing Systems 20 (2007).
  • M. Bowling, N. Burch, M. Johanson & O. Tammelin, "Heads-up limit hold'em poker is solved," Science 347(6218), 145–149 (2015).
  • N. Brown & T. Sandholm, "Superhuman AI for multiplayer poker," Science 365(6456), 885–890 (2019).