talira

Stable Baselines3

Reliable reinforcement learning algorithms in PyTorch

open sourceMITfree

Stable Baselines3 (SB3) is an MIT Python library of tested reinforcement learning algorithms in PyTorch, the next major version of Stable Baselines. It implements A2C, DDPG, DQN, HER, PPO, SAC and TD3 behind one common interface, with custom environments and policies, Dict observation spaces, callbacks, TensorBoard logging and integrations with Weights & Biases and Hugging Face. Newer and experimental algorithms (Recurrent PPO, CrossQ, TQC, QR-DQN) are in the separate SB3 Contrib package, and RL Baselines3 Zoo is its training framework with tuned hyperparameters.

Problems it solves

  • train a PPO agent on my own environment in Python
  • reliable implementations of reinforcement learning algorithms to build on
  • compare RL algorithms on a Gym environment without writing them myself

Features

  • A2C, DDPG, DQN, HER, PPO, SAC and TD3 behind one interface
  • custom environments, policies and callbacks
  • TensorBoard logging, Weights & Biases and Hugging Face integrations
  • performance of each algorithm tested and reported

Limitations

  • Development now focuses on bug fixes and maintenance; newer algorithms go to SB3 Contrib.1
  • Needs Python 3.11 or later and PyTorch 2.8 or later.1

Alternatives

The same job

These do what Stable Baselines3 does.

  1. PettingZoo Python library of multi-agent reinforcement learning environments with a standard API, the multi-agent counterpart of Gymnasium.
  2. Gymnasium The standard Python API for single-agent reinforcement learning environments, formerly OpenAI Gym
  3. Unity ML-Agents Toolkit An open source toolkit that turns Unity scenes into environments for training game and simulation agents with reinforcement and imitation learning.
  4. Agent Lightning Microsoft's lightweight reinforcement learning framework for training LLM agents inside their real harnesses
  5. FinRL Deep reinforcement learning framework for quantitative trading research

Compare Stable Baselines3 with the top 3