LiteEFG: An Efficient Python Library for Solving Extensive-form Games

Mingyang Liu, Gabriele Farina, Asuman E. OzdaglararXiv 2024

Abstract

LiteEFG is an efficient library with easy-to-use Python bindings, which can solve multiplayer extensive-form games (EFGs). LiteEFG enables the user to express computation graphs in Python to define updates on the game tree structure. The graph is then executed by the C++ backend, leading to significant speedups compared to running the algorithm in Python. Moreover, in LiteEFG, the user needs to only specify the computation graph of the update rule in a decision node of the game, and LiteEFG will automatically distribute the update rule to each decision node and handle the structure of the imperfect-information game.

Introduction

Extensive-form games (EFGs) serve as the standard mathematical framework for modeling sequential interactions involving hidden information, such as Poker. Solving these games to find a Nash Equilibrium is computationally demanding, requiring the traversal of massive game trees.

Currently, researchers face a "productivity vs. performance" trade-off. Libraries like OpenSpiel provide accessible Python APIs for rapid prototyping but suffer from slow execution because core algorithmic loops run in Python. Conversely, custom C++ solvers offer high performance but are brittle and difficult to modify. Additionally, implementing EFG algorithms is error-prone due to the complexity of "information sets" (infosets), where multiple game states are indistinguishable to a player. LiteEFG addresses these challenges by providing a high-performance framework that combines Python's flexibility with C++'s execution speed.

Methodology: Computation Graphs for Game Theory

LiteEFG introduces a computation graph approach to game theory, analogous to frameworks like TensorFlow or PyTorch. Instead of manually iterating over game nodes, users define an "update rule" for a single generic decision node in Python.

Workflow and Execution

The library distinguishes between initialization logic and iterative training updates. During initialization, static nodes are computed once. During training, dynamic nodes are executed repeatedly. This separation optimizes the execution flow by avoiding redundant computations.

LiteEFG execution workflow showing the separation of initialization and update phases.

Python-Defined, C++-Executed Logic

LiteEFG's API allows researchers to describe complex algorithms like Counterfactual Regret Minimization (CFR) using high-level Python code. This description is compiled into a computation graph that the C++ backend executes across the entire game tree. The library automatically handles infoset abstraction, aggregating data across indistinguishable states without requiring manual implementation from the user.

Example Python code for implementing CFR using the LiteEFG API.

Evaluation and Key Results

The performance of LiteEFG was evaluated using classic benchmarks including Kuhn Poker, Leduc Poker, Liar’s Dice, and Dark Hex. It is also compatible with the OpenSpiel environment suite.

The primary advantage of LiteEFG is its massive speedup. In head-to-head benchmarks against OpenSpiel’s Python implementation, LiteEFG achieved over 100× acceleration. For instance, a run of 100,000 iterations of Leduc Poker that took approximately 8 hours in OpenSpiel was completed in less than 10 minutes using LiteEFG. The library includes pre-loaded, high-performance implementations of state-of-the-art algorithms such as CFR, CFR+, Discounted CFR (DCFR), and Magnetic Mirror Descent (MMD).

Conclusion and Future Work

LiteEFG bridges the gap between ease of use and computational efficiency in game theory research. By automating game tree traversal and infoset management, it allows researchers to focus on algorithmic innovation.

While currently optimized for tabular games where statistics fit in RAM, future work may explore integration with deep reinforcement learning (DRL) for larger state spaces. The efficiency gains provided by LiteEFG are expected to enable more extensive hyper-parameter searches, which have previously been a significant bottleneck in the field.

Summary updated

BibTeX
@misc{liu2024liteefg,
  author = {Mingyang Liu and Gabriele Farina and Asuman E. Ozdaglar},
  title = {{LiteEFG: An Efficient Python Library for Solving Extensive-form Games}},
  year = {2024},
  eprint = {2407.20351},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.20351},
}
Figure