ChemBFN: Bayesian Flow Network for Chemistry
This is the repository of the PyTorch implementation of ChemBFN model.
Build State
Features
ChemBFN provides the state-of-the-art functionalities of
- SMILES or SELFIES-based de novo molecule generation
- Protein sequence de novo generation
- Template optimisation (mol2mol)
- Classifier-free guidance conditional generation (single or multi-objective optimisation)
- Context-guided conditional generation (inpaint)
- Outstanding out-of-distribution chemical space sampling
- Fast sampling via ODE solver
- Pseudo-continuous learning to learn from different datasets
- Molecular property and activity prediction finetuning
- Reaction yield prediction finetuning
in an all-in-one-model style. A built-in MLFF can further convert the generated SMILES strings to the corresponding 3D conformations.
News
- [26/06/2026] Our second paper has been accepted by J. Cheminform.
- [26/12/2025] We were invited to submit a short report about ChemBFN for CICSJ Bulletin.
- [09/10/2025] A web app
chembfn_webuifor hosting ChemBFN models is available on PyPI. - [30/01/2025] The package
bayesianflow_for_chemis available on PyPI. - [21/01/2025] Our first paper has been accepted by JCIM.
- [17/12/2024] The second paper of out-of-distribution generation is available on arxiv.org.
- [31/07/2024] Paper is available on arxiv.org.
- [21/07/2024] Paper was submitted to arXiv.
Install
$ pip install -U bayesianflow_for_chem
Usage
You can find example scripts in 📁example folder.
Pre-trained Model
You can find pretrained models (linked to pretraining datasets) on our 🤗Hugging Face model page.
Dataset Handling
We provide a Python class CSVData to handle data stored in CSV or similar format containing headers to identify the entities. The following is a quickstart.
- Download your dataset file (e.g., ESOL from MoleculeNet) and split the file:
>>> from bayesianflow_for_chem.tool import split_data
>>> split_data("delaney-processed.csv", method="scaffold")
- Load the split data:
>>> from bayesianflow_for_chem.data import smiles2token, collate, CSVData
>>> dataset = CSVData("delaney-processed_train.csv")
>>> dataset[0]
{'Compound ID': ['Thiophene'],
'ESOL predicted log solubility in mols per litre': ['-2.2319999999999998'],
'Minimum Degree': ['2'],
'Molecular Weight': ['84.14299999999999'],
'Number of H-Bond Donors': ['0'],
'Number of Rings': ['1'],
'Number of Rotatable Bonds': ['0'],
'Polar Surface Area': ['0.0'],
'measured log solubility in mols per litre': ['-1.33'],
'smiles': ['c1ccsc1']}
- Create a mapping function to tokenise the dataset and select values:
>>> import torch
>>> def encode(x):
... smiles = x["smiles"][0]
... value = [float(i) for i in x["measured log solubility in mols per litre"]]
... return {"token": smiles2token(smiles), "value": torch.tensor(value)}
>>> dataset.map(encode)
>>> dataset[0]
{'token': tensor([ 1, 151, 23, 151, 151, 154, 151, 23, 2]),
'value': tensor([-1.3300])}
- Wrap the dataset in torch.utils.data.DataLoader:
>>> dataloader = torch.utils.data.DataLoader(dataset, 32, collate_fn=collate)
Cite This Work
@article{2025chembfn,
title={Bayesian Flow Network Framework for Chemistry Tasks},
author={Tao, Nianze and Abe, Minori},
journal={Journal of Chemical Information and Modeling},
volume={65},
number={3},
pages={1178-1187},
year={2025},
doi={10.1021/acs.jcim.4c01792},
}
@article{2025chembfn_report,
title={Molecular Structure Design via Bayesian Flow Network},
author={Tao, Nianze and Nagai, Touma and Abe, Minori},
journal={CICSJ Bulletin},
volume={43},
number={1},
pages={10-14},
year={2025},
doi={10.11546/cicsj.43.10},
}
Out-of-distribution generation and fast sampling:
@article{2026chembfn_ood,
title={Sampling Out-of-Distribution Chemical Spaces via Bayesian Flow},
author={Tao, Nianze and Abe, Minori},
journal={Journal of Cheminformatics},
volume={18},
number={1},
pages={130},
year={2026},
doi={10.1186/s13321-026-01248-9},
}
PhD thesis:
@phdthesis{2026thesis_tao,
title={Efficient Multi-Object Optimisation for Molecular Design via Bayesian Flow Networks},
author={Nianze Tao},
year={2026},
month={September},
school={Hiroshima University},
type={PhD thesis},
note={Chemistry program},
}
Metadata
Release files for bayesianflow-for-chem 3.0.3
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 |
|---|---|---|---|---|
| bayesianflow_for_chem-3.0.3.tar.gz | 4.8 MB | Without provenance | Details for bayesianflow_for_chem-3.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bayesianflow_for_chem-3.0.3-py3-none-any.whl | Python 3 | none | any | Details for bayesianflow_for_chem-3.0.3-py3-none-any.whl |
Total release size: 9.6 MB
Release files / bayesianflow_for_chem-3.0.3.tar.gz
| Download URL | bayesianflow_for_chem-3.0.3.tar.gz |
|---|---|
| Size | 4.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d103a8042ed2c636e4369e988e67c5f05c413ea396b7a4e417c98da3d4349494
|
|
BLAKE2b-256 checksum How to use checksums |
35dfbf865880e62d9bf304ab1c4dba62d11f7f11b8ab6d9b8ec9f7355628153d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / bayesianflow_for_chem-3.0.3-py3-none-any.whl
| Download URL | bayesianflow_for_chem-3.0.3-py3-none-any.whl |
|---|---|
| Size | 4.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5232dbfd588f6f6b2dd105c883b4f0f623ae8033cc1c9ab74cb92c632d633a92
|
|
BLAKE2b-256 checksum How to use checksums |
6763036d912903345f28d2a1cf79a06365fc7d2a68ea825dcf748b7928b40843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for bayesianflow-for-chem 3.0.3
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.