Code for TFG: Unified Training-Free Guidance for Diffusion Models
Python
88
24 commits
updated Oct 29, 2025
Code and data for our paper TFG: Unified Training-Free Guidance for Diffusion Models.
pipeline.py to better support the inference-time scaling study. You can adjust the bon_rate (default=1) to use different "N" in your Best-of-N sampling strategy.
Given an unconditional diffusion model and a predictor for a target property of interest (e.g., a classifier), the goal of training-free guidance is to generate samples with desirable target properties without additional training. This paper introduces a novel algorithmic framework encompassing existing methods as special cases, unifying the study of training-free guidance into the analysis of an algorithm-agnostic design space. Via theoretical and empirical investigation, we propose an efficient and effective hyper-parameter searching strategy that can be readily applied to any downstream task. We systematically benchmark across 7 diffusion models on 16 tasks with 40 targets, and improve performance by 8.5% on average. Our framework and benchmark offer a solid foundation for conditional generation in a training-free manner.
pip install -r requirements.txt.MODEL_PATH in utils/env_utils.py as the path of the downloaded directory.You can check ./scripts for examplar scripts. Also, if you want to write the script yourself, please refer to ./utils/configs.py for details.
We would welcome any contributions, pull requests, or issues! To do so, please either file a new pull request or issue. We'll be sure to follow up shortly!
If you find our work helpful, please use the following citations.
@article{
ye2024tfg,
title={TFG: Unified Training-Free Guidance for Diffusion Models},
author={Haotian Ye and Haowei Lin and Jiaqi Han and Minkai Xu and Sheng Liu and Yitao Liang and Jianzhu Ma and James Zou and Stefano Ermon},
booktitle={NeurIPS},
year={2024}
}
MIT. Check LICENSE.md.
Code for TFG: Unified Training-Free Guidance for Diffusion Models
Python
88
24 commits
updated Oct 29, 2025
Code and data for our paper TFG: Unified Training-Free Guidance for Diffusion Models.
pipeline.py to better support the inference-time scaling study. You can adjust the bon_rate (default=1) to use different "N" in your Best-of-N sampling strategy.
Given an unconditional diffusion model and a predictor for a target property of interest (e.g., a classifier), the goal of training-free guidance is to generate samples with desirable target properties without additional training. This paper introduces a novel algorithmic framework encompassing existing methods as special cases, unifying the study of training-free guidance into the analysis of an algorithm-agnostic design space. Via theoretical and empirical investigation, we propose an efficient and effective hyper-parameter searching strategy that can be readily applied to any downstream task. We systematically benchmark across 7 diffusion models on 16 tasks with 40 targets, and improve performance by 8.5% on average. Our framework and benchmark offer a solid foundation for conditional generation in a training-free manner.
pip install -r requirements.txt.MODEL_PATH in utils/env_utils.py as the path of the downloaded directory.You can check ./scripts for examplar scripts. Also, if you want to write the script yourself, please refer to ./utils/configs.py for details.
We would welcome any contributions, pull requests, or issues! To do so, please either file a new pull request or issue. We'll be sure to follow up shortly!
If you find our work helpful, please use the following citations.
@article{
ye2024tfg,
title={TFG: Unified Training-Free Guidance for Diffusion Models},
author={Haotian Ye and Haowei Lin and Jiaqi Han and Minkai Xu and Sheng Liu and Yitao Liang and Jianzhu Ma and James Zou and Stefano Ermon},
booktitle={NeurIPS},
year={2024}
}
MIT. Check LICENSE.md.