[!NOTE] ⚠️🔧 We are continuously improving BenchMFG. For any issues, problems, the need to add new env or algorithms, feel free to contact me at lm2183@cam.ac.uk or open an issue. We are quite responsive!
[!NOTE] BenchMFG2 (RL, continuous control, partially observability) is in production...
Contents
- Install
- Quick Start
- Registered Configs: envs and algos
- Sweep
- Python API
- Outputs And Plots
- Extending BenchMFG: create new envs and algos
- MF-Garnet: scaling laws and robustness
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>scansoutputs/by default. For each seed and hyperparameter version, it selects the latest timestamped run containingexploitabilities.npz.compare <environment>reads theresults/<environment>/<algorithm>/best_model.yamlfiles written byplot sweep; rerunplot sweepfirst if new runs were added.- Use
--outputs-dir <path>on sweep/compare commands when artifacts are not underoutputs/.
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bench_mfg_suite-0.1.3.tar.gz.
File metadata
- Download URL: bench_mfg_suite-0.1.3.tar.gz
- Upload date:
- Size: 112.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c65642054cedfc80c30573395f278c2e9a76a526ca8b82651ba76cf1910b07f
|
|
| MD5 |
9bbc2f2e014e0ad98d09d173274ee208
|
|
| BLAKE2b-256 |
fa1aabe432b72d44e8a8e0de504d5b889ded1e814c2416edd5894438985e87a2
|
Provenance
The following attestation bundles were made for bench_mfg_suite-0.1.3.tar.gz:
Publisher:
publish.yml on lorenzomagnino/Bench-MFG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bench_mfg_suite-0.1.3.tar.gz -
Subject digest:
4c65642054cedfc80c30573395f278c2e9a76a526ca8b82651ba76cf1910b07f - Sigstore transparency entry: 2343408847
- Sigstore integration time:
-
Permalink:
lorenzomagnino/Bench-MFG@ef8ee3e0945bba63f85c7ef8192dc906c7166c91 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/lorenzomagnino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef8ee3e0945bba63f85c7ef8192dc906c7166c91 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bench_mfg_suite-0.1.3-py3-none-any.whl.
File metadata
- Download URL: bench_mfg_suite-0.1.3-py3-none-any.whl
- Upload date:
- Size: 146.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78a5e8f3e38d849288476f6f205835cceea7666698772c0723f9c30c550977f1
|
|
| MD5 |
ad155925faa2ef9087d3028e8222dac9
|
|
| BLAKE2b-256 |
1370bdad09b15c494b1530ff8e099d91395a0d015d08163b6287827ce02e42ac
|
Provenance
The following attestation bundles were made for bench_mfg_suite-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on lorenzomagnino/Bench-MFG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bench_mfg_suite-0.1.3-py3-none-any.whl -
Subject digest:
78a5e8f3e38d849288476f6f205835cceea7666698772c0723f9c30c550977f1 - Sigstore transparency entry: 2343408891
- Sigstore integration time:
-
Permalink:
lorenzomagnino/Bench-MFG@ef8ee3e0945bba63f85c7ef8192dc906c7166c91 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/lorenzomagnino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef8ee3e0945bba63f85c7ef8192dc906c7166c91 -
Trigger Event:
push
-
Statement type: