Manuscript Offprint
arXiv:2610.41243Generative SDEs with Trainable Diffusion and Density-Based Losses
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.
2.1. Neural SDE model. Data preprocessing fixes the spatial scale before training. For training samples , , in the original units, set and
. The same fixed is used for validation and test samples and is independent of . All subsequent model formulas use normalized coordinates: denotes the normalized state, and denotes a normalized data point. Generated samples in the original units are .
The model starts from a Gaussian law and evolves to time . We use
(1)
Here is standard -dimensional Brownian motion, and contains all network weights and biases, the initial mean , and the shared initial standard deviation . The SDE uses the Itô convention. Its terminal density is . We consider time-independent and throughout this paper, although the theory, including the DK method, also permits time-dependent coefficients.
The initial mean and shared standard deviation can be trained together with the networks. We optimize directly under the constraint , where is a prescribed lower bound in normalized coordinates. The shared variance is , and we draw , where . This adds parameters and retains an isotropic initial covariance. The coordinate standard deviation in the original units is .
To localize the learned dynamics near the data, we parameterize the drift and diffusion as
(2)
The twice continuously differentiable radial cutoff is defined by
(4)
Here NN stands for “neural network”: has raw outputs, and has one raw output before the sigmoid transformation. The drift cap and diffusion bounds are prescribed in normalized units and held fixed during each gradient estimate. The convex combination in equation (2) gives , while equation (3) gives . Inside radius 1, both fields are determined by bounded transformations of the network outputs. Between radii 1 and 2, the cutoff smoothly blends these outputs with the prescribed tail fields. At radius 2 and beyond, the drift points inward with constant magnitude , and the diffusion equals its constant floor. At the origin, the tail term in equation (2) is defined to be zero by continuous extension.
The networks use smooth activations because the DK updates require second state derivatives. We use SiLU(a) = a/(1 + exp(-a)) in the hidden layers and take all state derivatives after forming equations (2) and (3), including derivatives of . We assume the smoothness, growth control, and integrability required by the DK formulas below.
2.2. Terminal losses. We fit the terminal distribution using forward KL, backward KL, or their average. Let denote the normalized target density. Forward KL emphasizes target regions that the model underrepresents (), whereas backward KL emphasizes regions where the model assigns excess probability (). We write for the selected terminal KL objective, excluding the weight regularization introduced in section 3.4.
Forward KL averages the log density ratio over the target distribution:
(5)
The training data give the empirical approximation
Backward KL instead averages over the generated distribution:
For independent generated endpoints , its empirical approximation is
The averaged KL loss combines these two objectives. For a fixed target density , with both divergences finite, define
(6)
This is one half of the Jeffreys divergence, which has also been used to train generative models [13]. We compare both individual objectives and their average in sections 4.2 and 4.3.
Throughout, denotes a parameter derivative at the current , while denotes a state derivative. A subscript identifies the parameter: and differentiate with respect to the indicated scalar parameter, and collects the mean-component derivatives into a column vector. In particular, and hold the state fixed. The log-density parameter derivatives below are also evaluated at fixed spatial arguments.
2.3. Score computed by the forward process. The DK formulas express density derivatives as conditional means of pathwise terms. We recall the formulas from [8, 11] for scalar diffusion. Numerical checks of the response formula for a one-dimensional multiplicative-noise SDE and a 40-dimensional Lorenz 96 observable are given in [11, Section 4]. The exact discrete score and response identities are given in [11, Section 3.2]. The continuous formulas below are the formal limits used to build the time-step scheme.
The covector carries the score information along each path. We use the general DK score formula of [11] with a scalar backward-adapted transfer rate , which may depend on the path from to . The stochastic expressions below are interpreted as limits of equations (11) and (13), with right-endpoint evaluation of and start-of-step evaluation of the other coefficients. The drift, diffusion, and their state derivatives without the superscript are evaluated at the current parameter and at . The covector starts at
It evolves by
(7)
Here is the state Jacobian, is the Hessian, and is the Laplacian. Throughout, denotes expectation over paths of the SDE under consideration or its time-discretized simulation. Target-data averages are written explicitly as integrals or empirical sums. The score identity is
Thus one covector, with entries, serves all parameter derivatives.
2.4. Response of the terminal density and loss. We first express the terminal-density response as a conditional expectation of a pathwise integral, then use this identity to derive the responses of the forward, backward, and averaged KL losses. For a parameter derivative, let be the following pathwise response:
(8)
Here, the initial-density term accounts for changes in the Gaussian mean and variance. Differentiating its log density at fixed gives
(9)
This term vanishes for derivatives with respect to the network parameters.
The DK identity recovers the terminal log-density derivative by conditioning the pathwise response on the endpoint.
(10)
Since the terminal density integrates to one, taking expectations in equation (10) gives
For forward KL in equation (5), the target density is fixed during differentiation. Using equation (10), we obtain
Here, multiplying and dividing by rewrites the target average in terms of generated samples. The final equality uses the law of total expectation. Using generated SDE paths, we approximate the forward-KL response by
where is the response accumulated along path . Here, the factor is the terminal coefficient for forward KL. At optimization update , we denote the estimated terminal coefficient for generated path by . Equation (15) specifies it for each KL objective.
Backward KL also differentiates the generated density that weights the integral:
Using equation (10) and , the constant term vanishes, giving
The third line again uses the law of total expectation. For the generated endpoints, the corresponding empirical approximation is
The averaged KL derivative is the average of the forward and backward derivatives, so
The coefficients in these response formulas are evaluated at the current parameters and held fixed when computing the local response. The discrete counterparts of equations (7), (8) and (10) are given in section 3 and provide the gradient used for training.
Subtracting a fixed baseline from the coefficient leaves the exact gradient unchanged because . At optimization update , let be a scalar determined before drawing the current paths. Then
We can take to be the mean of the coefficients from a previous update. This is a simple choice for reducing the variance of the estimator, although it does not generally minimize the variance. The detailed formula for is given in section 3.2.
3. TRAINING ALGORITHM
Training combines forward response accumulation with terminal weights estimated from samples. We keep the model parameters fixed throughout each gradient estimate. The state, covector, and response use the same Brownian increments.
3.1. State, covector, and response steps. The state follows the Euler scheme for equation (1). Set , , and . Then
The increments are independent over steps and paths. Write and ; their state derivatives are also evaluated at .
The covector step evaluates the transfer rate at the new state and all other coefficients at the start of the step. With discrete transfer weight , the small-step expansion of the score recursion in [11, Sections 3.2–3.3] is
(11)
The results of [11] allow to depend on . We compute before evaluating , so this choice still permits forward simulation.
We choose proportional to to balance covector damping against stochastic forcing in equation (11). If is too small, damping may be insufficient. If it is too large, the coefficient can amplify the noise and increase fluctuations in . Scaling with the local diffusion helps control this coefficient, while prescribing the mean of sets the overall damping strength. The ratio in the kernel-differentiation term is generally not constant, because is evaluated at while is evaluated at . For a prescribed mean-rate target , set
(12)
where is the mean endpoint diffusion over all paths and time steps in the previous update.
The target specifies the desired average of over all paths and time steps. This average remains close to the target when the current mean diffusion is close to . Individual values of still vary with the local diffusion and need not be close to . For the first update, is evaluated on an independent batch from the initial Gaussian. With fixed, depends only on the endpoint state and satisfies the backward-adapted requirement.
The response is accumulated at each time step using the covector at the start of the step. Starting from in equation (9), the time-step form of equation (8) is
(13)
All fields in this expression use . The response increment is accumulated before replacing by . Equations (11) and (13) are time-step approximations of the exact discrete DK identities in [11, Sections 3.2–3.4], obtained using the Itô quadratic-variation rule in the small-step limit. If is the density of the Euler terminal state, they give
Local automatic differentiation computes the response increments from a scalar function. For this calculation, , and all coefficients without the superscript are held fixed at their current values. Define
(14)
In the code, we first form in equation (14), then obtain the response increment by automatic differentiation.
3.2. Terminal weights and density estimates. Gaussian kernel density estimates (KDEs) supply the terminal KL coefficients from generated endpoints and the training data. For bandwidth , let . At a generated endpoint , the estimates are
Every other sample contributes its full kernel value, the query's own contribution has weight 1/2, and the denominator remains the full population size.
The same response accumulation supports all three KL objectives. At optimization update , the coefficient for path is
(15)
The endpoints, parameters, and density estimates are those of update .
The previous update's mean coefficient provides a baseline for the current gradient estimate. We subtract from in equation (16) to reduce the variance of the gradient estimator. We use
Fresh paths are drawn at each update, with frozen before drawing them. The same baseline is used for the drift, diffusion, and initial-law parameters; its new value is retained only after an accepted parameter update.
The DK gradient formula does not require the scalar KL loss value, but we compute its KDE estimate, denoted by , to monitor optimization and set the clipping budget in section 3.4. We estimate forward KL by averaging over data points and backward KL by averaging over generated endpoints; averaged KL is the mean of these two estimates. For forward and averaged KL, we also evaluate the densities at each data point , where the same half-weight rule applies to its own contribution to :
3.3. Gradient estimation in one forward pass. We estimate loss derivatives for both the neural networks and the initial Gaussian using the same terminal weights. For a parameter derivative of a network weight or bias, let be the accumulated response for path . At optimization update , using the coefficients and baseline from section 3.2, we get
(16)
This estimates the KL parameter derivative using the DK response and estimated density ratios; it need not equal the derivative of the scalar KDE estimate .
The initial Gaussian gives explicit gradients for its mean and standard deviation. The initial-law parameters are separate from the network weights, so their response is therefore given entirely by equation (9), with no further time accumulation. Using the coefficient for the selected KL objective from section 3.2, the initial-law gradients are
(17)
The parameter derivatives and are read from the and terms in equation (9), respectively. They have zero mean under the initial Gaussian, so the same baseline subtraction applies. In these derivatives, is held fixed once it was sampled as .
All parameter gradients are computed in one forward pass. At the initial sample, we store the derivatives of with respect to and . During simulation, we accumulate the network-parameter responses using equations (13) and (14), retaining only the current state, covector, and accumulated responses for each path. After all paths finish, we compute the terminal coefficients and obtain the network and initial-law gradients using equations (16) and (17), respectively.
The memory cost is independent of the number of time steps. The accumulated responses require entries, and full trajectories are not stored.
3.4. Parameter updates and constraints. The regularized training objective adds a weight penalty to the selected terminal KL. Let range over all weight matrices in the drift and diffusion networks, and let denote the Frobenius norm. The objective is
Biases and initial-law parameters are excluded from this penalty. We add its exact derivative to the KL derivative estimate in equations (16) and (17):
The optimizer forms a proposed increment from these regularized gradient estimates. At update , all derivatives are evaluated at , and denotes an increment of the full parameter vector, including and . For stochastic gradient descent with step size , its components are
The reported experiments use Adam to form this increment from the same regularized gradient estimates.
We enforce the lower bound on the proposed initial standard deviation before clipping. Both numerical examples use . Writing for the component of , we replace it with
Also note that the parameterizations in equations (2) and (3) enforce and . These field bounds require no additional projection of the network parameters.
We clip the proposed increments separately for the drift network, the diffusion network, and the initial Gaussian. Each network group contains its weights and biases, while the initial-Gaussian group contains the components of and the shared standard deviation . For a group with parameter indices , we limit the magnitude of its estimated first-order change in the unregularized KL loss to :
If this bound is exceeded, we multiply all increments in the group by the ratio of the allowed magnitude to the predicted magnitude. This common scaling factor lies in , so the previously enforced lower bound on is preserved.
After projection and clipping, we apply the resulting increment:
4. NUMERICAL STUDY
We study two- and eight-dimensional four-component Gaussian mixtures. In each dimension, we compare DK models trained with forward, backward, and averaged KL against an EDM baseline, using identical data sets. EDM is a score-based diffusion framework that achieved state-of-the-art image-generation results [4]. Both methods use plain multilayer perceptrons (MLPs), with a slightly larger parameter count for EDM. The DK models produce fewer samples outside the data neighborhoods, and these outside samples have smaller mean distances to the nearest reference points.
4.1. Evaluation protocol. In each experiment, all methods use identical training, validation, and test sets and the same evaluation protocol. We draw independent training, validation, and test sets containing 1,024, 1,024, and 10,000 points, respectively. For each experiment, we compute from the training set and use it to normalize the training, validation, and test sets, as in section 2.
KL evaluation uses Gaussian kernel density estimates computed from all reference data points and generated samples, as described in section 3.2. These estimates use half-weight self contributions and division by the total number of points in the corresponding set. Forward KL averages over reference points, and backward KL averages over generated points. We report both KLs and their average, called averaged KL. For validation and testing, we fix the Gaussian kernel bandwidth defined in section 3.2 at , independently of the training bandwidth.
Checkpoint selection uses validation averaged KL for every training objective. Every 50 updates, each method generates 1,024 samples and compares them with the shared validation set. We select the checkpoint with lowest validation averaged KL and evaluate it using 10,000 generated samples and the shared test set.
Sample neighborhoods measure how often generated points lie away from the observed distribution. Following the precision construction of [5], we center a closed ball at each point in the target test set, with radius equal to its distance to the third nearest other reference point. Precision is the fraction of generated samples in the union of these balls; the outside fraction is its complement. For the outside samples, we also report the mean and 95th percentile of the distance to the nearest reference point, measured in normalized coordinates. These distances are to the reference points, rather than to the boundaries of the balls. Neither the neighborhoods nor these distances require the analytic target density.
We also compare the probability in the four regions associated with the Gaussian components. We assign each generated sample and target test point to the nearest component mean, then compute the fraction of points in each region. We report the difference between the generated and target region probabilities. This diagnostic uses the known component means, whereas the neighborhood metrics use only samples.
We use two independent sample sets drawn directly from the target distribution as a common reference for DK and EDM. Each set contains 10,000 points, and we apply the same evaluation protocol. Since both sets follow the same target distribution, the population KL is zero; any nonzero estimated KL reflects finite-sample density-estimation error.
We measure training-run wall time and network-only forward time on NVIDIA L40S GPUs. Wall times include compilation, validation, testing, plotting, and checkpoint writing. Forward times are median PyTorch CUDA-graph measurements for batches of 1,024 float32 inputs, with the two DK MLPs evaluated on concurrent CUDA streams; compilation, host transfers, and operations outside the MLPs are excluded.
4.2. Two-dimensional experiments. The target has four components with different probabilities, widths, and orientations. In the original data units, its density is
where is the density of . The component weights and means are
The covariance matrices are
where and are the standard deviations along the principal axes, and
is the planar rotation matrix.
We rescale the data by the training-derived radius specified in section 4.1. Conditional on this fixed , the normalized target density is , with component means and covariances . Training and the density-based evaluation metrics use only samples, rather than the analytic mixture density.
DK jointly trains two networks for the time-independent drift and diffusion, together with the initial Gaussian law, for a total of 1,740 parameters. The drift network has three hidden layers of width 24 and two outputs, and the diffusion network has two hidden layers of width 18 and one output. Both use SiLU activations and take only the normalized location as input. We initialize the hidden layers sequentially using the normalized training data. For each layer, we rescale its random weight matrix so that the preactivation has root-mean-square value one across the training points and hidden units, then apply SiLU to produce the next layer's inputs. Hidden biases are zero, and the final layers have small random weights and zero biases. The initial mean and standard deviation are initialized at and . Each update simulates paths to with , or 500 time steps. The fields use equations (2) and (3) with drift cap 4 and diffusion bounds 0.1 and 2.
The training density bandwidth decreases linearly from 0.3 at update 1 to 0.03 at update 4,000, then remains fixed through update 5,000. The drift and diffusion bounds remain fixed throughout training. The transfer rate follows equation (12) with .
The three DK runs differ in their terminal objective: forward, backward, or averaged KL. They use the coefficients in equation (15) with the previous-update mean subtracted and the update rules in section 3.4. All four runs, including EDM, use Adam with learning rate , batch size 1,024, and 5,000 updates, with training seed 0.
The EDM baseline uses a noise-dependent plain MLP with 1,827 trainable parameters, slightly more than the two DK networks combined. It concatenates the preconditioned location and 16 fixed sine and cosine noise features, followed by three SiLU hidden layers of width 25 and a linear two-component output. The MLP has no internal residual connections or layer normalization; the outer EDM preconditioning is retained. Hidden and final-layer weights use Glorot initialization, with final-layer weights additionally scaled by ; all biases are zero.
EDM training follows the preconditioned denoising objective of [4]. We apply a fixed rescaling fitted on the training data so that the root-mean-square coordinate standard deviation is 0.5, and undo this rescaling before evaluation and plotting. Training noise levels are lognormally distributed with log-mean -1.2 and log-standard deviation 1.2 in these internal coordinates. Generation uses the exponential moving average of the weights with decay 0.99 and 128 deterministic Heun steps, with noise levels decreasing from 80 to 0.002 using the EDM schedule exponent 7. The final step is Euler to zero noise, giving 255 network evaluations per generated sample. The EDM gradient norm is not clipped.
The EDM baseline retains its preconditioning, exponential moving average of the weights, and second-order Heun sampler, and uses slightly more trainable parameters. DK uses two smaller networks for the drift and diffusion, whose evaluations could be performed in parallel.
In the two-dimensional experiment, DK produces fewer off-mode samples than EDM, and the remaining off-mode samples lie closer to the reference data on average (table 1). Figure 1 makes the stronger concentration of DK samples near the modes visible. Among the DK objectives, backward-KL training gives the smallest mean outside distance, while averaged-KL training gives the lowest mode-probability error. All three DK models have lower validation and test averaged
TABLE 1. Two-dimensional validation and test results for checkpoints selected by minimum validation averaged KL during 5,000 training updates. Validation uses 1,024 generated and 1,024 reference samples; test metrics use 10,000 of each. KL uses all-point Gaussian estimates with bandwidth 0.03 and half-weight self contributions. Outside-sample distances are in normalized coordinates.
| Metric | DK training objective | EDM | ||
|---|---|---|---|---|
| Averaged KL | Forward KL | Backward KL | ||
| Selected update | 4700 | 4900 | 4500 | 4950 |
| Parameter count | 1740 | 1740 | 1740 | 1827 |
| Validation averaged KL | 0.103 | 0.0892 | 0.0948 | 0.180 |
| Test averaged KL | 0.0690 | 0.0882 | 0.0804 | 0.118 |
| Test forward KL | 0.0360 | 0.0358 | 0.0506 | 0.0475 |
| Test backward KL | 0.102 | 0.141 | 0.110 | 0.189 |
| Precision | 98.2% | 96.9% | 98.1% | 96.3% |
| Outside fraction | 1.80% | 3.06% | 1.92% | 3.69% |
| Mean outside distance | 0.0209 | 0.0459 | 0.0124 | 0.0545 |
| Outside distance: 95th percentile | 0.0802 | 0.198 | 0.0490 | 0.197 |
| Mode-probability error | 0.0552 | 0.0620 | 0.0742 | 0.0742 |


FIGURE 1. Two-dimensional test samples from the minimum-validation-KL checkpoints: averaged-KL DK at update 4,700 (left) and plain-MLP EDM at update 4,950 (right). Each panel shows all 10,000 generated samples in blue and the same 10,000 independent reference samples in orange, using normalized coordinates, identical axis limits, and equal aspect ratios.


FIGURE 2. Learned two-dimensional fields from the averaged-KL DK checkpoint selected at update 4,700. Left: the drift , with arrows anchored on a uniform grid. Right: filled contours of the scalar diffusion . Both panels use the same normalized coordinates and show the 1,024 training points in orange.
KL than EDM, despite DK's less extensively engineered and tuned implementation and smaller parameter count. Averaged-KL training gives the lowest test averaged KL.
As a common reference for DK and EDM, we compare two independent sample sets drawn directly from the target distribution. This gives estimated averaged KL 0.00415 and precision 98.4%. The averaged-KL DK model nearly matches this reference in precision.
The learned drift and diffusion play complementary roles. Figure 2 shows the drift pointing toward the modes, qualitatively resembling a score field. The diffusion is largest in the central region, where the initial Gaussian places substantial probability but the target density is low, and is close to its floor elsewhere. This pattern can help disperse probability from the central gap while limiting stochastic spreading. This suggests combining score-based generation with DK refinement.
The 5,000-update averaged-KL DK and EDM runs take 924 and 159 seconds, respectively. Their median network-only forward times are both 27.9 microseconds per batch.
4.3. Eight-dimensional experiments. We first generate an eight-dimensional Gaussian-mixture vector in the original data units, using the same component weights as the two-dimensional target. Within component , the first two coordinates have mean and covariance . We add six jointly Gaussian coordinates , with zero mean and covariance
Within each component, these six coordinates are independent of the first two, so
That is, each added coordinate has variance , while correlations among the added coordinates decrease with their index separation.
After generating U, we apply a fixed orthogonal rotation to obtain the target data:
TABLE 2. Eight-dimensional validation and test results for checkpoints selected by minimum validation averaged KL during 5,000 training updates. Validation uses 1,024 generated and 1,024 reference samples; test metrics use 10,000 of each. KL uses all-point Gaussian estimates with bandwidth 0.03 and half-weight self contributions. Outside-sample distances are in normalized coordinates.
| Metric | DK training objective | EDM | ||
|---|---|---|---|---|
| Averaged KL | Forward KL | Backward KL | ||
| Selected update | 3800 | 3850 | 3800 | 4750 |
| Parameter count | 2148 | 2148 | 2148 | 2270 |
| Validation averaged KL | 4.86 | 5.22 | 4.79 | 5.50 |
| Test averaged KL | 2.75 | 2.90 | 2.58 | 2.46 |
| Test forward KL | 3.32 | 3.43 | 3.19 | 2.27 |
| Test backward KL | 2.17 | 2.36 | 1.96 | 2.65 |
| Precision | 96.9% | 94.4% | 97.6% | 86.0% |
| Outside fraction | 3.13% | 5.60% | 2.36% | 14.0% |
| Mean outside distance | 0.0985 | 0.117 | 0.0892 | 0.125 |
| Outside distance: 95th percentile | 0.174 | 0.251 | 0.117 | 0.217 |
| Mode-probability error | 0.128 | 0.155 | 0.105 | 0.0564 |

FIGURE 3. Eight-dimensional test samples from the checkpoints selected by minimum validation averaged KL: averaged-KL DK at update 3,800 (left) and plain-MLP EDM at update 4,750 (right). Each panel shows all 10,000 generated samples in blue and the same 10,000 reference samples in orange. For visual comparison with the two-dimensional example, we apply to both normalized sample sets and display the coordinates and .


FIGURE 4. Learned eight-dimensional fields at the averaged-KL DK checkpoint selected by minimum validation averaged KL, update 3,800. Both panels use the normalized coordinates and , obtained by reversing the fixed rotation with , as in figure 3. The fields are evaluated on the slice . Left: the first two components of . Right: filled contours of the scalar diffusion. The arrow scale matches figure 2. The axes match figure 3, and orange dots show all 1,024 training samples projected onto the displayed coordinate plane.
We construct once by QR factorization of a standard Gaussian matrix with seed 1729, and use it for every sample. We then normalize the rotated data as in section 4.1, giving .
The eight-dimensional experiments use the training settings in section 4.2 and the evaluation protocol in section 4.1. The DK drift and diffusion networks retain three hidden layers of width 24 and two hidden layers of width 18, respectively, with eight drift outputs and one scalar diffusion output. We also train and , initialized at 0 and , respectively, for a total of 2,148 DK parameters. The EDM baseline uses the two-dimensional EDM training and sampling recipe, with three hidden layers of width 26, eight outputs, and 2,270 trainable parameters.
In the eight-dimensional experiment, DK produces far fewer off-mode samples and smaller mean outside distances than EDM (table 2 and figure 3). All three DK models have lower validation averaged KL and test backward KL than EDM. On the test set, EDM has lower forward and averaged KL and better matches the mode probabilities. These complementary strengths suggest using a score-based generator to capture the modes and their probabilities, followed by DK refinement to reduce off-mode samples.
The eight-dimensional diffusion field is stronger in the gap between the modes and remains close to its lower bound near their centers (figure 4). This field is shown at the minimum-validation-KL checkpoint (figure 5).
As a common reference for DK and EDM, we compare two independent sample sets drawn directly from the target distribution. This gives estimated averaged KL 2.09 and precision 90.1%. The DK models exceed this reference in precision, while their estimated averaged KL remains above the reference KL.
The 5,000-update averaged-KL DK and EDM runs take and 167 seconds, respectively. Their median network-only forward times are 31.2 and 28.8 microseconds per batch, respectively.
A more efficient parallel implementation could make DK's two smaller networks faster to evaluate than EDM's single larger network.

FIGURE 5. Validation averaged-KL histories for the eight-dimensional runs, using the same 1,024 reference points, 1,024 generated samples per evaluation, and fixed density bandwidth 0.03. The plot shows all 5,000 updates on a logarithmic vertical axis, and markers identify the minimum-validation-KL checkpoints.
5. CONCLUSION AND FUTURE WORK
The mixture experiments demonstrate joint optimization of the drift, diffusion, and initial Gaussian parameters using losses that depend directly on the terminal density. The choice of KL objective changes the fit within the same model, with backward KL giving the smallest mean outside distance in both dimensions. The learned fields play complementary roles: the drift attracts samples toward the modes, while stronger diffusion helps disperse excess probability from the gaps between them. Smaller diffusion near the modes limits stochastic spreading. In each experiment, all three DK models produce fewer off-mode samples and have lower validation averaged KL than the score-based generator.
The density-response formulation supports broader choices of SDE dynamics. Our experiments use time-independent neural fields for a vector-valued drift and a state-dependent scalar diffusion coefficient; the same response construction also supports time-dependent neural fields. In either case, the fields can incorporate compatible physical structure or prescribed tail behavior, such as linear attraction. Extending our generative model to use a general diffusion matrix is another direction for future work.
The DK score formula can also supply training targets for score-based models with more general noising dynamics. By the DK score identity, the simulated covector is a stochastic target for the marginal score, satisfying . With the noising dynamics fixed, a score network with parameters can be trained by
This generalizes the analytic conditional-score target construction used in standard denoising score matching [14] by computing targets along the noising paths.
Combining score-based training with DK optimization is a promising direction for future work. A pretrained score-based generator could initialize the drift, followed by DK optimization of the diffusion and, if needed, refinement of the drift under a selected density-based terminal loss.
FUNDING
This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
AI ASSISTANCE DECLARATION
The author developed the methodological framework and training algorithms, wrote the core DK implementation, and designed the numerical study. ChatGPT/Codex assisted with code revisions, supporting scripts, testing, and manuscript preparation under the author's direction. The author assumes responsibility for all content.
DATA AVAILABILITY STATEMENT
The code for generating the synthetic data and running the numerical experiments is publicly available at https://github.com/niangxiu/DKgen.
REFERENCES
[1] G. L. Eyink, T. W. N. Haine, and D. J. Lea. Ruelle's linear response formula, ensemble adjoint schemes and Lévy flights. Nonlinearity, 17(5):1867–1889, 9 2004. [2] Peter W. Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM, 33(10):75–84, 10 1990. [3] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, volume 33, pages 6840–6851, 2020. [4] Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems, volume 35, 2022. [5] Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved precision and recall metric for assessing generative models. In Advances in Neural Information Processing Systems, volume 32, 2019. [6] Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. In International Conference on Learning Representations, 2023. [7] Angxiu Ni. Adjoint path-kernel method for backpropagation and data assimilation in unstable diffusions. arXiv:2507.21497, 7 2025. [8] Angxiu Ni. Divergence-kernel method for scores of random systems. arXiv:2507.04035, 7 2025. [9] Angxiu Ni. Ergodic and foliated kernel-differentiation method for linear responses of random systems. Journal of Nonlinear Science, 35(5):90, 10 2025. [10] Angxiu Ni. Path-kernel method for differentiating unstable diffusions. arXiv:2503.00718, 3 2025. [11] Angxiu Ni. Divergence-kernel method for linear responses of densities and generative models. Physica D: Nonlinear Phenomena, 496:135327, 11 2026. [12] Angxiu Ni. Fast differentiation of hyperbolic chaos. Archive for Rational Mechanics and Analysis, 250(1):6, 2 2026. [13] Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-GAN: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, volume 29, 2016. [14] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. [15] Pascal Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011. [16] Caroline Wormell. Spectral Galerkin methods for transfer operators in uniformly expanding dynamics. Numerische Mathematik, 142(2):421–463, 2019.