TFTF: Training-Free Targeted Flow for Conditional Sampling
Abstract
We propose a training-free conditional sampling method for flow matching models based on importance sampling. Because a naïve application of importance sampling suffers from weight degeneracy in high-dimensional settings, we modify and incorporate a resampling technique in sequential Monte Carlo (SMC) during intermediate stages of the generation process. To encourage the generated samples to diverge along distinct trajectories, we derive a stochastic flow with adjustable noise strength to replace the deterministic flow at the intermediate stage. Our framework requires no additional training, while providing theoretical guarantees of asymptotic accuracy. Experimentally, our method significantly outperforms existing approaches on conditional sampling tasks for MNIST and CIFAR-10. We further demonstrate the applicability of our approach in higher-dimensional, multimodal settings through text-to-image generation experiments on CelebA-HQ.
Lay Summary
In many applications, users want generative AI systems to produce outputs that satisfy specific requirements, such as an object category or a text description. However, adapting a generative model to each new condition often requires collecting and labeling data for that condition and then retraining or fine-tuning the model. We introduce Training-Free Targeted Flow (TFTF), a method that guides a pretrained flow matching model using an off-the-shelf external signal, such as a classifier or CLIP model, without modifying or retraining the pretrained generative model itself. During generation, TFTF evaluates partially formed samples, retains and replicates promising ones, and converts the deterministic flow used by flow matching models into a stochastic flow at intermediate stages to allow the replicated particles to explore different future paths and maintain diversity. It also assigns principled statistical weights to correct sampling bias and provides theoretical guarantees in the large-particle-number limit. Experiments on image-generation tasks show that TFTF improves condition consistency, sample quality, and distributional accuracy compared with previous training-free methods.