Repolode
DLR-RM

DLR-RM/stable-baselines3

PyTorch implementations of reinforcement learning algorithms, designed as a reliable, consistent baseline for research and applications.

Stars
13,912
Forks
2,177
Open issues
88
Last commit
7 days ago

What is it?

Stable Baselines3 (SB3) is a Python library of reinforcement learning algorithms implemented in PyTorch. It is the successor to the original Stable Baselines and aims to give researchers and practitioners tested reference implementations they can reproduce, extend, and compare against.

The library covers a range of common algorithms, including A2C, DDPG, DQN, PPO, SAC, TD3 and HER, and supports Box, Discrete, MultiDiscrete and MultiBinary action spaces depending on the algorithm. Models share a scikit-learn-style interface: you create a model with a policy name and an environment, call learn, then predict. Custom environments, custom policies and callbacks are supported, along with TensorBoard logging.

Experimental and newer algorithms live in the companion SB3-Contrib repository, while the RL Baselines3 Zoo provides training scripts and tuned hyperparameters. Faster JAX-based variants are developed separately in SBX.

Key features

  • 01Implementations of widely used RL algorithms such as PPO, SAC, DQN, and TD3
  • 02Consistent scikit-learn-style API for training, saving, and predicting
  • 03Support for custom environments, policies, and callbacks
  • 04Dict observation space support and TensorBoard logging
  • 05Multiprocessing support for several algorithms

Use cases

  • Benchmarking a new RL idea against established baseline algorithms
  • Training agents on Gymnasium environments such as CartPole or Atari games
  • Prototyping robotics or control policies in simulation
  • Learning reinforcement learning with a simpler toolset before moving to complex code

Quick start

  1. 1

    Install the package with pip

    pip install 'stable-baselines3[extra]'
  2. 2

    Train a PPO agent on CartPole in one line

    python -c "from stable_baselines3 import PPO; model = PPO('MlpPolicy', 'CartPole-v1').learn(10_000)"

Things to know

  • Requires Python 3.10+ and PyTorch 2.8+.
  • Assumes prior knowledge of reinforcement learning; beginners should study the docs first.
  • Development now focuses on bug fixes and maintenance, with new algorithms in separate repositories.

Topics

FAQ

What is stable-baselines3?
PyTorch implementations of reinforcement learning algorithms, designed as a reliable, consistent baseline for research and applications. Stable Baselines3 (SB3) is a Python library of reinforcement learning algorithms implemented in PyTorch. It is the successor to the original Stable Baselines and aims to give researchers and practitioners tested reference implementations they can reproduce, extend, and compare against.
Is stable-baselines3 free to use? What license does it have?
stable-baselines3 is open source under the MIT license. Check the license terms before using it in commercial products.
Is stable-baselines3 still maintained?
Actively maintained. The last commit to stable-baselines3 was on Oct 13, 2026.
What can I use stable-baselines3 for?
Benchmarking a new RL idea against established baseline algorithms Training agents on Gymnasium environments such as CartPole or Atari games Prototyping robotics or control policies in simulation Learning reinforcement learning with a simpler toolset before moving to complex code
How do I install stable-baselines3?
Install the package with pip: pip install 'stable-baselines3[extra]' Train a PPO agent on CartPole in one line: python -c "from stable_baselines3 import PPO; model = PPO('MlpPolicy', 'CartPole-v1').learn(10_000)"
Where can I get stable-baselines3?
The source code and installation instructions are on GitHub: https://github.com/DLR-RM/stable-baselines3

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects