arXiv:2610.40383cs.LGOct 2026

Manuscript Offprint

arXiv:2610.40383

Composing and Steering Diffusion Models with Generalized Feynman-Kac Correctors

Wael Mattar, Daniel Freedman

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Diffusion models have become the leading paradigm in generative modeling, yet many applications require sampling from distributions that are not those of any single pretrained model, but are instead defined through combinations of several models, possibly tilted toward high values of a downstream reward. Naively combining the scores of the models yields incorrect samples, while existing corrections are restricted to specific families of targets. In this work, we introduce the generalized Feynman–Kac correctors (GFKC), a principled framework for sampling from an arbitrary target function of several pretrained diffusion models. We show that the geometric interpolation between an arbitrary initial function and the target function of the models satisfies a Feynman–Kac partial differential equation, and derive its potential in closed form. To evaluate this potential during generation, we further generalize the log-probability ODE to track the density of each model along trajectories driven by a different velocity field. The resulting algorithm operates entirely in the log domain, incorporates reward-based steering at no additional conceptual cost, and corrects the generation on the fly, without retraining or fine-tuning the models. We validate the method on analytic Gaussian models, where it closely matches the ground-truth targets, and on diffusion models trained on MNIST, where it samples from non-trivial combinations of the models and enables effective steering.

1 Introduction

Diffusion models [1, 2, 3] have become the leading paradigm in generative modeling. By learning to reverse a gradual noising process, they produce samples of remarkable quality and diversity, and they are now the method of choice across a wide range of domains, including image synthesis [4, 5, 6, 7], audio [8] and video generation [9], inverse problems [10], and the design of molecules and proteins [11, 12, 13]. Beyond their empirical success, diffusion models rest on a solid mathematical foundation: in the continuous-time formulation of [3], generation amounts to simulating a stochastic or ordinary differential equation driven by a learned score, whose marginals evolve according to an explicit partial differential equation. This structure makes it possible to reason about, and to modify, the generative process in a principled way.

In many applications, however, the distribution of interest is not that of a single pretrained model. One may wish to combine several models, each trained on different data or capturing a different concept, and to sample from a distribution that is defined in terms of all of them: their product, which retains only what all models agree on; their mixture; or more elaborate combinations, such as distributions favoring the regions where one model assigns high probability and another does not. Training a new model for every such target is costly and often impractical, and a natural alternative is to reuse the pretrained models at inference time [14]. Yet, naive approaches that simply combine the scores of the models do not reproduce the correct intermediate distributions, and therefore yield biased samples [15]. Recently, [16] showed that this bias can be corrected exactly by means of the Feynman–Kac formula [17]: the generated particles are assigned weights that evolve along the generation, and are periodically resampled within a sequential Monte Carlo scheme [18]. These Feynman–Kac correctors, however, are derived separately for specific families of targets, namely annealed distributions, products of experts, and the geometric averages underlying classifier-free guidance [19].

∗^{*}School of Mathematical Sciences, Tel Aviv University, Israel.

Emails: waelmattar.95@gmail.com; d.e.freedman@gmail.com

A complementary need arises when the generated samples are required not only to be realistic, but also to optimize a downstream objective, such as the stability or binding affinity of a molecule, or the similarity of an image to a prescribed reference. This is the task of steering, or reward-guided generation [20]. A principled formulation consists in maximizing the expected reward, regularized by the Kullback–Leibler divergence to the pretrained distribution, whose solution is the pretrained distribution exponentially tilted by the reward. One approach is to fine-tune the pretrained model toward this tilted distribution [21, 22], which, however, requires additional training for every reward. Inference-time methods, such as classifier guidance [4] and SMC-based guidance [23, 24], instead approximate the tilted distribution during generation, without modifying the model, but are typically formulated for a single pretrained model.

In this paper, we unify and generalize these two lines of work. We introduce the generalized Feynman–Kac correctors (GFKC), which enable sampling from an arbitrary target function of several pretrained diffusion models, with an optional reward-based tilt. Our main result, Theorem 1, shows that the geometric interpolation between an arbitrary initial function and an arbitrary terminal function of the models satisfies a Feynman–Kac PDE, and provides its potential in closed form. To evaluate this potential along the generation, we derive a generalization of the log-probability ODE [25, 26], which tracks the density of every model along trajectories generated by a different velocity field. The resulting algorithm operates entirely in the log domain, performs the correction on the fly during the generation process, and requires neither retraining nor fine-tuning of the models. The framework of [16] is recovered as a special case.

The remainder of the paper is organized as follows. Section 2 reviews continuous-time diffusion models, the Feynman–Kac correctors, and reward-guided tilting. Section 3 presents our main result, the generalized log-probability ODE, the incorporation of steering, and the resulting GFKC algorithm. Section 4 illustrates the method in two settings of different nature: an analytic setting of overlapping Gaussian distributions, where the generated samples are compared with exact ground-truth densities, and a high-dimensional setting of diffusion models trained on the MNIST dataset [27], where we demonstrate both the sampling from non-trivial combinations of the models and the effect of steering. All numerical experiments are fully reproducible, and the code, together with the pretrained models, is publicly available at https://github.com/WaelMattar/GFKC.

References (27)