Diffusion Gym
diffusiongym is a library for reward adaptation of any pre-trained flow model on any data modality.
Installation
In order to install diffusiongym, execute the following command:
pip install diffusiongym
diffusiongym requires PyTorch 2.3.1, and there may be other hard dependencies. Please open an issue if installation fails through the above command.
Molecule environments depend on FlowMol, which currently needs to be installed manually:
pip install git+https://github.com/cristianpjensen/FlowMol.git@8f4c98cbe68111e4e63480b250d925b6d960d3bc
Some image rewards depend on the clip package, which needs to be installed manually as well:
pip install git+https://github.com/openai/CLIP.git
High-level overview
Diffusion and flow models are largely agnostic to their data modality. They only require that the underlying data type supports a small set of operations. Building on this idea, diffusiongym is designed to be fully modular. You only need to provide the following:
- Data type
YourDataTypethat implementsDDProtocol, which defines some functions necessary for interacting with it as a flow model. - Base model
BaseModel[YourDataType], which defines the scheduler, how to sample $p_0$, how to compute the forward pass, and how to preprocess and postprocess data. - Reward function
Reward[YourDataType].
Once these are defined, you can sample from the flow model and apply reward adaptation methods, such as Value Matching.
Documentation
Much more information can be found in the documentation, including tutorials and API references.
Citation
If this library is useful to you, consider citing the following work:
@inproceedings{jensen2026value,
title={Value Matching: Scalable and Gradient-Free Reward-Guided Flow Adaptation},
author={Cristian Perez Jensen and Luca Schaufelberger and Riccardo De Santi and Kjell Jorner and Andreas Krause},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
}
Metadata
Release files for diffusiongym 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffusiongym-2.0.1.tar.gz | 5.0 MB | With provenance | Details for diffusiongym-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffusiongym-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for diffusiongym-2.0.1-py3-none-any.whl |
Total release size: 5.6 MB
Release files / diffusiongym-2.0.1.tar.gz
| Download URL | diffusiongym-2.0.1.tar.gz |
|---|---|
| Size | 5.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a6df34dad3774c0637d66b023487a190365f87c85331aed21af6ba2e994bbdc
|
|
BLAKE2b-256 checksum How to use checksums |
6e00246cd4bdd2ebd73f45fbcd02c45164a925f2013e8ca75fce0e746b700a5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 28, 2026.
Transparency logRelease files / diffusiongym-2.0.1-py3-none-any.whl
| Download URL | diffusiongym-2.0.1-py3-none-any.whl |
|---|---|
| Size | 623.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07d878986fd8ac11a67fe19d9872efdc1763e3311dd8e8a21124a2cc49761110
|
|
BLAKE2b-256 checksum How to use checksums |
e8b487da310372335602fa84d28e8a7febad05f5f9d56a0f24497ce5e1309ef9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 28, 2026.
Transparency logSecurity for diffusiongym 2.0.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for diffusiongym-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 28, 2026.
Transparency logA 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.