Skip to content

Software

Stable-Baselines3

By DLR-RM, from github.com/DLR-RM/stable-baselines3 (opens in a new tab)

  • Humanoids and robot learning
  • Library
  • MIT

Stable-Baselines3 is a set of reliable PyTorch implementations of reinforcement learning algorithms, meant as baselines for research and for building new projects.

Facts

GitHub stars
14,070read on 29 Nov 2026
Last update
28 Nov 2026Newest commit on master
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate
Hardware it needs, as the project states it
Requires Python 3.10+ and PyTorch >= 2.8; no GPU, memory or board requirements are stated.

Checked on GitHub on 29 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 95a4016 (opens in a new tab), on 29 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Provides implementations of many reinforcement learning algorithms, including A2C, DDPG, DQN, PPO, SAC, TD3 and HER, with a common interface.
  • Supports custom environments and custom policies, plus Dict observation spaces and TensorBoard logging.
  • Offers a sklearn-like syntax for training and running agents, for example PPO on CartPole in a few lines.
  • Experimental and newer algorithms live in the separate SB3-Contrib and SBX (Jax) repositories.
  • Includes the RL Baselines3 Zoo, a training framework with tuned hyperparameters and trained agents.
  • Assumes some prior knowledge of reinforcement learning; the project does not offer technical support.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
Used by AcroMonk, Langostino, Open-Yta Hand, Spot Micro - Leika and 2 more.
Licence
MIT. Commercial use: Yes. Where it was read
Install
pip install 'stable-baselines3[extra]'Where it comes from
Maintenance
Active, last commit on 28 Nov 2026.

Works with

6 robots on Robotheca

The robots on Robotheca that use it or can run it, each with how the link was found.

Use it

Copied word for word from the creator's own documentation; each block links to the lines it comes from.

Install using pip

pip install 'stable-baselines3[extra]'

From README.md at 0cdcd20, line 116 (opens in a new tab)

Bleeding-edge version

pip install git+https://github.com/DLR-RM/stable-baselines3

From docs/guide/install.md at 0cdcd20, line 46 (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 95a4016

Robotheca read the repository at three versions: the summary at b2878f4, the facts and the README at 95a4016 (read on 29 Nov 2026) and the install commands at 0cdcd20 (read on 6 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by DLR-RM, at commit 95a4016, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

(opens in a new tab) Image: Documentation Status (opens in a new tab) (opens in a new tab) Image: coverage report (opens in a new tab) (opens in a new tab) (opens in a new tab)

Stable Baselines3

Picture: logo.png

Stable Baselines3 (SB3) is a set of reliable implementations of reinforcement learning algorithms in PyTorch. It is the next major version of Stable Baselines (opens in a new tab).

You can read a detailed presentation of Stable Baselines3 in the v1.0 blog post (opens in a new tab) or our JMLR paper (opens in a new tab).

These algorithms will make it easier for the research community and industry to replicate, refine, and identify new ideas, and will create good baselines to build projects on top of. We expect these tools will be used as a base around which new ideas can be added, and as a tool for comparing a new approach against existing ones. We also hope that the simplicity of these tools will allow beginners to experiment with a more advanced toolset, without being buried in implementation details.

Note: Despite its simplicity of use, Stable Baselines3 (SB3) assumes you have some knowledge about Reinforcement Learning (RL). You should not utilize this library without some practice. To that extent, we provide good resources in the documentation (opens in a new tab) to get started with RL.

Main Features

The performance of each algorithm was tested (see Results section in their respective page). You can take a look at the issues #48 (opens in a new tab) and #49 (opens in a new tab) for more details.

We also provide detailed logs and reports on the OpenRL Benchmark (opens in a new tab) platform.

FeaturesStable-Baselines3
State of the art RL methods:heavy_check_mark:
Documentation:heavy_check_mark:
Custom environments:heavy_check_mark:
Custom policies:heavy_check_mark:
Common interface:heavy_check_mark:
Dict observation space support:heavy_check_mark:
Ipython / Notebook friendly:heavy_check_mark:
Tensorboard support:heavy_check_mark:
PEP8 code style:heavy_check_mark:
Custom callback:heavy_check_mark:
High code coverage:heavy_check_mark:
Type hints:heavy_check_mark:
Planned features

Since most of the features from the original roadmap (opens in a new tab) have been implemented, there are no major changes planned for SB3; it is now stable. If you want to contribute, you can search in the issues for the ones where help is welcomed (opens in a new tab) and the other proposed enhancements (opens in a new tab).

While SB3 development is now focused on bug fixes and maintenance (doc update, user experience, ...), there is more active development going on in the associated repositories:

Migration guide: from Stable-Baselines (SB2) to Stable-Baselines3 (SB3)

A migration guide from SB2 to SB3 can be found in the documentation (opens in a new tab).

Documentation

Documentation is available online: https://stable-baselines3.readthedocs.io/ (opens in a new tab)

Integrations

Stable-Baselines3 has some integration with other libraries/services like Weights & Biases for experiment tracking or Hugging Face for storing/sharing trained models. You can find out more in the dedicated section (opens in a new tab) of the documentation.

RL Baselines3 Zoo: A Training Framework for Stable Baselines3 Reinforcement Learning Agents

RL Baselines3 Zoo (opens in a new tab) is a training framework for Reinforcement Learning (RL).

It provides scripts for training, evaluating agents, tuning hyperparameters, plotting results and recording videos.

In addition, it includes a collection of tuned hyperparameters for common environments and RL algorithms, and agents trained with those settings.

Goals of this repository:

  1. Provide a simple interface to train and enjoy RL agents
  2. Benchmark the different Reinforcement Learning algorithms
  3. Provide tuned hyperparameters for each environment and RL algorithm
  4. Have fun with the trained agents!

Github repo: https://github.com/DLR-RM/rl-baselines3-zoo (opens in a new tab)

Documentation: https://rl-baselines3-zoo.readthedocs.io/en/master/ (opens in a new tab)

SB3-Contrib: Experimental RL Features

We implement experimental features in a separate contrib repository: SB3-Contrib (opens in a new tab)

This allows SB3 to maintain a stable and compact core, while still providing the latest features, like Recurrent PPO (PPO LSTM), CrossQ, Truncated Quantile Critics (TQC), Quantile Regression DQN (QR-DQN) or PPO with invalid action masking (Maskable PPO).

Documentation is available online: https://sb3-contrib.readthedocs.io/ (opens in a new tab)

Stable-Baselines Jax (SBX)

Stable Baselines Jax (SBX) (opens in a new tab) is a proof of concept version of Stable-Baselines3 in Jax, with recent algorithms like DroQ or CrossQ.

It provides a minimal number of features compared to SB3 but can be much faster (up to 20x times!): https://twitter.com/araffin2/status/1590714558628253698 (opens in a new tab)

Installation

Note: Stable-Baselines3 supports PyTorch >= 2.8

Prerequisites

Stable Baselines3 requires Python 3.11+.

Windows

To install stable-baselines on Windows, please look at the documentation (opens in a new tab).

Install using pip

Install the Stable Baselines3 package:

pip install 'stable-baselines3[extra]'

This includes optional dependencies like Tensorboard, OpenCV, ale-py to train on atari games, as well as pandas and matplotlib for plotting and analyzing results. If you do not need those, you can use:

pip install stable-baselines3

Please read the documentation (opens in a new tab) for more details and alternatives (from source, using docker).

Example

Most of the code in the library tries to follow a sklearn-like syntax for the Reinforcement Learning algorithms.

Here is a quick example of how to train and run PPO on a cartpole environment:

import gymnasium as gym

from stable_baselines3 import PPO

env = gym.make("CartPole-v1", render_mode="human")

model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=10_000)

vec_env = model.get_env()
obs = vec_env.reset()
for i in range(1000):
    actions, _states = model.predict(obs, deterministic=True)
    obs, rewards, dones, info = vec_env.step(actions)
    vec_env.render()
    # VecEnv resets automatically
    # if done:
    #   obs = env.reset()

env.close()

Or just train a model with a one liner if the environment is registered in Gymnasium (opens in a new tab) and if the policy is registered (opens in a new tab):

from stable_baselines3 import PPO

model = PPO("MlpPolicy", "CartPole-v1").learn(10_000)

Please read the documentation (opens in a new tab) for more examples.

Try it online with Colab Notebooks!

All the following examples can be executed online using Google Colab notebooks:

Implemented Algorithms
NameRecurrentBoxDiscreteMultiDiscreteMultiBinaryMulti Processing
A2C:x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
ARS1:x::heavy_check_mark::heavy_check_mark::x::x::heavy_check_mark:
CrossQ12:x::heavy_check_mark::x::x::x::heavy_check_mark:
DDPG:x::heavy_check_mark::x::x::x::heavy_check_mark:
DQN:x::x::heavy_check_mark::x::x::heavy_check_mark:
DroQ2:x::heavy_check_mark::x::x::x::heavy_check_mark:
HER:x::heavy_check_mark::heavy_check_mark::x::x::heavy_check_mark:
Maskable PPO1:x::x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
PPO:x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
QR-DQN1:x::x::heavy_check_mark::x::x::heavy_check_mark:
RecurrentPPO1:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
SAC:x::heavy_check_mark::x::x::x::heavy_check_mark:
SAC-N2:x::heavy_check_mark::x::x::x::heavy_check_mark:
SimBa2:x::heavy_check_mark::x::x::x::heavy_check_mark:
TD3:x::heavy_check_mark::x::x::x::heavy_check_mark:
TQC1:x::heavy_check_mark::x::x::x::heavy_check_mark:
TRPO1:x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:

1: Implemented in SB3 Contrib (opens in a new tab) GitHub repository.

2: Implemented in SBX (SB3 + Jax) (opens in a new tab)

Actions gymnasium.spaces:

  • Box: A N-dimensional box that contains every point in the action space.
  • Discrete: A list of possible actions, where only one action can be used per timestep.
  • MultiDiscrete: A list of possible actions, where each timestep only one action of each discrete set can be used.
  • MultiBinary: A list of possible actions, where each timestep any of the actions can be used in any combination.
Testing the installation
Install dependencies
pip install -e '.[docs,tests,extra]'
Run tests

All unit tests in stable baselines3 can be run using pytest runner:

make pytest

To run a single test file:

python3 -m pytest -v tests/test_env_checker.py

To run a single test:

python3 -m pytest -v -k 'test_check_env_dict_action'

You can also do a static type check using mypy:

pip install mypy
make type

Codestyle check with ruff:

pip install ruff
make lint
Projects Using Stable-Baselines3

We try to maintain a list of projects using stable-baselines3 in the documentation (opens in a new tab), please tell us if you want your project to appear on this page ;)

Citing the Project

To cite this repository in publications:

@article{stable-baselines3,
  author  = {Antonin Raffin and Ashley Hill and Adam Gleave and Anssi Kanervisto and Maximilian Ernestus and Noah Dormann},
  title   = {Stable-Baselines3: Reliable Reinforcement Learning Implementations},
  journal = {Journal of Machine Learning Research},
  year    = {2021},
  volume  = {22},
  number  = {268},
  pages   = {1-8},
  url     = {https://jmlr.org/papers/v22/20-1364.html}
}

Note: If you need to refer to a specific version of SB3, you can also use the Zenodo DOI (opens in a new tab).

Maintainers

Stable-Baselines3 is currently maintained by Ashley Hill (opens in a new tab) (aka @hill-a), Antonin Raffin (opens in a new tab) (aka @araffin (opens in a new tab)), Maximilian Ernestus (opens in a new tab) (aka @ernestum), Adam Gleave (opens in a new tab) (@AdamGleave), Anssi Kanervisto (opens in a new tab) (@Miffyli) and Quentin Gallouédec (opens in a new tab) (@qgallouedec).

Important Note: We do not provide technical support, or consulting and do not answer personal questions via email. Please post your question on the RL Discord (opens in a new tab), Reddit (opens in a new tab), or Stack Overflow (opens in a new tab) in that case.

How To Contribute

For anyone interested in making the baselines better, there is still some documentation that needs to be done. If you want to contribute, please read CONTRIBUTING.md (opens in a new tab) guide first.

Acknowledgments

The initial work to develop Stable Baselines3 was partially funded by the project Reduced Complexity Models from the Helmholtz-Gemeinschaft Deutscher Forschungszentren, and by the EU Horizon 2020 Research and Innovation Programme under grant number 951992 (VeriDream (opens in a new tab)).

The original version, Stable Baselines, was created in the robotics lab U2IS (opens in a new tab) (INRIA Flowers (opens in a new tab) team) at ENSTA ParisTech (opens in a new tab).

Logo credits: L.M. Tenkes (opens in a new tab)

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.