We present a neural network-based framework for calibrating the parameters within finite-state mean field games (MFGs) from observations. The method formulates the calibration as an inverse problem and uses implicit differentiation to backpropagate through the equilibrium of the MFG.
We use a neural network
The parameter estimates are optimized by backpropagating through the MFG equilibrium. Doing so, the original MFG dynamics, which are governed by the minimization of the players' cost function, are preserved.

This project is based on JAX ecosystem for training neural networks. For most purposes, the CPU-based installation of JAX suffices.
We recommend using uv to configure your virtual environment, but using pip or conda is certainly possible too! All instructions are provided below.
# Clone the repository
git clone https://github.com/KachmanLab/MFGParameterCalibration
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# If your system doesn't have curl, you can use wget or pip to install it
# wget -qO- https://astral.sh/uv/install.sh | sh
# pip install uv
# Create environment and install the repository
cd MFGParameterCalibration
uv venv --python 3.11
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
# Alternatively, you can install the requirements using pip
# pip install -r requirements.txtAll experiments are provided in the ./experiments/ folder, and are initialized with the same hyperparameters as used in the paper. You can run all experiments as a module, for example, by calling
python -m experiments.linear_quadratic.mean_field_gameto run the MFG variant of the linear quadratic experiment.
This repository features two experiments that are based on real-world data, that can be obtained as follows:
| Experiment | Dataset | URL | License |
|---|---|---|---|
experiments/SIR/nrevss.py |
Influenza (NREVSS) | https://www.cdc.gov/nrevss/php/dashboard/index.html/ | Public Domain (U.S. Government) |
experiments/bikeshare |
Citi Bike Trip Histories | https://citibikenyc.com/system-data | NYCBS Data Use Policy |