Authors: Shreshth Saini, Shashank Gupta, Alan C. Bovik
The University of Texas at Austin
Project Webpage: https://shreshthsaini.github.io/Rectified-CFGpp/
A training-free, geometry-aware guidance scheme for flow-based text-to-image (T2I) models. Rectified-CFG++ replaces the naïve extrapolation of classifier-free guidance (CFG) with a predictor–corrector integrator that stays on the learned data manifold, eliminating structural artifacts while improving prompt alignment and over generation quality.
- On-Manifold Sampling
Predictor–corrector updates keep trajectories on the data manifold. - Training-Free
Drop-in replacement for standard CFG—no additional training or fine-tuning required. - Model-Agnostic
Works with any transformer-based rectified-flow T2I backbone (e.g., Flux, SD3/3.5, Lumina). - Stable Across Scales
Maintains visual fidelity and prompt alignment even at high guidance strengths. - Efficient
Achieves state-of-the-art FID and CLIP-Score.
- Clone the repository:
git clone https://github.com/shreshthsaini/Rectified-CFGpp.git
cd Rectified-CFGpp- Create and activate a virtual environment using the provided YAML configuration file:
conda env create -f environment.yaml
conda activate rectcfgppThe repository includes a simple demo script (demo.py) that allows you to quickly test Rectified-CFG++ with various parameters:
Generate an image with default parameters:
python demo.py --prompt "A magical forest at twilight with glowing fireflies"Customize the generation process with additional parameters:
python demo.py \
--prompt "A cyberpunk city at night" \
--guidance_scale 4.5 \
--num_steps 28 \
--width 1024 \
--height 1024 \
--output_dir "./my_generations" \
--seed 99--prompt: Text prompt for image generation (required)--negative_prompt: Negative prompt for generation (default: "")--guidance_scale: Guidance scale for CFG (default: 4.5)--num_steps: Number of inference steps (default: 28)--sigma_noise: Sigma noise parameter (default: 0.005)--width: Output image width (default: 1024)--height: Output image height (default: 1024)--output_dir: Directory to save generated images (default: "./outputs")--seed: Random seed for reproducibility (default: 42)
Generated images will be saved in the specified output directory with filenames indicating the guidance scale and number of steps used.
Predictor–corrector updates prevent drift away from the learned data manifold.
Representative samples showcasing improved prompt adherence and perceptual quality.
If you find Rectified-CFG++ useful in your research, please cite our NeurIPS 2025 paper:
@inproceedings{saini2025rectifiedcfgpp,
title = {Rectified-CFG++ for Flow Based Models},
author = {Shreshth Saini and Shashank Gupta and Alan C. Bovik},
booktitle = {Advances in Neural Information Processing Systems},
year = {2025}
}This project is licensed under the MIT License - see the LICENSE file for details.