Skip to main content

sb3-soft

sb3-soft provides reinforcement learning algorithms with soft Q-targets, implemented on top of Stable-Baselines3.

Current scope:

  • Discrete action spaces
  • SQL (Soft Q-Learning)
  • SDSAC (Stable Discrete Soft Actor-Critic)

Why sb3-soft?

  • Familiar SB3-style API (learn, predict, save, load)
  • Drop-in usage for Gymnasium discrete environments
  • Strong algorithm-focused implementation with clean class-level docstrings

Installation

Install from PyPI:

pip install sb3-soft
# or
uv add sb3-soft

Install the latest development version:

pip install git+https://github.com/miki-yuasa/sb3-soft.git
# or
uv add git+https://github.com/miki-yuasa/sb3-soft.git

Quick Start

SQL

from sb3_soft import SQL
from stable_baselines3.common.env_util import make_vec_env

env = make_vec_env("CartPole-v1", n_envs=1)

model = SQL(
    "MlpPolicy",
    env,
    learning_rate=1e-4,
    buffer_size=100_000,
    verbose=1,
)
model.learn(total_timesteps=100_000)
model.save("sql_cartpole")

SDSAC

from sb3_soft import SDSAC
from stable_baselines3.common.env_util import make_vec_env

env = make_vec_env("CartPole-v1", n_envs=1)

model = SDSAC(
    "MlpPolicy",
    env,
    learning_rate=3e-4,
    buffer_size=100_000,
    batch_size=256,
    verbose=1,
)
model.learn(total_timesteps=100_000)
model.save("sdsac_cartpole")

Algorithms

SQL (Soft Q-Learning)

  • Entropy-regularized Bellman backups via soft value targets
  • Boltzmann (softmax) sampling over Q-values
  • Optional automatic entropy-coefficient tuning

SDSAC (Stable Discrete SAC)

  • Categorical actor + twin critics for discrete actions
  • Double-average Q-learning (mean twin target)
  • Q-clip critic loss and entropy-penalty term for stability
  • Replay buffers that store per-transition old policy entropy

Documentation

Build docs locally:

uv sync --group dev
cd docs
uv run sphinx-build -b html . _build/html

Development

Set up a local development environment:

uv sync --group dev --group lint

Run tests:

uv run pytest

Citation

@misc{yuasa2026sb3soft,
  author = {Yuasa, Mikihisa},
  title = {sb3-soft},
  year = {2026},
  howpublished = {\url{https://github.com/miki-yuasa/sb3-soft}}
}

Metadata

Release files for sb3-soft 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sb3-soft 0.1.1
File Size Uploaded Provenance Actions
sb3_soft-0.1.1.tar.gz 120.6 kB Without provenance Details for sb3_soft-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sb3-soft 0.1.1
File Interpreter ABI Platform Actions
sb3_soft-0.1.1-py3-none-any.whl Python 3 none any Details for sb3_soft-0.1.1-py3-none-any.whl

Total release size: 142.9 kB

Release files / sb3_soft-0.1.1.tar.gz

Download URL sb3_soft-0.1.1.tar.gz
Size 120.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae19dc9265934e7f9c46b7fd1b0aa05a60e6eb63a9192521b31a119e239a1c2b
BLAKE2b-256 checksum
How to use checksums
325e220f8717b6e7e7f0d1bb9e7762dbfa283efb9b9cc6093d8b7a9fa2d29c20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.8

Release files / sb3_soft-0.1.1-py3-none-any.whl

Download URL sb3_soft-0.1.1-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b7f255cd243e5013f9dd0d215a4eca8a069eaa58fc339d1847a863601e6e7dc
BLAKE2b-256 checksum
How to use checksums
e26ff8de401d84be65a1f2e80a23831dbe821954ab9c1ce656ed0bb857212691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.8

Security for sb3-soft 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page