Skip to main content
BenchMFG icon

BenchMFG

Benchmark suite for Mean Field Game algorithms.

Python JAX Hydra uv

License: MIT Unit tests ruff pre-commit

Contents

Install

uv add bench-mfg-suite
# or
pip install bench-mfg-suite

For local development:

uv sync --extra dev

CUDA is optional (but if we are running on gpu make sure you download that!!!!). The default install uses CPU-compatible JAX.

# Linux/NVIDIA, pip-managed CUDA runtime components:
uv add "bench-mfg-suite[cuda12]"
pip install "bench-mfg-suite[cuda12]"

# Linux/NVIDIA, local CUDA installation:
pip install "bench-mfg-suite[cuda12-local]"

If GPU initialization fails, check nvidia-smi and the official JAX install matrix: https://docs.jax.dev/en/latest/installation.html

Quick Start ⚡️

👑 Quick understanding of the repository and the package run the following three commands

benchmfg hello
benchmfg garnet
benchmfg mfpso

List registered configs:

benchmfg env list
benchmfg algo list

💥 Run one quick experiment on your machine:

benchmfg train algorithm=omd environment=four_rooms_obstacles device=cpu

Registered Configs

Environments: contraction_game, four_rooms_obstacles, kinetic_congestion, lasry_lions_chain, mf_garnet, multiple_equilibria, no_interaction_game, potential_game2d, rock_paper_scissors, sis_epidemic.

Algorithms: damped_fixed_point, omd, pi, pso.

Use benchmfg env list and benchmfg algo list for the installed package’s authoritative list.

Use benchmfg algo-parameters (or make algo-parameters) to print every algorithm’s hyperparameters, defaults, recommended sweep ranges, and the exact override syntax.

Sweep

Run a sweep:

benchmfg sweep \
  algorithm=omd \
  environment=lasry_lions_chain \
  experiment.name=omd_sweep \
  experiment.random_seed=42,10,111,1032 \
  algorithm.omd.learning_rate=0.5,0.05,0.005 \
  algorithm.omd.temperature=0.2,0.5,0.8

Python API

import benchmfg

cfg = benchmfg.load_config(["algorithm=omd", "environment=lasry_lions_chain"])
environment, initial_policy = benchmfg.make_environment(cfg)
solver = benchmfg.make_solver(
    cfg,
    environment=environment,
    initial_policy=initial_policy,
)

fixed_mf_env = benchmfg.make_fixed_mean_field_env(
    environment,
    environment.stationary_mean_field,
)

Outputs And Plots

Runs write artifacts under:

outputs/<Env>/<Algorithm>/seed_<seed>/<Experiment>/<run_id>/

Important files: exploitabilities.npz, final_mean_field.npz, final_policy.npz, metrics.npz, config.yaml.

Plot commands:

benchmfg plot single-run <run_dir>
benchmfg plot sweep <environment> <algorithm>
benchmfg plot compare <environment>

Plot discovery defaults:

  • single-run <run_dir> plots exactly that timestamped run.
  • sweep <environment> <algorithm> scans outputs/ by default. For each seed and hyperparameter version, it selects the latest timestamped run containing exploitabilities.npz.
  • compare <environment> reads the results/<environment>/<algorithm>/best_model.yaml files written by plot sweep; rerun plot sweep first if new runs were added.
  • Use --outputs-dir <path> on sweep/compare commands when artifacts are not under outputs/.

Repository Layout

src/benchmfg/
├── config/      # packaged Hydra configs
├── envs/        # MFG environments
├── learner/     # solvers
├── utility/     # training, saving, plotting helpers
├── cli.py       # benchmfg command
└── train.py     # Hydra train entrypoint

See EXPERIMENTS.md for batch-run scripts.

Metadata

Release files for bench-mfg-suite 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bench-mfg-suite 0.1.3
File Size Uploaded Provenance Actions
bench_mfg_suite-0.1.3.tar.gz 112.4 kB With provenance Details for bench_mfg_suite-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bench-mfg-suite 0.1.3
File Interpreter ABI Platform Actions
bench_mfg_suite-0.1.3-py3-none-any.whl Python 3 none any Details for bench_mfg_suite-0.1.3-py3-none-any.whl

Total release size: 259.0 kB

Release files / bench_mfg_suite-0.1.3.tar.gz

Download URL bench_mfg_suite-0.1.3.tar.gz
Size 112.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4c65642054cedfc80c30573395f278c2e9a76a526ca8b82651ba76cf1910b07f
BLAKE2b-256 checksum
How to use checksums
fa1aabe432b72d44e8a8e0de504d5b889ded1e814c2416edd5894438985e87a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / bench_mfg_suite-0.1.3-py3-none-any.whl

Download URL bench_mfg_suite-0.1.3-py3-none-any.whl
Size 146.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78a5e8f3e38d849288476f6f205835cceea7666698772c0723f9c30c550977f1
BLAKE2b-256 checksum
How to use checksums
1370bdad09b15c494b1530ff8e099d91395a0d015d08163b6287827ce02e42ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Security for bench-mfg-suite 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bench_mfg_suite-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page