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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bayesianflow_for_chem-3.0.2.tar.gz | 4.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bayesianflow_for_chem-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 MB
Release files / bayesianflow_for_chem-3.0.2.tar.gz
| Download URL | bayesianflow_for_chem-3.0.2.tar.gz |
|---|---|
| Size | 4.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be7cb8ce51566adb6f9eef92571ba50515554566b35e417ca6220e848ff32367
|
|
BLAKE2b-256 checksum How to use checksums |
8c085b4291a82e0e41de71d82b663b9ba75e2a643a732a7c3793acec9e60a301
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / bayesianflow_for_chem-3.0.2-py3-none-any.whl
| Download URL | bayesianflow_for_chem-3.0.2-py3-none-any.whl |
|---|---|
| Size | 4.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eda4b744fe19378cccc53419e6301c14ed7b707d1c3910618a83822595d811c8
|
|
BLAKE2b-256 checksum How to use checksums |
ae8f69bf4a5fdb71690c12acafff4ab05b643d3f9207803a1fa50c20ee9ee6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|