arXiv:2610.41243cs.LGOct 2026

Manuscript Offprint

arXiv:2610.41243

Generative SDEs with Trainable Diffusion and Density-Based Losses

Angxiu Ni

ANGXIU NI

Department of Mathematics, University of California, Irvine, USA

ABSTRACT. We develop a divergence-kernel method for jointly optimizing neural SDE drift and diffusion fields and the initial Gaussian distribution, using losses that depend directly on the terminal density. In two- and eight-dimensional Gaussian-mixture experiments, we learn time-independent fields and obtain far fewer off-mode samples than score-based generators with similar parameter counts. The drift attracts samples toward the modes, while the diffusion helps disperse excess probability between them.

1. INTRODUCTION

1.1. Generative models. Generative models learn a probability distribution from data and provide a way to draw new samples from it. Diffusion and score-based models form a widely used class of generative models. They learn time-dependent scores, the spatial gradients of noisy data log-densities, to construct dynamics that reverse a prescribed noising process. Standard denoising score matching uses explicit conditional scores of Gaussian perturbations as regression targets [15, 3, 14]. In these standard constructions, the diffusion coefficient is prescribed rather than jointly optimized with the generative drift.

Flow matching is a closely related approach that learns a time-dependent velocity along a prescribed probability path [6]. It can use the same probability paths as diffusion models but provides conditional velocity targets for regression. Integrating the resulting ordinary differential equation (ODE) defines a continuous normalizing flow that transports a simple initial distribution toward the data. The standard formulation has no diffusion field to optimize. The standard regression objectives in score-based methods and flow matching do not directly minimize losses that depend on the generated terminal density, such as the KL losses used here.

Our aim is to train stochastic differential equation (SDE) generative models with both learnable diffusion and losses that depend directly on the terminal density. The divergence-kernel (DK) formula provides the density response with respect to both drift and diffusion parameters [11]. Learning the diffusion field controls the local strength of stochastic spreading, while the density-based terminal loss determines how distributional errors are penalized. Both fields can be parameterized to satisfy prescribed bounds or compatible physical structure.

Our experiments use time-independent drift and diffusion, while the same DK formula also supports time-dependent fields. A fixed dynamical law allows the learned fields to be interpreted and constrained as functions of position. Time independence may also simplify sampling with fewer time steps, depending on the spatial variation of the learned fields and the numerical solver.

E-mail address: angxiun@uci.edu. Date: November 2, 2026.

1.2. Linear-response methods. Training both fields with density-based losses requires derivatives of the terminal density with respect to the drift and diffusion parameters. Linear-response methods compute how statistics or probability laws change under parameter perturbations. Following the review in [11], we distinguish path perturbation, divergence formulas, and kernel differentiation methods [9, Section 5.2].

Path perturbation fixes the Brownian path and differentiates the resulting state path, then averages over realizations. It includes ensemble sensitivity and adjoint, or backpropagation, methods [1]. This gives derivatives of expectations of smooth observables, but path sensitivities can grow rapidly in unstable systems. Moreover, these observable-response formulas do not by themselves supply the parameter derivative of the marginal log-density used for KL training.

Divergence formulas differentiate the transfer of probability rather than the state path. Numerical transfer-operator methods approximate the evolving or invariant density directly [16], but representing densities becomes costly in high dimension. For SDEs, differentiating the Fokker-Planck equation gives density-response equations with divergence and second-order terms. The divergence part of the DK construction represents this density-level response through quantities sampled along trajectories [11].

Kernel differentiation keeps the realized state path fixed and differentiates its probability. This gives likelihood-ratio gradient estimators [2]. Such estimators can have large variance when the noise is small. In continuous time, the usual Girsanov change of measure handles drift perturbations with fixed diffusion, but does not generally give a finite path-likelihood ratio for a change in the diffusion coefficient [11].

Combined response formulas extend the range of dynamics and objectives that can be differentiated. The fast response formula combines path and divergence contributions for hyperbolic deterministic dynamics [12]. The path-kernel method allows responses to perturbations of the initial condition, drift, and diffusion [10], and its adjoint form computes parameter gradients of observable objectives [7]. The DK method represents the score along sample paths [8]; its extension in [11] gives the marginal-density response for state-dependent and parameter-dependent scalar diffusion.

1.3. Main results. Our contribution is a DK training scheme that jointly learns drift and diffusion fields under density-based terminal losses. We parameterize both fields with neural networks and train the same model using forward KL, backward KL, or their average. We also optimize the mean and shared standard deviation of the initial Gaussian. Local parameter derivatives accumulate in one forward pass without storing full trajectories.

The two- and eight-dimensional Gaussian-mixture experiments illustrate both the effect of the loss and the roles of the learned fields. The three KL objectives lead to different mode-probability and off-mode errors. The validation-selected models trained with averaged KL produce far fewer off-mode samples than score-based generators of similar parameter count. The drift points toward the modes, while the diffusion is larger in the gaps, where the initial Gaussian places substantial probability but the target density is low. Smaller diffusion near the modes limits stochastic spreading there.

This paper is organized as follows. We present the model and training method in sections 2 and 3, the numerical comparisons in section 4, and the discussion and conclusion in section 5.