Abstract
Fictitious play with reinforcement learning is a general and effectiveframework for zero-sum games. However, using the current deep neural networkmodels, the implementation of fictitious play faces crucial challenges. Neuralnetwork model training employs gradient descent approaches to update allconnection weights, and thus is easy to forget the old opponents after trainingto beat the new opponents. Existing approaches often maintain a pool ofhistorical policy models to avoid the forgetting. However, learning to beat apool in stochastic games, i.e., a wide distribution over policy models, iseither sample-consuming or insufficient to exploit all models with limitedamount of samples. In this paper, we propose a learning process with neuralfictitious play to alleviate the above issues. We train a single model as ourpolicy model, which consists of sub-models and a selector. Everytime facing anew opponent, the model is expanded by adding a new sub-model, where only thenew sub-model is updated instead of the whole model. At the same time, theselector is also updated to mix up the new sub-model with the previous ones atthe state-level, so that the model is maintained as a behavior strategy insteadof a wide distribution over policy models. Experiments on Kuhn poker, agrid-world Treasure Hunting game, and Mini-RTS environments show that theproposed approach alleviates the forgetting problem, and consequently improvesthe learning efficiency and the robustness of neural fictitious play.
Quick Read (beta)
Improving Fictitious Play Reinforcement Learning with Expanding Models
Abstract
Fictitious play with reinforcement learning is a general and effective framework for zero-sum games. However, using the current deep neural network models, the implementation of fictitious play faces crucial challenges. Neural network model training employs gradient descent approaches to update all connection weights, and thus is easy to forget the old opponents after training to beat the new opponents. Existing approaches often maintain a pool of historical policy models to avoid the forgetting. However, learning to beat a pool in stochastic games, i.e., a wide distribution over policy models, is either sample-consuming or insufficient to exploit all models with limited amount of samples. In this paper, we propose a learning process with neural fictitious play to alleviate the above issues. We train a single model as our policy model, which consists of sub-models and a selector. Everytime facing a new opponent, the model is expanded by adding a new sub-model, where only the new sub-model is updated instead of the whole model. At the same time, the selector is also updated to mix up the new sub-model with the previous ones at the state-level, so that the model is maintained as a behavior strategy instead of a wide distribution over policy models. Experiments on Kuhn poker, a grid-world Treasure Hunting game, and Mini-RTS environments show that the proposed approach alleviates the forgetting problem, and consequently improves the learning efficiency and the robustness of neural fictitious play.
1 Introduction
Many multi-agent systems can be modelled by games with incomplete information, where players have only partial observations of the system states and take actions based on these observations. Usually, the goal of each player is to maximize their expected payoff locally. However, it is intractable to obtain a closed-form solution based on linear programming or some search techniques as the observation or action space increases. An alternative approach is learning in games where the player learns a strategy through playing the game. Fictitious play (Brown, 1951) was a famous learning framework in games. In each iteration of fictitious play, the player makes a best response ccording to their belief about the other players’ strategies, repeatedly plays the game and averages these best responses. In specific games, the average strategy profile can be shown to converge to a Nash equilibrium.
There are many variants of standard fictitious play (Fudenberg and Levine, 1998), but most of them focus on normal-form representations and cannot be readily applied in large-scale games. On the other hand, although reinforcement learning (RL) is an efficient approach to solve large-scale single-agent sequential decision-making problems, vanilla independent reinforcement learning often fails in multi-agent scenarios with new challenges mainly from two aspects: instability and adaptability (Busoniu et al., 2008). The simultaneously indepent learning process makes the learning dynamics of every agent instable, and the learning agent must adapt to the changing behaviors of other agents. To our knowledge, FSP (Heinrich et al., 2015) was the first to successfully apply fictitious play in large-scale imperfect-information extensive-form games with a general machine learning framework, without any explicit knowledge about the opponents or the game. In FSP, RL was used for solving best response, and the average strategy was learned by supervised learning from best response experiences. An improved version with neural networks named NFSP (Heinrich and Silver, 2016) was also proposed.
Despite the success of reinforcement learning in games, there are crucial issues with current deep RL techniques that need to be solved. Avoiding forgetting the best responses to old opponents is essential when competing with a possibly dynamic opponent, e.g., an opponent that also learns. However, the most frequently used neural function approximations are easy to overfit to the current opponent and have an unknown effect on previously well-trained weights due to the back-propagation updates. Existing approaches try to finalize these trained policy models, i.e., maintain a pool of historical policy models and a distribution over these models.
In this paper, we focus on decentralized learning in partially observable environments, and propose a fictitious play reinforcement learning framework with expanding models named FPEM to address the above issues. In every iteration, the FPEM expands with a sub-model, which is also a neural network policy that is a best response to the opponent. Then a policy selector network mixes all these sub-models, updates during training and chooses a sub-model at every state. Intuitively speaking, these sub-models act as base policies and try to handle diverse malicious opponents, while the selector network handles in an upper level to choose a better candidate base policy at every state.
Related Works. CFR (Zinkevich et al., 2007) appeared to be the first tractable approach for finding the Nash equilibrium in large-scale imperfect-information extensive-form games through learning in games. CFR and its variants, such as CFR+ (Tammelin, 2014), linear CFR (Brown and Sandholm, ), performed well in practice. CFR-based approaches usually need to traverse the game tree to reason about every state and require some knowledge to abstract the game. Recently, Deep CFR (Brown et al., 2019) was also proposed to obviate the need for abstratction and using neural networks to deal with large games and comparable to linear CFR. Deepstack (Moravčík et al., 2017) also incorporated reinforcement learning, and was capable of beating professional poker players at heads-up no-limit Texas hold’em poker based on CFR.
Double Oracle (DO) algorithm (McMahan et al., 2003) maintained two deterministic policy pool in two-player games and assumed each player is restricted to select from their policy pool, then DO algorithm iteratively found an optimal pure strategy for each player against its opponents and added them to the two pools. Policy space response oracle (PSRO) (Lanctot et al., 2017) generalized DO, where the meta-game’s choices are policies rather than pure policies. The PSRO then learns the combination model (meta-strategy) of the oracles from the expected utility tensor computed via simulations. Based on the learning objective of meta-strategy, PSRO can be instances of independent RL, FP and DO. Functional-form games and gamespaces were proposed to construct a sequence of objectives (Balduzzi et al., 2019) and a rectified RSPO algorithm was also proposed.
To balance the performance of learning agents in two-player stochastic games, soft Q-learning was applied with a uniform distribution regularization term, to design games with adaptable and balancing properties tailored to human-level performance (Grau-Moya et al., 2018). Previous work (Pérolat et al., 2018) built a stochastic approximation of the fictitious play process in an online, decentralized fashion and applied it to multistage games, where the best response model chooses an action to maximize a perturbed Q function. In partially observable multi-agent environments, the actor-critic framework with several policy update rules based on regret minimization can lead to previously unknown convergence guarantees (Srinivasan et al., 2018) in such environments. An variant of NFSP is applied to an RTS game, replacing the best response solver with PPO (Kawamura and Tsuruoka, 2019), and the authors launched multiple processes to reduce off-policy data. Exploitability Descend (Lockhart et al., 2019) computed a best response and then performed exploitability descend directly on the policy to increase the utility, without having to compute an explicit average policy.
Contributions. We note that the previous works either used one single fixed structure policy model (usually a neural network) as an average strategy and updated on that model or maintained a popopulation of policies (policy pool), evolved the pool and updated the sampling distribution over the population, based on the fitness/performance of policies in the population. Our major contributions are that we propose an expanding policy model that consists of multiple trained sub-models, and can be used as a behavior strategy, stabilizing the performance against the old opponents and also adapting to the new opponents. Combined with the opponent pool, the FPEM alleviates the forgetting problem and continually incorporates a newly trained base policy to form a new mixed model. The selector network learns from the specified distribution over these sub-models and the newly added sub-model learns to adapt to the opponent. Since the policy selector is a behavior policy, it is able to adjust base policies during one game and achieve more stable performance than sampling a policy for the whole game from the policy pool, although both approaches can achieve the same long-term utility in expectation. Besides, the FPEM model with a maximum number of base policies is more flexible and excels when compared with a single policy network with more parameters.
2 Preliminaries
2.1 Reinforcement learning
In reinforcement learning (RL) (Sutton and Barto, 2018), an agent interacts with the environment, i.e., takes an action and receives a state or observation and reward signal from the environment at each timestep. The goal of the RL agent is to learn an optimal policy that maximizes the expected cumulative rewards, i.e., the return in the long run for the agent from interacting trajectories. RL can be formalized as a Markov decision process (MDP). Formally, an MDP is defined as a 5-tuple $\u27e8S,A,P,r,\gamma \u27e9$ where the state space is $S$, with the action space $A$, and $P:S\times A\times S\to [0,1]$ is the state transition function. Namely, when the agent takes action ${a}_{t}$ in state ${s}_{t}$, it transitions to a new state ${s}_{t+1}\sim P({s}_{t+1}|{s}_{t},{a}_{t})$ and gets the reward signal $r:S\times A\to \mathbb{R}$. The last term $\gamma \in [0,1]$ is the discount factor that trades off the current and future rewards. The agent’s policy is a probability distribution over state–action space $\pi :S\times A\to [0,1]$ satisfying ${\sum}_{a\in A}\pi (s,a)=1$. The state value function $V$ and state–action value function $Q$ is defined by ${V}^{\pi}(s)={\mathbb{E}}^{\pi}[{\sum}_{t=0}^{\mathrm{\infty}}{\gamma}^{t}r({s}_{t},{a}_{t})|{s}_{0}=s]$ and ${Q}^{\pi}(s,a)={\mathbb{E}}^{\pi}[{\sum}_{t=0}^{\mathrm{\infty}}{\gamma}^{t}r({s}_{t},{a}_{t})|{s}_{0}=s,{a}_{0}=a]$. With the notation of value function $V$, the goal of RL can be formulated as ${\pi}^{\star}(s,a)={\mathrm{arg}\mathrm{max}}_{\pi}{V}^{\pi}(s)={\mathrm{arg}\mathrm{max}}_{\pi}{\mathbb{E}}^{\pi}[{\sum}_{t=0}^{\mathrm{\infty}}{\gamma}^{t}r({s}_{t},{a}_{t})|{s}_{0}=s]$. In partially observable environments, the agent receives only a partial observation ${o}_{t}$ of the system state, and to circumvent the belief state in POMDP, the agent’s policy maps a state-action history sequenece ${h}_{t}=({o}_{1},{a}_{1},\mathrm{\cdots},{o}_{t})$ in that episode to the probability distribution over the action space. In this paper, because we focus on decentralized control, we always use ${s}_{t}$ to denote the input of the policy model when it is clear from the context, instead of alternating to ${o}_{t}$ or ${h}_{t}$.
2.2 Stochastic Game
Stochastic games (also known as Markov games) (Shoham and Leyton-Brown, 2008) generalize both Markov decision processes and repeated games. In repeated games, a given game (often in normal form) is played multiple times by the same set of players. With a little abuse of notation, a stochastic game is represented as a 6-tuple $\u27e8S,N,A,P,r,\gamma \u27e9$ where $S$ is the state space and $N$ is a finite set of players. $A={A}_{1}\times \mathrm{\cdots}\times {A}_{N}$ is the joint action space where ${A}_{i}$ denotes the set of actions for player $i$. $P:S\times A\times S\to [0,1]$ is the state transition function. $P({s}_{t+1}|{s}_{t},{a}_{t})$ is the probability of the transition from state ${s}_{t}$ to state ${s}_{t+1}$ after joint action ${a}_{t}$. The payoff function $r=({r}^{1},\mathrm{\cdots},{r}^{N})$, where ${r}^{i}:S\times A\to \mathbb{R}$, is real-valued for player $i$. A history ${h}_{t}$ of the game is a finite sequence ${h}_{t}=({s}_{1},{a}_{1},\mathrm{\cdots},{s}_{t})\in H$. Superscript is used to denote which player is, a player’s behavior strategy (the agent’s policy) is defined as ${\pi}^{i}:H\times {A}_{i}\to {[0,1]}^{|{A}_{i}|}$, and their strategy profile (joint policy) is $\pi ={\pi}^{1}\times \mathrm{\cdots}\times {\pi}^{N}$. Denoting all of the players expect player $i$ by $-i$, the strategy profile can be simplified to $\pi ={\pi}^{i}\times {\pi}^{-i}$. A pure strategy of a player $i$ assigns all probability on a single actoin for each history ${h}_{t}$, i.e., ${\pi}^{i}:H\to A$. A mixed strategy of the player is a probability distribution over all possible pure strategies. By Kuhn’s theorem, it can be shown that a mixed strategy is always equivalent to a behavior strategy and vice versa, given perfect recall, which means that every player will not forget what they have done or observed in one episode. It is clear that perfect recall always holds if players make decesions in a history ${h}_{t}$. A Markov strategy is a behavior strategy with Markov, i.e., property ${\pi}^{i}({h}_{t},{a}_{t})={\pi}^{i}({s}_{t},{a}_{t})$. Analogously, $\gamma $ is the discount factor.
The expected cumulative reward for player $i$ is formulated as ${V}^{\pi ,i}(s)={\mathbb{E}}^{\pi}[{\sum}_{t=0}^{\mathrm{\infty}}{\gamma}^{t}{r}^{i}({s}_{t},{a}_{t})|{s}_{0}=s]$ where $\pi =({\pi}^{i},{\pi}^{-i})$. A best response ${\pi}^{i,\star}\in BR({\pi}^{-i})={\mathrm{arg}\mathrm{max}}_{{\pi}^{i}}{V}^{\pi ,i}(s)$, is a policy that achieves the highest expected cumulative payoff when ${\pi}^{-i}$ keeps fixed. Nash equilibrium is a strategy profile $\pi =({\pi}^{i},{\pi}^{-i})$ where $\forall i,{\pi}^{i}\in BR({\pi}^{-i})$, so that no player can improve their payoff by deviating from it unilaterally. If $\forall i,{V}^{i,(BR({\pi}^{-i}),{\pi}^{-i})}-{V}^{i,\pi}\le \delta $, $\pi $ yields a $\delta $-Nash equilibrium. The discounted-reward case is the less problematic: a Nash equilibrium exists in every stochastic game, as shown by folk theorem.
In two-player zero-sum stochastic games, ${r}^{1}({s}_{t},{a}_{t})+{r}^{2}({s}_{t},{a}_{t})=0$ always holds true, and the expected cumulative reward of the opponent is ${V}^{\pi ,-i}(s)=-{V}^{\pi ,i}(s)$. It can be obtained from the definition that ${\mathrm{max}}_{{\pi}^{i}}{\mathrm{min}}_{{\pi}^{-i}}{V}^{i}(s)\le {\mathrm{min}}_{{\pi}^{-i}}{\mathrm{max}}_{{\pi}^{i}}{V}^{i}(s)$. The underlying property of a maximin strategy is straight-forward: it guarantees the worst-case payoff when faced with an adversarial player. By minimax theorem, in two-player zero-sum games, the maximin value is equal to the minimax value and is called the value of the game. It can be shown that every Nash equilibrium achieves the same unique value $V$ in two-player zero-sum games, and the Nash equilibrium is a maximin strategy.
In the remainder of this paper, we do not distinguish between the player and the agent, which are essentially the same, nor do the strategy and the policy or the payoff and the reward.
3 Fictitious Play with Expanding Models
In two-player zero-sum games, the decentralized fashion of solving for maximum expected utility is equivalent to solving the maximin strategy of the player, since the maximum for the opponent is the minimum for the player. Thus, the objective function can be represented as
$${\pi}^{i,\star}=\underset{{\pi}^{i}}{\mathrm{arg}\mathrm{max}}\underset{{\pi}^{-i}}{\mathrm{min}}{V}^{\pi ,i}(s).$$ | (1) |
This problem can be solved by alternative optimization approaches. However, in complex environments, it is impossible to derive the closed-form solution for the max or min operator, albeit $V(s)$ is well formulated. It should be noticed that all the other players’ strategies remain fixed during the max or min step when alternative optimization is used. Thus, the max or min optimization problem is reduced to a standard single-agent RL problem with new transition function composed of the environment dynamics and the other players’ policy. We use neural networks as function approximators to represent the players’ policies and value functions. By denoting player $i$’s and $-i$’s parameterized policies as ${\pi}_{\theta}^{i},{\pi}_{\theta}^{-i}$ respectively, the new objectives can be represented as
$${\theta}^{i,\star}=\underset{{\theta}^{i}}{\mathrm{arg}\mathrm{max}}\underset{{\theta}^{-i}}{\mathrm{min}}{V}^{({\pi}_{\theta}^{i},{\pi}_{\theta}^{-i}),i}(s).$$ | (2) |
$${\theta}^{-i,\star}=\underset{{\theta}^{-i}}{\mathrm{arg}\mathrm{min}}\underset{{\theta}^{i}}{\mathrm{max}}{V}^{({\pi}_{\theta}^{i},{\pi}_{\theta}^{-i}),i}(s).$$ | (3) |
We assume that the opponent is a malicious adversary that always tries to minimize the expected return ${V}^{\pi}(s)$ to approximate the maximin process. Without loss of generality, we also assume that player $1$ is the max player, and player $2$ is the min player.
3.1 Alternative Optimization with Single Model
The players’ policies are both represented by neural networks so that the extremum operator can be approximately solved with deep reinforcement learning techniques, and alternative optimization can be readily applied. In the max or min step, the corresponding player tries to solve for the optimal policy when the opponent’s policy is fixed by updating the parameters. Since a neural network is used as the function approximator and the extremum operation is coupled with the opponent’s policy, the underlying problem is instability. As the training process continues, the current trained policy is no longer a best response or even loses when playing against some opponents that used to be defeated, namely, forgetting old opponents. So the training process may fluctuate or even diverge, especially in cases where the opponent’s policy is crucial. The instability here is inherent in the policy model due to back-propagation updating.
In independent RL, because the unawareness of the other players and simultaneous learning, the dynamics of the environment is much more complex and induces the instability, irrespective of what policy model is used.
3.2 Opponent Pool with Single Model
To stabilize the training process, i.e., to guarantee the performance when facing defeated opponents, instead of competing with a single policy model, the opponent’s historical policies are kept in a buffer, which is known as the opponent pool. AlphaGo (Silver et al., 2016) also used an opponent pool to stabilize training by preventing overfitting to the current policy being trained. It added the current policy to the opponent pool every 500 iterations and samples a policy to compete within each iteration (a mini-batch of $n$ games).
In this paper, we add an opponent policy to the pool after every min iteration and uniformly sample a policy for each game from the pool. The max player trains the current policy to maximize the expected return against the mixture of policies from the opponent pool. The opponent’s policy ${\pi}_{t}^{-i}$ that is added to the pool is a best response to the max player’s policy ${\pi}_{t}^{i}$, which tracks the process of Brown’s original fictitious play. Because all of the opponent’s policies are kept and form a mixture model of policies, this helps to alleviate the problem of forgetting so that the performance will not have a sudden drop when facing a defeated opponent. For simplicity and to adhere to fictitious play, we just uniformly sample from the opponent pool. However, some other distributions can be used in practice, e.g., a distribution that is proportional to the ranking of the opponent’s policies (OpenAI, 2018; Vinyals et al., 2019). The opponent pool can be treated as a mixed strategy, as it selects each policy (albeit not a deterministic policy) from some distribution before the game and commits to it the whole game.
[!ht]
Input: number of maximum base policies $T$, base policy set $BP$, opponent pool $OP$, a reservoir memory $M$, policy selector network $W$ and target network ${W}^{\prime}$
Output: policy selector $W$ and corresponding base policies
\[email protected]@algorithmic[1] \Foriteration $t$ = $1:T$
\For$i\in \text{players}[N]$
\Stateinitialize a new ${\pi}_{t}^{i}$
\For$e$ in $n$ episodes
\If$i$ is max player
\State${\pi}^{-i}\sim Unif(OP)$ (random if empty)
\Else\State
$${\pi}^{-i}=\{\begin{array}{ccccc}\hfill {\pi}_{t}^{-i}& & \hfill w.p.& & \hfill 1/t\\ \hfill {W}^{\prime}\circ {\pi}_{1:t-1}^{-i}& & \hfill w.p.& & \hfill 1-1/t\end{array}$$ |
play the game and collect trajectories \If$i$ is min player and $t\ge 2$ \Statestore $(h,j)$ in $M$ ($j$ is the index of the policy executed at $h$) \EndIf\If$e==0$ mod (learning_frequency) \Stateupdate ${\omega}_{t}$ with SGD on loss
$${\mathbb{E}}_{(h,j)\sim M}[-\mathrm{log}W(h,j|{\omega}_{t})]$$ |
optimize ${\pi}_{t}^{i}$ with collected transitions by RL algorithm \EndIf\EndFor\State$BP\leftarrow BP\cup {\pi}_{t}^{i}$ (or $OP\leftarrow OP\cup {\pi}_{t}^{i}$) \EndFor\Stateset ${W}^{\prime}=W$ \EndFor
3.3 Fictitious Play with Expanding Models
Instead of constantly updating a single policy model in the max step, we use an expanding model approach that continually generates new policies and combines all of them. The new policy model is named fictitious play with expanding models (FPEM), and consists of a base policy set $BP$ and a policy selector $W:H\to {[0,1]}^{|BP|}.$ FPEM is initialized with an empty base policy set, and the selector $W$ has no options. After every max step, a newly trained base policy ${\pi}_{t}^{i}$ is added to $BP$, and thus $W$ has a new optional policy. Only the parameters of current training base policy ${\pi}_{t}^{i}$ and $W$ are updated, and the previously trained base policies keep fixed (if there are). During the min player’s step, the max player sample a policy from the base policy set follow a specified distribution (e.g., uniform distribution) at the begining of each game, and the experience pair $(h,j)$ is stored in memory $M$, where $h$ is the history and $j$ is the index of base policy executed at that history. $W$ then learns from the stored experiences. To learn the policy selector with limited experiences, reservoir sampling (Vitter, 1985) is used to store these experiences from those best response policies. Let $W$ be a neural network and parameterized by $\omega $; using $W\circ {\pi}_{1:t}^{i}$ denotes the FPEM model, i.e., the combined policy selector and base policy set $\{{\pi}_{1}^{i},{\pi}_{2}^{i},\mathrm{\cdots},{\pi}_{t}^{i}\}$. Thus the objective of FPEM is
$${\omega}_{t}=\underset{\omega}{\mathrm{arg}\mathrm{min}}{\mathbb{E}}_{(h,j)\sim M}[-\mathrm{log}W(h,j|\omega )]$$ | (4) |
$${\theta}_{t}^{i}=\underset{{\theta}^{i}}{\mathrm{arg}\mathrm{max}}{V}^{({\pi}_{t}^{i},{\pi}^{-i}),i}(h),$$ | (5) |
, where ${\theta}_{t}^{i}$ represents the parameters of the base policy ${\pi}_{t}^{i}$. Since we aim at solving for the max player’s policy, thus we use FPEM as the max player’s policy model and intentionally use the opponent pool for the min player for simplicity. In fact, both players can adopt FPEM as their policy model. Figure 1 shows both the process of policy generating in FPEM and the opponent’s policy generating with the opponent pool.
We make policy selector $W$ a behavior strategy that selects a base policy at every action history, and mix these base policies in the behavior strategy level. $W$ and ${\pi}_{t}^{i}$ are trained while parameters of ${\pi}_{1:t-1}^{i}$ are not updated, which is a trade-off between the stability and adaptability. Keeping and incorporating previously trained base policies will overcome the catastrophic forgetting problem, which helps stabilize training. Besides, adding a new base policy and retraining the policy selector $W$ will improve the adaptability of FPEM since the new base policy serves as a sub-model to make FPEM adapt to the newly updated opponent pool.
The learning of average policy in FSP or NFSP is a policy distillation process, where the average policy constantly learns from the inputs and outputs of best response models. FPEM explicitly expands with these best response models and form a hierarchical structure, which potentially improves learning efficiency. Another potential advantage is that using a behavior strategy rather than a mixed strategy can improve the robustness when evaluation with finite simulations. Although there is an equivalence relationship between a mixed strategy and a corresponding behavior strategy given perfect recall, they will receive the same cumulative reward only in expectation. A single base policy is trained against a specified opponent, so it may not be that reasonable in all states. However, FPEM integrates all these base policies and makes decisions in every history so that multiple policies work jointly during one episode.
The process of FPEM is summarized in Algorithm 3.2. The max player (take player 1 as max player) trains a best response ${\pi}_{1}^{1}$ to the opponent and adds it to base policy set $BP$. The min player trains a best response ${\pi}_{1}^{2}$ against ${\pi}_{1}^{1}$. In iteration 2, the max player trains ${\pi}_{2}^{1}$ and adds it to BP; the min player trains ${\pi}_{2}^{2}$ against ${\pi}_{1}^{1},{\pi}_{2}^{1}$ with equal probability and $W$ learns from $(h,j)$ pairs, where $j$ is the index of the base policy executed at the history state $h$. At the end of this iteration, the target network ${W}^{\prime}$ is replaced by $W$ so that in the next iteration, ${W}^{\prime}$ combined with ${\pi}_{1}^{1},{\pi}_{2}^{1}$ (denoted by ${W}^{\prime}\circ {\pi}_{1:2}^{1}$) is a uniform mixture of trained policies. In iteration 3, the min player trains against ${W}^{\prime}\circ {\pi}_{1:2}^{1}$ and ${\pi}_{3}^{1}$ with probabilities $2/3,1/3$, respectively, which is equivalent to competing with ${\pi}_{1}^{1},{\pi}_{2}^{1},{\pi}_{3}^{1}$ with equal probabilities. New $(h,j)$ pairs are stored in the reservoir memory and $W$ retrains. Since each $W$ is an approximation of the specified distribution (e.g., uniform distribution) over ${\pi}_{1:t-1}^{1}$ and retrains to incorporate the newly trained ${\pi}_{t}^{1}$, FPEM maintains the specified mixture in behavior form.
Notice that in 3.2, the uniform distribution version of FPEM is described, but FPEM is not restricted to uniform distribution. In fact, the policy selector can learn from any proper distribution. In this paper, we mainly focus on uniform distribution.
The latest base policy of both players always learns a best response to the opponent pool, so the FPEM potentially enjoys the convergence property in two-player zero-sum games, as it tracks the process of fictitious play. The above implies that if FPEM converges in a two-player zero-sum game, then it converges to a Nash equilibrium, which is also a maximin strategy.
In the experiments, we also evaluate a non-alternating learning variant of FPEM (FPEMv1), where each player updates his policy model simultaneously. Learning a new best response and playing with a combination of other models and the current learning model, the simultaneous learning process leads to a off-policy problem. So for the simultaneous learning version, we use off-policy RL algorithms or apply a clipped importance sampling weight on the critic (value funtion).
4 Experiments
The proposed FPEM is first evaluated in Kuhn poker as a case study and then two stochastic games. Kuhn poker is an extensive-form imperfect-information game. The two stochastic games are a two-player zero-sum treasure hunting environments and Mini-RTS from ELF platform (Tian et al., 2017). We also note that the last two games are symmetric, i.e., for any permutation of players, the policy space and the reward for that player will not change, while Kuhn is not symmetric. So for symmetric games, we only use FPEM as the max player’s policy model and maintain a pool for the opponent, and after training, only FPEM is evaluated. For unsymmetric games, FPEM models are used for all the players.
4.1 Case Study: On Kuhn Poker
Two-player Kuhn poker is a toy poker game with 3 totally-ordered cards, where each player starts with a private card and assigned 2 chips for one game and antes 1 chips to play. Players can choose to bet, check or fold and the betting is limited to 1. The game ends with a showdown or one player folds.
$\text{NashConv}(\pi )={\sum}_{i}^{N}{\mathrm{max}}_{p{i}^{i,\prime}}{V}^{i}({\pi}^{i,\prime},{\pi}^{-i})-{V}^{i}({\pi}^{i},{\pi}^{-i})$ is commonly used in poker AI, which measures how much players gain by unilaterally switching to a best response. It also measures the distance from a Nash equilibrium, where a NashConv value of $\delta $ yields a $\delta $-Nash equilbrium. This measure can easily be obtained in Kuhn poker. The reason for choosing Kuhn poker because there is a transition dynamics yet simple enough to get a close-form measure rather than caring for the poker game.
To verify the expanding models, we compare FPEM with original NFSP and based on the open-source library OpenSpiel (Lanctot et al., 2019). In FPEM, each expanded model is a deep Q-nets (DQN). After some episodes of best response learning, this policy stops learning, and a new base policy begins to learn. Once the second base policy begins to learn (the second outer iteration), the policy selector $W$ learns the mixture at each state, which is equivalent to the uniform distribution over all the trained base policies. Because DQN is an off-policy RL algorithm, the experiences from previous trained models can be put into the replay buffer. Thus the implementation of FPEM mainly differs from NFSP in that the average strategy is expanding with newly trained models. Since the evaluation with NashConv requires a behavior strategy rather than a pool of trained best response, RSPO is not compared currently.
For NFSP, the anticipator $\eta =0.1$ and the two policy networks are both 1-layer MLP with 64 units, which are the same as the original paper (varying hidden units seems to make little difference). For FPEM, the policy selector $W$ is also a 1-layer MLP with 64 hidden units. During the learning process of $W$, the target selector network ${W}^{\prime}$ is also used to maintain the distribution over $t-1$ base policies, and current learning base policy is executed with probability $\frac{1}{t}$. So, at the begining of one game, with probability $1-\frac{1}{t}$, the target selector ${W}^{\prime}$ with $t-1$ base policies is chosen to follow for a game, and the new base policy is chosen with probability $\frac{1}{t}$. ${W}^{\prime}$ is update by $W$ at the end of an iteration. The number of maximum base policies is set to 40. Each base policy learns for $5\times {10}^{4}$ episodes.
Figure 3 shows that with expanding models, the average policy is faster to achieve a lower NashConv. In the first 0.05M episodes, the NashConv is directly from the $\u03f5$-greedy$(Q)$ policies. After that, the NashConv is calculated from the training average policy (multiple $\u03f5$-greedy$(Q)$ in behavior level), in corresponding with NFSP. After a long-term training, the NashConv of both algorithm reachs to a very low value. Because adding too many sub-models requires more samples and complex network architectures for the policy selector to learn, we do not run FPEM with more than 50 base policies. With multiple runs, the final NashConv of NFSP in Kuhn poker seems to plateau at $0.03\pm 0.05$ after 10M episodes, while FPEM only reaches $0.08\pm 0.03$ with maximum of 5M episodes, thus FPEM learns faster than NFSP with limited samples. Possibly due to the stochastic nature of poker, and DQN is a deterministic sub-model, it requires more samples or hyper-parameter searchs for FPEM to achieve a better performance in the long run.
4.2 On Stochastic Games
In the latter two environments, due to the long horizon and sparse reward properties, we use policy-gradient based RL approaches and stack the last $K$ frames to approximate history ${h}_{t}$. In treasure hunting, PPO (Schulman et al., 2017) is the solver for best response and A3C (Mnih et al., 2016) for Mini-RTS. However, FPEM is not coupled with PPO, A3C, and any other efficient solvers can be used. As reported in (Kawamura and Tsuruoka, 2019) and the original ELF paper, A3C implemented by the ELF platform slightly outperforms PPO against two built-in AIs.
4.3 Environment Description
Treasure Hunting The treasure hunting game happens in an $8\times 8$ grid world. With randomly generated obstacles in the grid, each player is able to receive a partial observation of the environment, which is a diamond-shaped area. Fig 2 two randomly initialized map and the observable areas. The available actions for each player are {UP, DOWN, LEFT, RIGHT}. A player will be rewarded 1 if he obtains a treasure, and the opponent receives a reward -1 at the same time. If the player who has owned a treasure gains a second one, he receives a reward 2, and -2 for the opponent. When two players gain a treasure simultaneously, both will receive a reward 0, and this treasure disappears in the map. A grab occurs when one player who carries a treasure enters the same grid with the opponent, then the treasure loses to the opponent and the reward will be -2. An episode usually lasts for 60-80 ticks and with a maximum of 100 ticks. Each player will only receive the reward signal when the player gains or loses a treasure.
Mini-RTS Mini-RTS is a partially observable two-player zero-sum game environment on the ELF platform. It is a miniature custom-made RTS game that captures all the underlying dynamics of StarCraft (fog-of-war, resource gathering, troop building, defence/attack with troops, etc.). The observation is composed of spatially structured (20-by-20) abstractions of the current game environment with 22 channels. Although Mini-RTS offers micro-commands, the actions used in the experiments are nine strategic hard-coded global commands. Every game terminates at a maximum of 30000 ticks (an average game lasts for 1000-6000 ticks). There are two rule-based built-AIs named SIMPLE and Hit-aNd-Run (HNR) respectively (a human player has a win rate of $90\%$ and $50\%$ against SIMPLE and HNR in 20 games).
Model | OP1 (%) | OP2 (%) | OP3 (%) | OP4 (%) | OP5 (%) | OP6 (%) | OP7 (%) | OP8 (%) | OP9 (%) | OP10 (%) |
---|---|---|---|---|---|---|---|---|---|---|
FPEM | 49.6$\pm $1.6 | 49.9$\pm $1.3 | 50.2$\pm $1.4 | 51.0$\pm $1.0 | 50.8$\pm $1.1 | 50.4$\pm $1.4 | 50.7$\mathrm{\pm}$1.2 | 50.7$\pm $1.8 | 51.0$\mathrm{\pm}$0.2 | 50.5$\pm $1.2 |
FPEMv1 | 50.3$\mathrm{\pm}$1.7 | 51.2$\mathrm{\pm}$1.4 | 51.8$\mathrm{\pm}$1.2 | 52.6$\mathrm{\pm}$1.1 | 52.5$\mathrm{\pm}$0.9 | 50.8$\mathrm{\pm}$1.3 | 50.2$\pm $1.6 | 51.2$\mathrm{\pm}$0.7 | 50.9$\pm $1.1 | 50.3$\pm $1.5 |
SMv1 | 49.5$\pm $0.2 | 49.8$\pm $0.3 | 50.2$\pm $0.4 | 50.4$\pm $0.4 | 50.1$\pm $0.3 | 49.8$\pm $0.4 | 50.3$\pm $0.4 | 50.1$\pm $0.3 | 49.7$\pm $0.5 | 50.5$\mathrm{\pm}$0.4 |
SMv2 | 49.2$\pm $1.5 | 48.6$\pm $1.6 | 48.1$\pm $1.5 | 48.5$\pm $1.5 | 47.8$\pm $1.5 | 49.2$\pm $1.2 | 48.9$\pm $1.3 | 48.5$\pm $1.6 | 48.6$\pm $1.2 | 48.2$\pm $0.5 |
OPPO | 49.6$\pm $1.2 | 50.6$\pm $1.3 | 49.8$\pm $1.5 | 50.2$\pm $1.4 | 50.4$\pm $1.3 | 49.9$\pm $1.4 | 50.1$\pm $1.3 | 49.9$\pm $1.1 | 50.2$\pm $1.1 | 49.7$\pm $1.4 |
4.4 Experimental Settings
In the treasure hunting experiment, the base policies of two players are both 4-layer MLP. The policy selector $W$ is a 4-layer MLP. For a single model policy, a 5-layer MLP is used. ReLu is the nonlinear activation function in all MLPs. The player who has the higher return wins in a game, and ties with the opponent only when both players’ returns are 0. In each max or min step, it alternates to train a new base policy when
$$\frac{\{\mathrm{\u266f}\text{of}win-\mathrm{\u266f}\text{of}lose\}}{\mathrm{\u266f}\text{of}episodes}{\delta}_{t},$$ | (6) |
or $100K$ episodes are reached. (6) is computed using the most recent $6K$ episodes. ${\delta}_{t}$ is set to 0.2.
In Mini-RTS, the base policy model is a simple CNN which is the same as (Tian et al., 2017), with two heads for the policy and the critic respectively. $W$ shares the CNN parameters with base policy and connected by one FC layer. Every base policy learns for $300K$ episodes. The number of maximum base policies is 10 in both environments.
4.5 Results and Analysis
For both experiments, we save the trained model after each iteration and evaluate these saved policy models. We evaulate on 3 seeds for both experiments. Unlike Kuhn poker, there is no such closed-form measure of NashConv, so the metric we use is how much a trained policy model loses against a trained malicious opponent, which measures how much a policy can be exploited.
In treasure hunting, the FPEM, FPEMv1 are compared with five other approaches. Since we aim to solve for the policy of the max player, only the max player is evaluated. Note that both games are symmetric, the players are homogeneous, so the evaluation of the max player is enough. Besides, all of the policy models are initialized with pre-trained models via self-play, at a fraction of episodes used in one iteration to facilitate early-stage learning. SMv1 is the alternative optimization approach, where each player uses a single model. SMv2 is a variant of SMv1, where the min player is replaced by an opponent pool with a maximum of 10 base policies. Each base policy in the pool is a best response to the max player’s corresponding policy. NFSP uses the same network structure as in SMv1, except there is another average policy, and both players learn simultaneously. The anticipatory parameter $\eta $ in NFSP is 0.25 which performs best among $\{0.1,0.2,0.25,0.5\}$. In the OPPO, both players use the uniform opponent pool. For PSRO, each item of the expected utility tensor is computed via $10K$ simulations, and the meta-strategy is solved by regret matching (Hart and Mas-Colell, 2000), as it is comparable to PRD solver in PSRO and straight-forward to implement. Besides, the same exploratory strategies for PSRO are used as in (Lanctot et al., 2017).
For each model, we retrain 10 models with a 4-layer MLP to approximate the malicious adversaries, and these adversaries are trained until the expected return plateaus or a maximum of $300K$ episodes are reached. Figure 4 demonstrates that SMv2, FPEM and FPEMv1 are less exploited when the opponent pool increases and the FPEM is slightly better than the other two. The shaded areas denote the average losses with the standard deviation from 3 runs. SMv1 fluctuates as training proceeds since it may forget how to respond to old opponents. And due to the deeper networs, SMv1 seems to comparable with SMv2. Although NFSP does not fluctuate and is with an extremely low variance, it appears to learn slowly. In the OPPO, due to sampling a base policy to follow for a whole game, the mixture of the pool is vulnerable. The overall performance of PSRO is better than the uniform version PSRO (OPPO), but may still be restricted by the accuracy of the expected utility tensor, where $10K$ simulations may be insufficient to get a good approximation. However, $10K$ simulations on each item are the trade-off between the time costs and the accuracy. Moreover, the average losses of FPEM decrease, thus the policy loses less and less against the malicious opponents and approximates the maximin strategy.
In Mini-RTS, only OPPO, SMv1 and SMv2 are compared with FPEM. Having noticed that the two players are homogeneous and use the same policy model in SMv1 and OPPO, these two approaches are trained through self-play, where both players share the model parameters and play against itself. NFSP is omitted due to the slow convergence in treasure hunting, and from (Kawamura and Tsuruoka, 2019), NFSP falls behind self-play, where the implementation of SMv1 essentially is equivalent to raw self-play in that work. The PSRO is not completely conducted since it spends too much time on computing the expected utility tensor and can not get the Nash distribution. All of the evaluated approaches are trained without built-AIs and make a decision every 50 ticks, and the base policies are initialized by a pre-trained model through self-play for $40K$ episodes. The results against trained adversaries are shown in Table 1. Each adversary is the corresponding opponent’s policy at the end of each min iteration and is evaluated for $2\times {10}^{4}$ episodes and the standard deviation is calculated from the results of 3 runs. Since SMv1 and OPPO are totally self-play, the average winning rates is around 50%, however, SMv1 achieves a lower standard deviation. So a behavior policy performs more stably. Besides, FPEM, FPEMv1 have a higher overall winning rates against the adversaries.
To further evaluate the performance of FPEM, all the trained models play against two built-in AIs with different configurations: with decision frequencies 50 and 10 ticks (the latter one is tougher). Since the built-in AIs do not learn to adapt, a policy againt a same AI should defeat it once and for all. However, from the results against built-in AIs in Figure 5, all non-expanding models have notable drops when playing against the same AIs as the training proceeds, except FPEM and FPEMv1. That is, without expanding models or a behavior policy, the policy is easy to forget how to respond to old opponents. The shaded areas denote the average winning rates with the standard deviation from 3 runs. Besides, we let FPEMv1 compete with the three approaches, where each match consists of $2\times {10}^{4}$ episodes and only the final models are tested. FPEMv1 defeats OPPO, SMv1, SMv2 with winning rates of 53.5%, 51.9%, 52.2%, with a maximum deviation of 0.5% respectively.
So, with expanding modes and the behavior-form policy, FPEM is significantly more robust against various opponents, with little or even without a sudden winning rate drop as the number of base policies increases.
5 Conclusion
In this paper, we propose fictitious play reinforcement learning with expanding models (FPEM) that consists of multiple sub-models (base policies) and can be used as a behavior policy. The proposed method is scalable with a fixed number of base policies, which alliviates the forgetting problem and can improve the learning efficiency. Since the uniform version of FPEM tracks the process of fictitious play, it enjoys the convergence property in two-player zero-sum games. However, FPEM is not restricted to learn a uniform mixture over the sub-models, and any other distribution can be used. Experimental results on different kinds of domains demonstrate that the learned FPEM model does not forget how to respond to old opponents and is harder to be exploited by malicious opponents, compared to NFSP or a pool of policies.
6 Acknowledgement
This work is supported by the NSFC (61876077), Jiangsu SF (BK20170013), and Collaborative Innovation Center of Novel Software Technology and Industrialization.
References
- Balduzzi et al. (2019) D. Balduzzi, M. Garnelo, Y. Bachrach, W. Czarnecki, J. Pérolat, M. Jaderberg, and T. Graepel. Open-ended learning in symmetric zero-sum games. In Proceedings of the 36th International Conference on Machine Learning, pages 434–443, Long Beach, California, 2019.
- Brown (1951) G. W. Brown. Iterative solution of games by fictitious play. Activity Analysis of Production and Allocation, 13(1):374–376, 1951.
- (3) N. Brown and T. Sandholm. Solving imperfect-information games via discounted regret minimization. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence.
- Brown et al. (2019) N. Brown, A. Lerer, S. Gross, and T. Sandholm. Deep counterfactual regret minimization. In Proceedings of the 36th International Conference on Machine Learning, pages 793–802, Long Beach, California, 2019.
- Busoniu et al. (2008) L. Busoniu, R. Babuska, and B. D. Schutter. A comprehensive survey of multiagent reinforcement learning. IEEE Trans. Systems, Man, and Cybernetics, Part C, 38(2):156–172, 2008.
- Fudenberg and Levine (1998) D. Fudenberg and D. K. Levine. The Theory of Learning in Games, volume 2. MIT Press, 1998.
- Grau-Moya et al. (2018) J. Grau-Moya, F. Leibfried, and H. Bou-Ammar. Balancing two-player stochastic games with soft q-learning. In Proceedings of the 27th International Joint Conference on Artificial Intelligence, pages 268–274, Stockholm, Sweden, 2018.
- Hart and Mas-Colell (2000) S. Hart and A. Mas-Colell. A simple adaptive procedure leading to correlated equilibrium. Econometrica, 68(5):1127–1150, 2000.
- Heinrich and Silver (2016) J. Heinrich and D. Silver. Deep reinforcement learning from self-play in imperfect-information games. CoRR, abs/1603.01121, 2016.
- Heinrich et al. (2015) J. Heinrich, M. Lanctot, and D. Silver. Fictitious self-play in extensive-form games. In Proceedings of the 32nd International Conference on Machine Learning, pages 805–813, Lille, France, 2015.
- Kawamura and Tsuruoka (2019) K. Kawamura and Y. Tsuruoka. Neural fictitious self-play on ELF mini-rts. CoRR, abs/1902.02004, 2019.
- Lanctot et al. (2017) M. Lanctot, V. F. Zambaldi, A. Gruslys, A. Lazaridou, K. Tuyls, J. Pérolat, D. Silver, and T. Graepel. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems 30, pages 4193–4206, Long Beach, CA, 2017.
- Lanctot et al. (2019) M. Lanctot, E. Lockhart, J.-B. Lespiau, V. Zambaldi, S. Upadhyay, J. Pérolat, S. Srinivasan, F. Timbers, K. Tuyls, S. Omidshafiei, D. Hennes, D. Morrill, P. Muller, T. Ewalds, R. Faulkner, J. Kramár, B. D. Vylder, B. Saeta, J. Bradbury, D. Ding, S. Borgeaud, M. Lai, J. Schrittwieser, T. Anthony, E. Hughes, I. Danihelka, and J. Ryan-Davis. OpenSpiel: A framework for reinforcement learning in games. 2019.
- Lockhart et al. (2019) E. Lockhart, M. Lanctot, J. Pérolat, J. Lespiau, D. Morrill, F. Timbers, and K. Tuyls. Computing approximate equilibria in sequential adversarial games by exploitability descent. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 464–470, Macao, China, 2019.
- McMahan et al. (2003) H. B. McMahan, G. J. Gordon, and A. Blum. Planning in the presence of cost functions controlled by an adversary. In Proceedings of the 20th International Conference on Machine Learning, pages 536–543, Washington, DC, 2003.
- Mnih et al. (2016) V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33rd International Conference on Machine Learning, pages 1928–1937, New York City, NY, 2016.
- Moravčík et al. (2017) M. Moravčík, M. Schmid, N. Burch, V. Lisý, D. Morrill, N. Bard, T. Davis, K. Waugh, M. Johanson, and M. Bowling. Deepstack: Expert-level artificial intelligence in heads-up no-limit poker. Science, 356(6337):508–513, 2017.
- OpenAI (2018) OpenAI. Openai five. https://blog.openai.com/openai-five/, 2018.
- Pérolat et al. (2018) J. Pérolat, B. Piot, and O. Pietquin. Actor-critic fictitious play in simultaneous move multistage games. In Proceedings of the 21st International Conference on Artificial Intelligence and Statistics, pages 919–928, Playa Blanca, Lanzarote, Canary Islands, Spain, 2018.
- Schulman et al. (2017) J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017.
- Shoham and Leyton-Brown (2008) Y. Shoham and K. Leyton-Brown. Multiagent Systems: Algorithmic, Game-theoretic, and Logical Foundations. Cambridge University Press, 2008.
- Silver et al. (2016) D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484, 2016.
- Srinivasan et al. (2018) S. Srinivasan, M. Lanctot, V. Zambaldi, J. Perolat, K. Tuyls, R. Munos, and M. Bowling. Actor-critic policy optimization in partially observable multiagent environments. In Advances in Neural Information Processing Systems 31, pages 3422–3435, Montréal, Canada, 2018.
- Sutton and Barto (2018) R. S. Sutton and A. G. Barto. Reinforcement Learning: An Introduction. MIT Press, 2018.
- Tammelin (2014) O. Tammelin. Solving large imperfect information games using CFR+. CoRR, abs/1407.5042, 2014.
- Tian et al. (2017) Y. Tian, Q. Gong, W. Shang, Y. Wu, and C. L. Zitnick. ELF: an extensive, lightweight and flexible research platform for real-time strategy games. In Advances in Neural Information Processing Systems 30, pages 2656–2666, Long Beach, CA, 2017.
- Vinyals et al. (2019) O. Vinyals, I. Babuschkin, W. M. Czarnecki, M. Mathieu, A. Dudzik, J. Chung, D. H. Choi, R. Powell, T. Ewalds, P. Georgiev, J. Oh, D. Horgan, M. Kroiss, I. Danihelka, A. Huang, L. Sifre, T. Cai, J. P. Agapiou, M. Jaderberg, A. S. Vezhnevets, R. Leblond, T. Pohlen, V. Dalibard, D. Budden, Y. Sulsky, J. Molloy, T. L. Paine, C. Gulcehre, Z. Wang, T. Pfaff, Y. Wu, R. Ring, D. Yogatama, D. Wünsch, K. McKinney, O. Smith, T. Schaul, T. Lillicrap, K. Kavukcuoglu, D. Hassabis, C. Apps, and D. Silver. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
- Vitter (1985) J. S. Vitter. Random sampling with a reservoir. ACM Trans. Math. Softw., 11(1):37–57, 1985.
- Zinkevich et al. (2007) M. Zinkevich, M. Johanson, M. H. Bowling, and C. Piccione. Regret minimization in games with incomplete information. In Advances in Neural Information Processing Systems 20, pages 1729–1736, Vancouver, British Columbia, Canada, 2007.