Search

Search papers and lessons

DeepStack: Expert-Level Artificial Intelligence in No-Limit Poker

Matej Moravčík, Martin Schmid, Neil Burch et al. · 2017

DeepStack plays heads-up no-limit poker by re-solving each decision as it arises, using a learned value network instead of a full strategy, and it beat professional players with statistical significance.

On this page

  • Colour = topic mix
  • Discrete math
  • Probability
  • Game theory
  • Reinforcement learning
  • Calculus
  • Linear algebra
  • ReadReady to readNot yet

TL;DR

DeepStack is an AI that plays heads-up no-limit Texas hold'em, a two-player poker game about as large as the game of Go. It does not compute and store a full strategy before play. Each time it must act, it re-solves the current decision with a short lookahead, and it replaces the rest of the game with a neural network trained on random poker situations. In a study of 44,852 games against 33 professional players, it won overall by 492 mbb/g, and it beat most of the players who finished the full match by a statistically significant margin.

Builds on: counterfactual regret minimisation, Nash equilibrium, neural networks, Bayes' rule · Leads to: nothing in this graph yet

Why it mattered

Before DeepStack, the strongest poker programs worked by simplifying the game. They grouped similar hands and similar bet sizes into a smaller abstract game, solved that game offline, and translated the real opponent's bets into the abstraction. The abstraction was a large loss of information. In 2015 the program Claudico lost to a team of professionals by 91 mbb/g, and in the authors' local best-response tests all four leading abstraction-based programs could still be beaten by more than 3,000 mbb/g.

DeepStack showed a different route. It kept the reasoning of counterfactual regret minimisation, it used no card abstraction, and it used no expert human games for training. The paper argues that this is the first sound application of heuristic search to an imperfect-information game, the idea behind the successes in chess and Go. That matters beyond poker. The paper points to settings with hidden information, such as defending strategic resources and recommending medical treatment, where the same kind of reasoning applies.

The problem

Heads-up no-limit hold'em has about 1016010^{160} decision points. The right decision depends on the probability distribution over the opponent's private cards, and that distribution is revealed through the opponent's past actions. So a player must reason about what the opponent believes about them, and so on. This is why a player cannot reason about a situation in isolation, as perfect-information search does.

Counterfactual regret minimisation handles this recursion, but the full game is too large to solve directly, so earlier programs solved an abstracted game with about 101410^{14} situations. Re-solving a subtree from the current point needs two things: the player's own range over hands, and a vector of counterfactual values for the opponent. Re-solving from the root is too expensive, and in an imperfect-information game a subtree cannot simply be replaced by a fixed heuristic value, because the values depend on the players' ranges.

How it works

DeepStack's play can be traced as a loop. The steps below follow one decision from start to finish.

  1. Keep two vectors, not a strategy. DeepStack stores its own range, a probability for each private hand, and a vector of counterfactual values for the opponent, one per hand. At the start, the range is uniform and the opponent values are the values of being dealt each hand.
  2. Re-solve the current decision. When it must act, DeepStack solves the lookahead from the current public state, using only the stored range and opponent values. The lookahead uses a small set of actions: fold where legal, call, two or three bet sizes, and all-in.
  3. Stop at the depth limit with intuition. The lookahead stops at the end of the current betting round or after four actions. Beyond that point, a deep counterfactual value network estimates the values. It is a feedforward network with seven hidden layers of 500 units. Its inputs are the pot size, the public cards, and both players' ranges, with each range clustered into 1,000 buckets. Its outputs are a value for each hand of each player.
  4. Act, then discard the strategy. DeepStack samples an action from the strategy computed in the re-solve, plays it, and throws the strategy away. It never plans more than its next action.
  5. Update the two vectors. After its own action, DeepStack replaces the opponent values with those the re-solve computed for the chosen action, and it updates its own range with Bayes' rule. After a card is dealt, it takes the opponent values for that card from the last re-solve and removes impossible hands from its range. After an opponent action, nothing needs to change, because DeepStack never has to translate the opponent's bet into an abstraction.
  6. Repeat at the next decision. The loop starts again from the new public state.

Before play, two networks are trained. A turn network is trained on 10 million randomly generated turn situations, each with random ranges, public cards and pot size, and each labelled by solving the game. A flop network is trained on 1 million situations in the same way, using the turn network at its own depth limit.

flowchart LR
  A[Keep own range and opponent values] --> B[Re-solve the current decision with a short lookahead]
  B --> C[Value network at the depth limit]
  C --> D[Act with the sampled action, discard the strategy]
  D --> E[Update range by Bayes rule and opponent values]
  E --> A

The math

The paper's guarantee rests on a few definitions. In a two-player zero-sum game such as poker, a Nash equilibrium is a strategy pair that does best against the other player's best response. The exploitability of a strategy σ\sigma is how far a best-response opponent can gain above the equilibrium value. A strategy with exploitability zero is an equilibrium.

Definition: Counterfactual value

For a player ii, a public state ss and a hand hh, the counterfactual value is the expected utility to ii of holding hh at ss. It counts the chance and opponent actions that lead to ss but not ii's own actions, so it is a "what-if" value: what hh is worth if ss is reached.

The network output and its correction

The network returns counterfactual values v^1\hat v_1 and v^2\hat v_2 for both players. Given ranges r1r_1 and r2r_2, each player's game value estimate is a weighted sum, gi=ri⊤v^ig_i = r_i^\top \hat v_i. In a zero-sum game the two values must sum to zero, but a learned estimate need not. DeepStack subtracts half of the total from each player's values:

δ=12(g1+g2),v^i←v^i−δ.\delta = \tfrac{1}{2}\left(g_1 + g_2\right), \qquad \hat v_i \leftarrow \hat v_i - \delta.

Since each range sums to one, the corrected values satisfy (g1−δ)+(g2−δ)=0(g_1 - \delta) + (g_2 - \delta) = 0. For example, if g1=0.6g_1 = 0.6 and g2=0.2g_2 = 0.2, then δ=0.4\delta = 0.4, the corrected sums are 0.20.2 and −0.2-0.2, and they cancel.

The soundness theorem

The paper's Theorem 1 says that if the value function has error less than ϵ\epsilon at the depth limit, and TT iterations of counterfactual regret minimisation are used in each re-solve, then the strategy's exploitability is less than k1ϵ+k2/Tk_1 \epsilon + k_2/\sqrt{T}, where k1k_1 and k2k_2 are constants for the game. The bound says that better intuition and more solver iterations both reduce the exploitability. The guarantee requires the full set of actions; the sparse action set used in practice is outside it, as the paper notes.

Size of the re-solved game

With a depth limit of four actions, the re-solved game has at most about 101710^{17} decision points, down from 1016010^{160} at the start. The sparse action set reduces the re-solve further to about 10710^{7} decision points.

Results

The main test was a study of 44,852 games against 33 professional players recruited from 17 countries. Each player was asked to complete 3,000 games over four weeks, between 7 November and 12 December 2016. Eleven players completed the full match.

MeasureResult
All games, chips wonDeepStack won 492 mbb/g
All games, AIVAT luck-adjusted486 mbb/g
The 11 players who completed 3,000 gamesDeepStack won 394 mbb/g on average, beating 10 of the 11 by a statistically significant margin
The best playerDeepStack was estimated to lose 70 mbb/g, not significant

The paper states that professional players regard a margin of 50 mbb/g as sizable. AIVAT is a variance-reduction method built on control variates, and the authors report an 85 percent reduction in standard deviation, which is why 3,000 games were enough for significance.

For exploitability, the paper uses local best response (LBR), which gives a lower bound on how exploitable a strategy is.

ProgramLBR lower bound (mbb/g)
Hyperborean (2014)4675
Slumbot (2016)4020
Act1 (2016)3302
Always Fold750
DeepStackno positive lower bound found

Under every tested setting of LBR's actions, LBR lost 350 mbb/g or more to DeepStack.

Limits. The authors say that these experiments do not prove DeepStack is flawless. LBR is a lower bound, so it can miss weaknesses that a more sophisticated search would find. The sparse action set used in practice steps outside the soundness theorem. The matches were heads-up only, in one game format. For the strongest player, the 3,000-game sample was not enough to reach statistical significance either way.

Reading guide

The paper has no numbered sections. Read it in this order, with each part mapped to the lessons it leans on.

PartWhat it doesLessons to have in mind
IntroductionMotivates imperfect-information search and contrasts it with abstractionCounterfactual Regret Minimization, Nash Equilibrium
DeepStackExplains continual re-solving, depth-limited lookahead and sparse actionsContinual Re-Solving, Best Response, Value Function
Deep counterfactual value networksDescribes the network architecture, its inputs and its trainingFeedforward Neural Network, Parametric ReLU (PReLU), Function Approximation, Adam Optimizer
Evaluating DeepStackExplains AIVAT and the match resultsControl Variate, Expected Value
ExploitabilityUses local best response to bound how exploitable DeepStack isBest Response, Nash Equilibrium
Game and glossaryDefines heads-up no-limit hold'em and its termsExtensive-Form Game
Implementation and proofGives the algorithm and the soundness proofCounterfactual Regret Minimization, Minimax Game

Check yourself

QuestionRecall: instead of a full strategy, what two vectors does DeepStack keep between decisions?Show answer
Its own range, a probability over its private hands, and a vector of opponent counterfactual values, one per hand. Together they are enough to re-solve the current decision.
QuestionComputation: a network returns game-value sums g1=0.7g_1 = 0.7 and g2=0.1g_2 = 0.1. What correction is applied, and what are the sums afterwards?Show answer
The correction is δ=(0.7+0.1)/2=0.4\delta = (0.7 + 0.1)/2 = 0.4. Subtracting it gives 0.7−0.4=0.30.7 - 0.4 = 0.3 for player 1 and 0.1−0.4=−0.30.1 - 0.4 = -0.3 for player 2. They sum to zero, as a zero-sum game requires.
QuestionWhy: why does DeepStack's depth limit need a network that takes the players' ranges as inputs, rather than a fixed value for each public state?Show answer
In an imperfect-information game the counterfactual values at a public state depend on how each player reached it, which is captured by their ranges. The ranges also change on each iteration of the solver. A fixed value would be wrong for most of those iterations, so the network takes the ranges as input and returns values for them.
QuestionApplied: a team wants to build a DeepStack-style player for a three-player poker game. What parts of the paper's guarantee would no longer hold directly, and what should they check?Show answer
The guarantee is proved for two-player zero-sum games, where a Nash equilibrium is a clean solution and the zero-sum correction is valid. With three players, equilibria are not interchangeable and the zero-sum correction does not apply. The team should choose an appropriate solution concept, check the value network's errors on held-out situations, and measure exploitability with a method that fits their game.

Sources

Read the full paper

Matej Moravčík, Martin Schmid, Neil Burch et al., 2017. arXiv:1701.01724

DeepStack paper explained · ungoon.me