Controlled Generative Diffusions for Rare Event Simulation

drawing Image adapted from Domingo-Enrich et al, "Adjoint matching: fine-tuning flow and diffusion generative models with memoryless stochastic optimal control" (2025).

Summary

We propose adapting a controlled generative diffusion model for applications in rare event simulation. Building on Domingo-Enrich et al. (2025), we detail our theoretical formulation for solving for the optimal control via adjoint matching. We demonstrate results using our formulation toward challenges in rare event simulation: first, we incorporate subset simulation of sequentially estimating intermediate event probabilities to drive samples toward the failure threshold. Then, we introduce importance sampling to minimize the computational cost of many evaluations of the gradient of the reward function. Below, we summarize the problem statement and relevant techniques.

Intro

In many generative modeling applications, fine-tuning methods have been used to improve the sample quality of diffusion models based on a specified reward function. For a base generative model which samples a distribution pbase(x)p_{\text{base}}(x), one can generate samples from a tilted target distribution p(x)p(x) based on an appropriate reweighting by the reward function r(x)r(x), e.g.,

p(x)pbase(x)exp(r(x)).p(x) \propto p_{\text{base}}(x)\exp(r(x)).

This perspective has close ties to Bayesian inference, where r(x)r(x) encodes a log likelihood function, and has been used to align the output of generative models with human preferences using human feedback data, such as with large language models (Ziegler et al, 2019) and image generators (Domingo-Enrich et al, 2025).

Controlled generative diffusions

Let XtRnX_t \in \mathbb{R}^n denote the state of a generative diffusion process at diffusion time t[0,T]t \in [0,T]. The baseline generative diffusion is a reverse-time stochastic differential equation (SDE) written schematically as

dXt=b0(t,Xt)dt+σ(t)dWt,X0N(0,In)dX_t = b_0(t,X_t) dt + \sigma(t) dW_t, \quad X_0 \sim N(0,\mathbb{I}_n)

where b0:[0,T]×RnRnb_0: [0,T] \times \mathbb{R}^n \to \mathbb{R}^n denotes the base drift, σ:[0,T]Rn×m\sigma: [0,T] \to \mathbb{R}^{n \times m} denotes the diffusion coefficient, and WtW_t denotes mm-dimensional standard Brownian motion. In the reverse-time SDE, the base drift incorporates the score of the time-marginal distribution p0(t,x)p_0(t,x), such that the law of the state at the terminal time, XTX_T, corresponds to pbasep_{\text{base}}. One can interpret the SDE as transporting samples from a tractable reference distribution, such as a standard Gaussian, to the base distribution pbasep_{\text{base}}.

Suppose we define a reward function, r:RnRr: \mathbb{R}^n \to \mathbb{R}, which assigns high values to desired terminal samples. Given a controlled process

dXtu=[b0(t,Xtu)+σ(t)u(t,Xtu)]dt+σ(t)dWt,X0uN(0,In)dX^u_t = [ b_0(t,X^u_t) + \sigma(t) u(t,X^u_t)] dt + \sigma(t) dW_t', \quad X^u_0 \sim N(0,\mathbb{I}_n)

the fine-tuning problem corresponds to solving for the control function u:[0,T]×RnRnu^*:[0,T] \times \mathbb{R}^n \to \mathbb{R}^n for which the law of XTuX^{u^*}_T is the tilted distribution pp weighted by the reward.

Fine-tuning via stochastic optimal control

Stochastic optimal control (SOC) defines the appropriate objective to solve for the optimal control function. A common instantiation is the quadratic cost control-affine problem formulation,

u=argminuU EXuPu[0T(12u(t,Xtu)2+f(t,Xtu))dt+g(XTu)]u^* = \underset{u \in \mathcal{U}}{\text{argmin}} \ \mathbb{E}_{X^u \sim \mathbb{P}^u} \left[ \int_0^T \left(\frac{1}{2} ||u(t, X_t^u)||^2 + f(t,X_t^u)\right) \,dt + g(X_T^u) \right]

where Pu\mathbb{P}^u is the law of XuX^u, e.g. a path measure, ff are the running costs, gg is the terminal cost, and U\mathcal{U} is a suitable choice of Hilbert space of control functions. We define the cost functional as the expected future cost starting from a state xx at time tt,

J(u;t,x)EXuPu[tT(12u(s,Xs)2+f(s,Xs))ds+g(XT)Xt=x].J(u;t,x) \coloneqq \mathbb{E}_{X^u \sim \mathbb{P}^u} \left[ \int_t^T \left(\frac{1}{2} ||u(s,X_s)||^2 + f(s,X_s)\right)\,ds + g(X_T) | X_t = x \right].

The value function is the optimal value of the cost functional J(u;t,x)J(u^*;t,x) and can be expressed in terms of the law of the uncontrolled base process, P0\mathbb{P}^0, as

V(t,x)=logEXP0[exp(tTf(s,Xs)dsg(XT))Xt=x].V(t,x) = -\log \mathbb{E}_{X \sim \mathbb{P}^0} \left[ \exp\left( -\int_t^T f(s,X_s) \,ds - g(X_T) \right) | X_t = x \right].

Setting f=0f=0 and g=rg=-r, we can arrive at an expression for the distribution pp^* induced by the optimal control uu^* as

p(X0,XT)=pbase(X0,XT)exp(r(XT)+V(0,X0)).p^*(X_0,X_T) = p_{\text{base}}(X_0,X_T) \exp(r(X_T) + V(0,X_0)).

Note that the above distribution is not equal to the target tilted distribution due to the dependency on the initial value function, V(0,X0)V(0,X_0). One could try to formulate different costs ff and gg to correct for this bias, though it may be analytically or computationally difficult. Instead, it can be shown that it is possible to remove the value function bias by choosing a particular memoryless noise schedule during the fine-tuning procedure. A generative process is memoryless if X0X_0 and XTX_T are independent, such that pbase(X0,XT)=pbase(X0)pbase(XT)p_{\text{base}}(X_0,X_T) = p_{\text{base}}(X_0)p_{\text{base}}(X_T). This implies one can marginalize out the variable X0X_0 to obtain

p(X1)=pbase(X0)pbase(X1)exp(r(X1)+V(X0,0))dX0pbase(X1)exp(r(X1)).p^*(X_1) = \int p_{\text{base}}(X_0) p_{\text{base}}(X_1) \exp(r(X_1) + V(X_0,0))\,dX_0 \propto p_{\text{base}}(X_1) \exp(r(X_1)).

Therefore, solving the SOC problem with a memoryless base model will result in a fine-tuned model that generates samples according to the tilted distribution. A generative process is memoryless if the diffusion coefficient is chosen as

σ(t)=2ηt,\sigma(t) = \sqrt{2 \eta_t},

where ηt=βt(α˙tαtβtβ˙t)\eta_t = \beta_t(\frac{\dot{\alpha}_t}{\alpha_t} \beta_t - \dot{\beta}_t), αt=t\alpha_t=t, and βt=1t\beta_t = 1-t. A key contribution of Domingo et al. (2025) is adjoint matching, an efficient method of solving the SOC problem using a memoryless noise schedule without expensive reinforcement learning techniques.

Rare event estimation

One practical application of sampling from a tilted distribution is rare event estimation, where the objective is to estimate the probability of events that are extremely unlikely under the target distribution. For an event domain AA, the probability is given by P[xA]=Expbase[1A(x)]\mathbb{P}[x \in A] = \mathbb{E}_{x \sim p_\text{base}}[\mathbb{1}_A(x)]. In literature, the boundary of the failure domain A\partial A is referred to as the failure threshold. In this setting, standard Monte Carlo estimators are computationally inefficient due to the prohibitively large number of samples from pbasep_\text{base} which would be required to observe the rare event and estimate its statistics. Importance sampling addresses this challenge by biasing the sampling toward rare-event regions and then correcting the bias with appropriate weights. Exponential tilting is common in importance sampling; unfortunately, it is usually confined to regimes where both pbasep_\text{base} and rr come from well-understood parametric exponential families.

In the context of rare event estimation, solving for an optimal proposal distribution qq, e.g. by cross-entropy methods, is increasingly more challenging when the probability of the rare event becomes extremely small. Au and Beck (2001) introduced subset simulation as a computationally tractable technique in this setting, which decomposes a rare event into a sequence of more frequent intermediate events. This is achieved by expressing the rare event probability, P(A)P(A), as a product of conditional probabilities corresponding to mm nested intermediate events which satisfy AmAm1A1A_m \subset A_{m-1} \subset \cdots \subset A_1, with Am=AA_m = A:

P(A)=P(Am)=P(A1)P(A2A1)...P(AmAm1).P(A) = P(A_m) = P(A_1) \cdot P(A_2 | A_1) \cdot ... \cdot P(A_m | A_{m-1}).

The failure threshold bib_i corresponding to each intermediate event AiA_i for i=1,..,mi=1,..,m is defined in terms of a performance function Y=h(x)Y=h(x), such that Ai={X:Y>bi}A_i = \{ X : Y > b_i \}. The thresholds are chosen adaptively such that the conditional probabilities P(AiAi1)P(A_i | A_{i-1}) are neither too small or too large to ensure efficient sampling. Subset simulation then samples from the conditional distribution corresponding to each probability, allowing the method to focus computational effort on progressively rarer regions of the input space. This sequential framework greatly improves the efficiency and robustness of rare event estimation, particularly in high-dimensional and nonlinear systems.

Related Papers

D. Sharp, E. Williams, J. Zou (equal contribution). “Controlled Generative Diffusion Models for Rare-Event Simulation.” Project report for MIT 6.S982: Diffusion Models: From Theory to Practice. 2025.

Paper distributed by request.