Facebook's answer to the Gym bottleneck: 1,024 games, one batch
A C++-first RL platform that parallelizes game environments so Python only sees batched tensors, not threading headaches.

What it does ELF is a reinforcement-learning research platform built around a simple insight: modern RL needs thousands of concurrent game rollouts, but Python’s GIL makes that painful. ELF runs the games in multithreaded C++, batches their states, and hands them to Python as clean tensors. It ships with MiniRTS (a stripped-down StarCraft-like), Atari via ALE, and a Go engine, plus a PyTorch actor-critic backend.
The interesting bit
The design inverts the usual Gym pattern. Instead of one Python process per game instance, ELF’s C++ core hosts 1,024 games and blocks until a batch of 256 is ready. Python just calls context.Wait(), runs the model, and calls context.Steps(). The README claims 40K FPS per core on a MacBook Pro for MiniRTS, and training to 70% winrate in 12 hours on 16 CPUs and one GPU.
Key highlights
- C++ threading for game simulation; Python sees only batched states (
s,r,terminal) and replies with actions (a) - Includes MiniRTS, Atari, and DarkForest Go environments; any C/C++ game can be wrapped in
- PyTorch RL backend with provided actor-critic implementations
- Alternative Python multiprocessing path via ZeroMQ (
ex_elfpy.py) if you prefer - Visualization requires compiling a separate backend component
Caveats
- Setup is involved: needs
cmake >= 3.8,gcc >= 4.9, Intel TBB, and specific PyTorch 0.2.0+ versions; the install script hardcodes conda paths - The README’s performance numbers (40K FPS, 12-hour training) lack reproducibility details or hardware specifics beyond “MacBook Pro” and “16 CPU + 1 GPU”
- Documentation and tutorial links point to external personal domains, not Facebook infrastructure
Verdict Worth a look if you’re hitting scaling limits with Gym-style single-instance wrappers and can tolerate C++ build tooling. Skip it if you need plug-and-play environments or are committed to JAX/TensorFlow ecosystems.