A unified perspective on fine-tuning and sampling with diffusion and flow models

Domingo-Enrich, Carles, Du, Yuanqi, Albergo, Michael S.

arXiv.org Machine Learning 

ABSTRACT We study the problem of training diffusion and flow generative models to sample from target distributions defined by an exponential tilting of a base density; a formulation that subsumes both sampling from unnormalized densities and reward fine-tuning of pre-trained models. This problem can be approached from a stochastic optimal control (SOC) perspective, using adjoint-based or score matching methods, or from a non-equilibrium thermodynamics perspective. We provide a unified framework encompassing these approaches and make three main contributions: (i) bias-variance decompositions revealing that Adjoint Matching/Sampling and Novel Score Matching have finite gradient variance, while Target and Conditional Score Matching do not; (ii) norm bounds on the lean adjoint ODE that theoretically support the effectiveness of adjoint-based methods; and (iii) adaptations of the CMCD and NETS loss functions, along with novel Crooks and Jarzynski identities, to the exponential tilting setting. We validate our analysis with reward fine-tuning experiments on Stable Diffusion 1.5 and 3. 1 INTRODUCTION Recent advances in generative modeling have demonstrated the effectiveness of diffusion and flow matching models for learning complex data distributions (Song et al., 2021; Ho et al., 2020; Lipman et al., 2022; Albergo et al., 2023; Liu et al., 2023). In many applications, however, it is desirable to tailor the generative process to favor certain qualities, either by sampling from an unnormalized target distribution or by fine-tuning a pre-trained model with a reward function (Uehara et al., 2024; Domingo-Enrich et al., 2025; Zhang & Chen, 2022; Holdijk et al., 2023).