Skip to main content

General Stochastic Automatic Differentiation for Pytorch

Documentation Status

Storchastic is a PyTorch library for stochastic gradient estimation in Deep Learning [1]. Many state of the art deep learning models use gradient estimation, in particular within the fields of Variational Inference and Reinforcement Learning. While PyTorch computes gradients of deterministic computation graphs automatically, it will not estimate gradients on stochastic computation graphs [2].

With Storchastic, you can easily define any stochastic deep learning model and let it estimate the gradients for you. Storchastic provides a large range of gradient estimation methods that you can plug and play, to figure out which one works best for your problem. Storchastic provides automatic broadcasting of sampled batch dimensions, which increases code readability and allows implementing complex models with ease.

When dealing with continuous random variables and differentiable functions, the popular reparameterization method [3] is usually very effective. However, this method is not applicable when dealing with discrete random variables or non-differentiable functions. This is why Storchastic has a focus on gradient estimators for discrete random variables, non-differentiable functions and sequence models.

Documentation on Read the Docs.

Example: Discrete Variational Auto-Encoder

Installation

In your virtual Python environment, run pip install storchastic

Requires Pytorch 1.8 and Pyro. The code is build using Python 3.8.

Algorithms

Feel free to create an issue if an estimator is missing here.

  • Reparameterization [1, 3]
  • REINFORCE with Moving Average baseline [1, 4]
  • REINFORCE with Leave-One-Out baseline (RLOO) [5, 6]
  • Expected value for enumerable distributions
  • (Straight through) Gumbel Softmax [7, 8]
  • LAX, RELAX [9]
  • REBAR [10]
  • REINFORCE Without Replacement [6]
  • Unordered Set Estimator [13]
  • ARM [15]
  • Rao-Blackwellized REINFORCE [12]

In development

  • Memory Augmented Policy Optimization [11]

Planned

  • Measure valued derivatives [1, 14]
  • Automatic Credit Assignment [16]
  • ...

References

Cite

To cite Storchastic, please cite this preprint:

@article{van2021storchastic,
  title={Storchastic: A Framework for General Stochastic Automatic Differentiation},
  author={van Krieken, Emile and Tomczak, Jakub M and Teije, Annette ten},
  booktitle = {Advances in Neural Information Processing Systems},
  editor = {M. Ranzato and A. Beygelzimer and Y. Dauphin and P.S. Liang and J. Wortman Vaughan},
  pages = {7574--7587},
  url = {https://proceedings.neurips.cc/paper_files/paper/2021/file/3dfe2f633108d604df160cd1b01710db-Paper.pdf},
  volume = {34},
  year={2021}
}

Release files for storchastic 0.3.7

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

Source distribution (sdist)

Source distribution for storchastic 0.3.7
File Size Uploaded
storchastic-0.3.7.tar.gz 84.9 kB Details

Release files / storchastic-0.3.7.tar.gz

Download URL storchastic-0.3.7.tar.gz
Size 84.9 kB
Tags Source
SHA-256 checksum
How to use checksums
236eb4db1132d3ffe0fa9634a17f5f0339fd9f748015e0127c87ddecced810b0
BLAKE2b-256 checksum
How to use checksums
4bce5f4571fe3db02a590c93c7591fe2ba33aa062233f4926f73944539514208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.3.7 This release

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

2 release files

0.1.0

1 release file

0.0.1

2 release files

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