Official implementation for the ICLR 2025 paper "TFG-Flow: Training-Free Guidance in Multi-Modal Generative Flow" by Haowei Lin, Shanda Li, Haotian Ye, Yiming Yang, Stefano Ermon, Yitao Liang, Jianzhu Ma.
- TFG-FLOW: Training-Free Guidance in Multi-Modal Generative Flow
TFG-Flow introduces a novel training-free guidance framework for multi-modal generative flows, enabling controlled generation across diverse modalities without retraining. Our method achieves state-of-the-art performance in molecular property-guided generation on the QM9 quantum chemistry dataset, supporting precise control over 6 key molecular properties:
- Alpha
- Cv (Heat capacity)
- Gap (HOMO-LUMO gap)
- Homo (Highest occupied molecular orbital)
- Lumo (Lowest unoccupied molecular orbital)
- Mu (Dipole moment)
- ๐ Training-Free Guidance: Modify generation behavior without model retraining
- ๐ฌ Multi-Modal Flow: Implement multimodal flow on molecule generation
- Python 3.10+
- CUDA-enabled GPU (recommended)
- NVIDIA drivers compatible with CUDA 12.1
# Create and activate conda environment
conda create -n tfgflow python=3.10 -y
conda activate tfgflow
# Install PyTorch
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
# Clone repository and install dependencies
git clone https://github.com/linhaowei1/tfg-flow.git
cd tfg-flow
pip install -r requirements.txt
The QM9 dataset will be automatically downloaded and processed on first run.
- Base Flow Model: Learn the underlying data distribution
- Guidance Classifier: Estimate conditional probabilities for guidance
- Oracle Model: Provide target property predictions
bash scripts/train_flow.sh
bash scripts/train_guide_clf.sh
bash scripts/train_oracle.sh
Generate molecules with specific property targets:
bash scripts/qm9/guidance/qm9_homo.sh
for property in alpha cv gap homo lumo mu; do
bash scripts/qm9/guidance/qm9_${property}.sh
done
Note: For energy unit conversion between Hartree and meV:
1 Hartree = 27211.4 meV # for homo, lumo, gap
Access our pre-trained checkpoints:
./storage/
โโโ flow_models.pth # Base flow checkpoints
โโโ guide_clf_ckpt.zip # Guidance predictors
โโโ oracle_clf_ckpt.zip # Target property predictors
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature
) - Commit your changes (
git commit -am 'Add awesome feature'
) - Push to the branch (
git push origin feature/your-feature
) - Open a Pull Request
If you use TFG-Flow in your research, please cite:
@inproceedings{tfgflow2025,
title={TFG-Flow: Training-Free Guidance in Multi-Modal Generative Flow},
author={Lin, Haowei and Li, Shanda and Ye, Haotian and Yang, Yiming and Ermon, Stefano and Liang, Yitao and Ma, Jianzhu},
booktitle={International Conference on Learning Representations (ICLR)},
year={2025}
}
For questions and collaborations:
- Haowei Lin: linhaowei@pku.edu.cn
- GitHub Issues: https://github.com/linhaowei1/tfg-flow/issues