Manuscript Offprint
arXiv:2610.23204Non-Parametric Optimization for Scalable Learning in Stochastic Decision Problems
Abstract
Stochastic optimization (SO) plays a central role in decision-making under uncertainty. Among SO problems, time-varying stochastic optimization (TV-SO) is particularly important due to its applications in adaptive control and machine learning. Non-parametric approaches have been proposed for time-varying deterministic optimization; however, they have not been developed for their stochastic counterparts. This work addresses that gap by developing a stochastic variational framework based on Malliavin calculus. This framework yields non-parametric optimality conditions for SO problems with stochastic decisions and supports the design of a scalable deep-learning algorithm that is insensitive to the parameterization dimension. This algorithm, called the Stochastic Path Follower (SPF), is applied to two important problems under distribution drift, namely least-squares recovery and logistic regression. Experimental results show that the proposed approach outperforms state-of-the-art learning-based and gradient-based methods in both performance and scalability.
1. Introduction
Stochastic optimization (SO) studies decision-making under uncertainty and has wide applications, for instance, in mathematical finance (Strini, 2019; Buehler et al., 2019), control theory (Jin et al., 2022), machine learning (Bottou et al., 2018; Sun et al., 2020; Levine et al., 2020). There has been extensive research on finding the optimal solution of such problems when the decision variable is deterministic (Duchi, 2016; Cao et al., 2021; Cutler et al., 2021). Recent advances have also addressed SO problems with stochastic decisions through neural network (NN) parameterizations (Tzen & Raginsky, 2019; Li et al., 2020; Oh et al., 2019; Kidger et al., 2021). However, optimality conditions for SO problems with stochastic decisions would benefit greatly from being insensitive to the parameterization dimension, thereby improving scalability.
This work addresses this gap by developing non-parametric necessary conditions for optimally solving SO problems with stochastic decisions. The resulting non-parametric methodology leads to an algorithm that is independent of the parameterization dimension and is therefore both efficient and scalable. In particular, we focus on time-varying stochastic optimization (TV-SO), a class of SO problems in which the expected objective and/or constraints vary over time. TV-SO has applications in important fields including adaptive control (Fazlyab et al., 2018; Simonetto et al., 2020; Simonetto & Massioni, 2024) and machine learning (Cutler et al., 2023; Maity et al., 2023), especially in settings where the data distribution changes over time (distribution drift) and the underlying environment is non-stationary. Our approach is complementary to the dynamic-programming principle commonly used for sequential decision-making problems modeled by stochastic differential equations (SDEs) or formulated as Markov decision processes (MDPs) (Fleming & Soner, 2006; Bouchard & Touzi, 2011; Puterman, 2014; Amidzadeh & Di Francesco, 2025). From a different analytical angle, the proposed Malliavin-based framework studies time-varying stochastic objectives through non-parametric optimality conditions.
There is a rich theory for analyzing optimality conditions in time-varying deterministic problems (Simonetto et al., 2020; Komzsik, 2019); however, their stochastic counterparts have received much less attention in the literature. Hence, we leverage Malliavin calculus to develop a stochastic variational framework for deriving optimality conditions in SO problems. Malliavin calculus is essential in this context, as it enables the formulation of non-parametric optimality conditions. The resulting theory connects deterministic and stochastic optimization by generalizing classical optimality conditions to the stochastic setting. Since these conditions do not yield a closed-form expression for the optimal
Department of Computer Science, Aalto University, Finland Department of Information and Service Management, Aalto University, Finland. Correspondence to: Mohsen Amidzadeh mohsen.amidzade@aalto.fi, Lauri Viitasaari lauri.viitasaari@aalto.fi.
Proceedings of the International Conference on Machine Learning, Seoul, South Korea. PMLR 306, 2026. Copyright 2026 by the author(s).
Table 1. Comparison of the SPF and PDM algorithms, where denotes the dimension of the decision variable and is the parameterization dimension. For SPF, both the required SDEs and the learning loss do not depend on , while they do for PDM.
| Algorithm | Dimension of required SDEs | SDEs and learning loss explicitly depend on |
|---|---|---|
| SPF (ours) | No | |
| PDM | Yes |
stochastic solution, we design a deep-learning algorithm, called the Stochastic Path Follower (SPF), to approximate it. This algorithm is built on a non-parametric framework that makes the learning procedure largely insensitive to the parameterization dimension, thereby providing a scalable and low-complexity approach. Pathwise differentiation methods (PDMs), which estimate gradients of SDE-driven systems (Tzen & Raginsky, 2019; Liu et al., 2019), can also be used to solve the SO problems of interest through a parameterized NN. However, their learning mechanism strongly depends on the parameterization dimension; thus, it does not scale to large models. Tab. 1 compares our proposed SPF against PDM.
In summary, we establish the following contributions.
-
We study time-varying stochastic optimization (TV-SO). We then develop a non-parametric variational framework based on Malliavin calculus to derive optimality conditions for TV-SO problems.
-
We accordingly develop an efficient NN algorithm to solve TV-SO. This algorithm computes an optimal solution in a manner that is largely insensitive to the parameterization dimension and is therefore both scalable and efficient.
-
We compare our proposed solutions with state-of-the-art (SOTA) algorithms through experiments on two important use cases: least-squares recovery and logistic regression. The experimental results show that our algorithm outperforms SOTA methods in terms of both performance and computational complexity.
In contrast, this paper considers time-varying stochastic optimization with stochastic decisions as a novel research setting and develops optimality conditions that characterize the evolution of optimal stochastic paths over time. We employ a diffusion process to solve these optimality conditions, which leads to a stochastic path-differential equation. In this sense, the resulting optimality conditions constitute a stochastic generalization of those for time-varying optimization problems.
Our work is also related to the gradient-based algorithm developed in (Cutler et al., 2023), termed proximal stochastic gradient (PSG). PSG addresses convex optimization problems under distribution drift and tracks the optimal solution using a stochastic algorithm with iterate averaging. In contrast, we directly target the optimality conditions and derive a structured search direction based on the proposed stochastic variational framework.
Neural Stochastic Differential Equations. Recent works estimate gradients of SDE-driven functions using NN parameterization with backpropagation or adjoint methods (Li et al., 2020; Kidger et al., 2021). However, they do not address the joint optimization of a sequence of objectives over an entire time horizon, and they inherently adopt parametric methodologies: they optimize a finite set of network weights rather than the stochastic decision itself. In contrast, our framework performs joint optimization of SO problems over the whole horizon using a non-parametric and scalable methodology, without being restricted to a specific parameterization.
3. Background
This section provides the background needed on time-varying optimization and key results from Malliavin calculus.
3.1. Time-Varying Optimization
Consider the following time-varying optimization (TV-O) problem:
where is given, is a twice-differentiable time-varying function, and the goal is to track the sequence of solutions over time. Since the problem must be optimized jointly for all , the
Appendix F also addresses functional stochastic optimization as a different class of SO problems.
Note that minimizing the aggregated objective , does not, in general, yield the desired solution, since the minimizer of may change sign at different time instances.
optimality condition must hold for every . This leads to the following ordinary differential equation (ODE):
A path-following method then tracks the solution of TV-O by solving this ODE over (Kungurtsev & Jäschke, 2017; Amidzadeh, 2023), using an ODE solver such as Euler's method. Thus, the optimal solution necessarily satisfies the following energy-functional loss:
3.2. Malliavin Calculus
Malliavin calculus provides analytical tools to study the sensitivity of stochastic processes with respect to variations of a Wiener process . Consider a Wiener-driven process with a deterministic function ; its Malliavin derivative with respect to , denoted by , is defined as for all . The chain rule also holds for this derivative, implying that for a Wiener-driven process and a smooth functional in the domain of the Malliavin derivative, . Accordingly, we define the process , where is Malliavin-differentiable, square-integrable, and adapted to the filtration generated by . Its Malliavin derivative with respect to is then given by . Throughout the rest of the paper, we consider processes with the same square-integrability and Malliavin-differentiability properties.
Integration by Parts. The integration-by-parts formula in Malliavin calculus (Alòs & García Lorite, 2021; Nualart & Nualart, 2018) plays a central role in this work. It states that for any Malliavin-differentiable functional and any adapted, square-integrable process , the following expression holds:
Malliavin Derivative of SDEs. We now consider the -dimensional SDE:
where and are measurable functions with bounded partial derivatives. Under these conditions, the Malliavin derivative of with respect to is given by (Nualart & Nualart, 2018):
for , where (respectively, ) denotes the Jacobian matrix of the vector function (respectively, ) with respect to .
In addition to Eq. (5), we can express the Malliavin derivative of in terms of the stochastic flow . To this end, define the Malliavin matrix . Then we have (Nualart & Nualart, 2018):
where is the -to- stochastic flow, with the flow matrix and its inverse satisfying the following variational SDEs:
(7)
4. Time-Varying Stochastic Optimization
Throughout, we consider a filtered probability space , where is the sample space, is a -algebra of events on , and is a probability measure. On this space, we consider a -dimensional Wiener process with diffusion matrix . The filtration is taken to be the natural filtration of , namely , which encodes all the information up to time .
We next focus on time-varying stochastic optimization (TV-SO); Appendix F studies another class, namely functional stochastic optimization. In TV-SO, the decision variable is a Wiener function and the objective is a Wiener functional. We therefore need stochastic variational tools based on Malliavin calculus to analyze the optimality conditions of such problems. This, in turn, enables us to characterize the optimal decision by perturbing the solution along Wiener-driven paths.
Specifically, we consider a time-varying stochastic optimization (TV-SO) problem of the form
(8) where the optimization is carried out jointly for every . Note that minimizing the aggregated objective does not, in general, yield the desired solution, since the minimizer of may change sign at different time instances.
We now make the following assumptions:
Assumption I: is a known Malliavin-differentiable process, adapted to the filtration of under the law .
Assumption II: is square-integrable and twice continuously differentiable with respect to and , and represents a time-varying performance measure.
Assumption III: In contrast to SO problems with a deterministic decision, the decision here is assumed to be a Malliavin-differentiable process under law .
Note that, for optimization purposes, should be induced by the same Wiener process from which is derived. Consequently, is viewed as a Wiener-driven function. Moreover, Malliavin-differentiable functions form a broad class of processes (including deterministic ones) and do not impose restrictive assumptions on Wiener processes in practice.
Illustrative Example. As an illustrative example, consider the SO problem . If is constrained to be deterministic, the optimal solution is with objective value . Allowing to take the linear form yields the optimal solution with objective value , which is smaller than in the deterministic case. This example also shows that the condition cannot uniquely determine the optimal solution, since it admits infinitely many solutions for a constant .
As the law of is induced by the Wiener process , the objective of TV-SO can be reformulated as the following (Riemann) integral:
Note that should be viewed as a Wiener function rather than a simple variable, and the objective as a Wiener func-
Table 2. Comparison of optimality conditions of TV-O (1) and TV-SO (8) problems.
| Problem | Condition |
|---|---|
| TV-O | |
| TV-SO |
tional. Hence, the expression in Eq. (9) does not explicitly depend on , so cannot be used to obtain the optimal solution. In addition, as the illustrative example above shows, does not necessarily lead to an optimum. This calls for stochastic variational analysis to characterize the optimality conditions. Moreover, we aim to extend the solution mechanism of the TV-O problem in §3.1 to its stochastic counterpart in Eq. (8). Accordingly, we develop a stochastic perturbation framework based on Malliavin calculus, which provides non-parametric optimality conditions for optimizing TV-SO at a given .
The following theorem provides the necessary optimality conditions for TV-SO (8).
Theorem 4.1 (Necessary optimality conditions). Consider problem TV-SO under Assumptions I–III, with and being -adapted, Malliavin-differentiable, and square-integrable processes. Then TV-SO is optimized at a given instant if the following necessary conditions hold:
(10)
for , , where (respectively, ) is the Malliavin derivative of (respectively, ) with respect to (the -th component of ).
Proof. See Appendix B.

Remark 4.2. Note that Eq. (10) introduces an additional condition required to ensure the optimality of the stochastic paths generated by . This Malliavin-based term can also be written as
which is the direct stochastic analogue of the deterministic stationarity condition from Eq. (2), with the time derivative replaced by the Malliavin derivative. This analogy can also be seen by moving from Eq. (2) to Eq. (10) via and (see Tab. 2).
As in Problem TV-O, we aim to optimize TV-SO jointly for every . This leads to a sequence of optimization problems over the entire horizon and requires the optimality conditions in Eq. (10) to hold for all . Accordingly, the stochastic trajectories should satisfy Eq. (10) at each time , which yields a framework of stochastic path following as the stochastic counterpart of the path-following method described in §3.1.
Remark 4.3. A decision process can be jointly optimized in TV-SO for every by enforcing the following energy-functional criterion:
\displaystyle+\sum_{i=1}^{d}\int_{0}^{t}\left\|\mathbb{E}\big\{\nabla_{\mathbf{x}}^{2}f(\mathbf{x}_{t},\boldsymbol{\xi}_{t},t)\,D_{s}^{i}\mathbf{x}_{t}+\nabla_{\mathbf{x}}\boldsymbol{\xi}f(\mathbf{x}_{t},\boldsymbol{\xi}_{t},t)\,D_{s}^{i}\boldsymbol{\xi}_{t}\big\}\right\|^{2}_{ds}\right)dtNotice that this criterion is the stochastic counterpart of the deterministic case in Eq. (3).
5. Diffusion Process as a Candidate Decision
Recall from Eq. (2) that the solution of a time-varying optimization problem can be obtained via an ODE. Accordingly, we consider an SDE to solve Problem TV-SO in Eq. (8). For this purpose, we introduce the following diffusion process based on Eq. (4):
with given . We impose standard bounded-derivative conditions on and to guarantee the existence of a unique solution to the process (Li et al., 2020). Hence, finding the probability law in Problem TV-SO [i.e., Eq. (8)] is equivalent to finding a diffusion process with optimal drift and diffusion functions . Moreover, the Malliavin derivatives satisfy the variational SDE in Eq. (5). Therefore, evaluating the optimality conditions in Eq. (11) depends mainly on the Malliavin derivative of the chosen diffusion process, which motivates us to develop a method for computing .
5.1. Computation of Malliavin Derivatives
We next explain how to compute . For this purpose, we use the following proposition.
Proposition 5.1. Consider the Malliavin derivative in Eq. (5) for the SDE in Eq. (12). Then
where -to- stochastic flow represents a linear SDE, adapted to the filtration , given by
with initial condition .
Algorithm 1: Computation of the Malliavin derivative via the Euler–Maruyama scheme
Data: Forward trajectory , time-step . // Initialize via terminal condition: // Solve the SDE in Eq. (14): for to with step Compute Update // Recover Malliavin derivatives: for return
Proof. See Appendix C.
Combined with an SDE simulator, Proposition 5.1 enables the recursive computation of the Malliavin derivative . Starting from , we can increment to evaluate the right-hand side of Eq. (14) for . In particular, we can use the Euler–Maruyama scheme, which has a convergence rate of (Kloeden & Platen, 1992), to simulate and for given . Alg. 1 provides the corresponding pseudo-code based on the Euler–Maruyama scheme.
6. The Stochastic Path Follower Algorithm
This section presents an adaptable deep-learning algorithm for TV-SO problems based on the variational framework of Theorem 4.1. As the algorithm follows stochastic optimal paths for TV-SO, we refer to it as the Stochastic Path Follower (SPF). To this end, we design diffusion processes that minimize the criterion in Eq. (11). Although the framework developed in §4 is independent of any specific parameterization technique, we adopt NN parameterization due to its demonstrated effectiveness in learning SDEs (Kidger et al., 2021; Li et al., 2020). Specifically, we consider -parametric NNs for the drift and diffusion functions in Eq. (12). In detail, we set
with given , where and are two -parametric NNs, and is the corresponding parameter set. We then apply the SPF algorithm to solve TV-SO problems.
SPF consists of the following three main phases.
Forward pass. Simulate the SDE in Eq. (15) to obtain
Algorithm 2: Stochastic Path Follower (SPF)
Goal: Solving stochastic optimization problem TV-SO . Input: Neural drift and diffusion functions initial process number of sample paths , number of episodes . Output: Diffusion process with optimal solution of TV-SO. for to // Simulate the neural SDE to obtain sample paths: ; // Compute Malliavin derivative by simulating the SDE of the s-to-t stochastic flow ; // Evaluate the energy-functional loss ; // Update parameters of neural SDE: ;
the stochastic paths of . In addition, compute the Malliavin derivatives using Proposition 5.1.
Loss evaluation. Compute the expected loss associated with Problems TV-SO, as given in Eq. (11).
Parameter update. Update the parameters of the drift and diffusion functions using an Adam-type optimizer.
Pseudocode for the SPF algorithm is provided in Alg. 2, and to guarantee the convergence of the SPF algorithm, we rely on the results in (Chen et al., 2022). In particular, we follow Algorithm 2 and the setup of Theorem 17 in that work. Moreover, to achieve an -stationary point, we choose the batch size as , where denotes the NN parameterization dimension (see §7 for the specific values used in our experiments).
7. Performance Evaluation
This section evaluates the proposed stochastic variational framework through illustrative experiments and selected applications, namely least-squares recovery and logistic regression. The source code of our solution is available at https://github.com/amidimohsen/StochasticPathFollower.
We now introduce several algorithms from the literature as state-of-the-art (SOTA) baselines for comparison. As a learning-based approach, we adopt the pathwise differentiation method (PDM) (Tzen & Raginsky, 2019; Liu et al., 2019). PDM can be used for joint optimization over the entire time horizon (i.e., optimization for every ), in contrast to adjoint sensitivity approaches (Li et al., 2020). It yields parametric optimality conditions based on a pre-
Table 3. Average runtime per update step (in seconds).
| Problem | SPF (ours) | PDM |
|---|---|---|
| Scalar TV-SO (Exp1) | ||
| Constrained TV-SO (Exp2) |
scribed diffusion process (see Appendix D for more details).
In addition, we consider the proximal stochastic gradient (PSG) method from (Cutler et al., 2023) as a gradient-based baseline. This algorithm addresses convex optimization problems under distribution drift and is a stochastic gradient descent method. PSG tracks the optimal decision process using a stochastic algorithm based on iterate averaging.
7.1. Benchmark: Stochastic Extrapolation
Here, we consider a few simple yet representative problems to benchmark the SPF algorithm against PDM (note that PDM is a baseline approach for optimizing SDE-driven functions and can also be applied to time-varying optimization over an entire time horizon). Specifically, we aim to find optimal stochastic trajectories that optimize expected time-varying objectives. As a practical methodology, we extrapolate known optimal solutions of these objectives at time into the unknown paths at using the optimality condition in Theorem 4.1. We therefore consider objectives of the form , where is the decision process, is the Wiener process, and is a time-varying function. Moreover, we assume that the solution is known at . The goal is then to extrapolate this solution from to any by following the stochastic paths that optimize the objective of interest. In what follows, we first revisit the illustrative example presented in §4, and then evaluate a constrained TV-SO problem (see Appendix E for details of the experimental settings).
Scalar TV-SO (Exp1). Consider the following problem:
for every . The objective at becomes , since , which matches the illustrative example in §4. For , the optimal solution is . We then extrapolate this deterministic optimal solution at into a stochastic path for using the stochastic path-following method implemented by SPF. To this end, we consider a diffusion process initialized at . For comparison, we also apply the parametric PDM algorithm.
Fig. 1a reports the learned optimal values at obtained by the SPF and PDM algorithms. The importance of the proposed framework has been established theoretically in §4. Here, we further assess it through an ablation study of SPF. Specifically, Fig. 1a (curve with legend Ablation).

(b)
(c)
(d)
Figure 1. (a) Learning performance and ablation results for problem Exp1 at for the SPF and PDM methods; the ablation curves are obtained by omitting the Malliavin-based term in Eq. (11). (b) Optimal values for each in problems Exp1 and Exp2. Non-degenerate optimal stochastic trajectories obtained by SPF in problem Exp2 for all for (c) and (d) .
tion) shows the learning performance when the Malliavin-based term in the optimality criterion in Eq. (11), namely , is omitted. In this case, the optimal solution cannot be recovered. Fig. 1b (curves with legend Exp1) shows the resulting optimal values for all . SPF not only performs competitively with PDM, but is also computationally more efficient than the conventional PDM approach, as indicated by the average runtime per update step reported in Tab. 3.
Constrained TV-SO (Exp2). We now consider:
optimized , where , is a vector Wiener process, , and \mathbf{g}(\mathbf{w}_t, t) = [g_0(w_t^1, t), g_0(w_t^1^2, t), g_0(w_t^2, t), g_0(w_t^2^2, t)]^\top with .
The problem has optimal solution at . The goal is to determine the optimal paths for using SPF. We therefore employ a vector SDE initialized at and then apply Alg. 2.
Fig. 1b (the curves with legend Exp2) shows the obtained optimal values for all . The SPF solution is consistent with that of PDM, but it exhibits significantly lower computational complexity (see Tab. 3). Figs. 1c and 1d illustrate the optimal trajectories of the resulting diffusion process optimized by SPF for , demonstrating that SPF maintains rich and non-degenerate dynamical behavior.
7.2. Least-Squares Recovery
Here, we consider a least-squares recovery problem used in (Cutler et al., 2023; Maity et al., 2023). This problem aims to recover the variable , which follows a non-stationary distribution, from the observed parameter through the following optimization problem:
where , is the stochastic process to be determined, with a fixed measurement matrix, and the covariance matrix. The hidden parameter follows an Ornstein–Uhlenbeck (OU) process:
where , , and are the parameters of the OU process.
We require the gradient and the Malliavin derivative for Alg. 2. These are given by and . Notably, computing does not require knowledge of . Under the factorization with , we can directly obtain , where obeys the following SDE:
with , and . Since , the factorizing matrix can be determined as .
Problem and Algorithm Setup. We primarily follow the setup of (Cutler et al., 2023) for both the problem parameters and the OU-process parameters (i.e., , , ), all of which have uniform entries; we set , , , and for the time-varying distribution .
We use an NN architecture with three hidden layers, each containing 16 neurons. The SPF algorithm employs Gelu activation functions, while the PDM algorithm uses LipSwish. For PDM, normalization layers are applied after each layer to enhance training stability. We adopt the Adam-type optimizer from (Chen et al., 2022) with a learning rate of . The batch size is set to , ensuring an -stationary point with approximately precision.
Results. Figs. 2a and 2b compare SPF with the learning-based PDM and gradient-based PSG methods for using two performance metrics: (i) the optimality distance

(a)
(b)
(c)
(d)
Figure 2. (a) The optimality distance and (b) the objective suboptimality for the considered approaches on the least-squares recovery problem in §7.2. (c) The optimality distance and (d) the objective suboptimality for the considered approaches on the logistic regression problem in §7.3.
, which measures how close the recovered solution is to the true target , and (ii) the objective suboptimality , which measures the difference between the objective evaluated at and the optimum . Although the PDM algorithm achieves an optimality distance close to that of SPF in Fig. 2a, SPF outperforms both PDM and PSG overall (see §8 for a scalability evaluation of SPF and PDM). The same trend holds in Fig. 2b for objective suboptimality, where SPF exhibits the lowest error among the learning-based and gradient-based approaches.
These results can be explained by the fact that SPF enforces optimality more directly through its loss function, thereby providing a more structured search direction toward optimal solutions.
7.3. Logistic Regression
We now consider an -regularized logistic regression problem used in (Cutler et al., 2023). Specifically, we study:
where is the stochastic process to be learned, matrix has standard Gaussian rows , is a random sequence of soft labels, and is the regularization coefficient. Moreover, follows a time-varying model , with obeying the OU process in Eq. (17), where (respectively, ) denotes the -th component of (respectively, ).
Accordingly, we can compute the gradient and the Malliavin derivative required to execute Alg. 2. Note that depends on the Malliavin derivative , which can be derived by the chain rule as .
Problem and Algorithm Setup. We follow the same setup as in the previous section with ; the SPF algorithm employs Tanh activation functions, while the PDM algorithm uses Gelu to ensure stability in this experiment.
Results. Figs. 2c and 2d illustrates the performance of SPF compared with the learning-based PDM and gradient-based PSG methods in terms of the optimality distance and the objective suboptimality . SPF achieves a better optimality distance than PDM and competitive overall performance. The same pattern is observed for the objective suboptimality in Fig. 2d, where SPF improves over the gradient-based PSG baseline and performs comparably to the conventional learning-based PDM method (see the next section for a scalability evaluation of SPF and PDM). SPF solves this logistic regression problem effectively by directly enforcing the optimality condition in its formulation.
8. Scalability
We finally evaluate the scalability of SPF against the conventional learning-based method (PDM) and the gradient-based baseline (PSG) in a high-dimensional setup.
First, we consider the least-squares recovery problem from §7.2, vary the dimension of the NN parameterization, and measure the average time required to update the network parameters for one episode. Fig. 3a presents the average runtime for SPF and PDM. The runtime of SPF remains largely unaffected by the NN parameter dimension , while PDM exhibits a strong dependence on , resulting in significantly higher computational complexity. This difference can be understood from the structural distinction between the two algorithms. SPF simulates the SDEs , which together have total dimension . Hence, the dimensionality of the required SDEs is insensitive to the parameterization and does not involve differentiation with respect to it, making the SPF forward pass computationally efficient. In contrast, PDM must simulate both the original SDE and its variational counterpart, which together have dimension . Consequently, the dimension of the required SDEs scales directly with the parameterization dimension. These factors make PDM inefficient for


(b)

(c)
Figure 3. (a) Average runtime on the least-squares recovery problem for SPF and PDM. (b)-(c) Performance of SPF on a high-dimensional least-squares recovery task compared with the gradient-based baseline method, PSG.
high-dimensional NNs.
Next, we consider the least-squares problem in Eq. (16) in a high-dimensional setting with n = 100 and d = 50, while keeping the other configurations identical to those in §7.2. Figs. 3b and 3c compare the performance of SPF with that of the gradient-based PSG method; we do not evaluate PDM owing to its computational inefficiency in this high-dimensional setting. SPF clearly outperforms PSG, demonstrating a substantial performance advantage.
This scalability analysis confirms the effectiveness of the SPF algorithm for high-dimensional problems, both in terms of computational efficiency and overall performance.
9. Conclusion
This work investigated time-varying stochastic optimization (TV-SO), a class of stochastic optimization problems. We derived non-parametric optimality conditions for these problems using Malliavin calculus and proposed a deep-learning algorithm that obtains optimal solutions in a manner insensitive to the parameterization dimension. We compared our method with both learning-based and gradient-based state-of-the-art approaches. The results highlight the advantages of the proposed algorithm in terms of performance and scalability for stochastic optimization problems subject to distributional drift.
Future research could focus on establishing non-parametric sufficient conditions and extending the proposed framework to applications such as time-series forecasting.
Impact statement
This paper presents work whose goal is to advance the field of machine learning. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here.
Acknowledgments
This work was partially funded by the Research Council of Finland under grants number 354322 and 357533.
References
Alòs, E. and García Lorite, D. Malliavin Calculus in Finance: Theory and Practice. Financial Mathematics Series. Chapman and Hall/CRC, Boca Raton, FL, 2021. ISBN 9780367893446.
Amidzadeh, M. Time-varying optimization with optimal parametric functions. IEEE Conference on Decision and Control (CDC), pp. 2300–2305, 2023.
Amidzadeh, M. and Di Francesco, M. FB-MOAC: A reinforcement learning algorithm for forward-backward markov decision processes. Transactions on Machine Learning Research, 2025. ISSN 2835-8856.
Bonnier, P. and Oberhauser, H. Proper scoring rules, gradients, divergences, and entropies for paths and time series. Bayesian Analysis, 2024. doi: 10.1214/24-BA1435.
Bottou, L., Curtis, F. E., and Nocedal, J. Optimization methods for large-scale machine learning. SIAM Review, 60(2):223–311, 2018.
Bouchard, B. and Touzi, N. Weak dynamic programming principle for viscosity solutions. SIAM Journal on Control and Optimization, 49(3):948–962, 2011.
Brosse, N., Durmus, A., and Moulines, E. The promises and pitfalls of stochastic gradient Langevin dynamics. 31, 2018.
Buehler, H., Gonon, L., Teichmann, J., and Wood, B. Deep hedging. Quantitative Finance, 19(8):1271–1291, 2019. doi: 10.1080/14697688.2019.1571683.
Cao, X., Zhang, J., and Poor, H. V. Online Stochastic Optimization with Time-Varying Distributions. IEEE Transactions on Automatic Control, 66(4):1840–1847, 2021.
Chen, C., Shen, L., Zou, F., and Liu, W. Towards practical adam: Non-convexity, convergence theory, and mini-batch acceleration. Journal on Machine Learning Research, 23:229:1–229:47, 2022.
Cutler, J., Drusvyatskiy, D., and Harchaoui, Z. Stochastic optimization under time drift: Iterate averaging, step-decay schedules, and high probability guarantees. 34:11859–11869, 2021.
Cutler, J., Drusvyatskiy, D., and Harchaoui, Z. Stochastic optimization under distributional drift. Journal of Machine Learning Research, 24(147):1–56, 2023.
Duchi, J. C. Introductory lectures on stochastic optimization, 2016. Lecture notes from the Park City Mathematics Institute, Graduate Summer School, July 2016.
Fazlyab, M., Paternain, S., Preciado, V. M., and Ribeiro, A. Prediction-correction interior-point method for time-varying convex optimization. IEEE Transactions on Automatic Control, 63(7):1973–1986, 2018. doi: 10.1109/TAC.2017.2760256.
Fleming, W. H. and Soner, H. M. Controlled Markov Processes and Viscosity Solutions, volume 25 of Stochastic Modelling and Applied Probability. Springer, New York, 2 edition, 2006. ISBN 9780387264455. doi:10.1007/978-0-387-31071-2.
Jin, Z., Qiu, M., Tran, K. Q., and Yin, G. A survey of numerical solutions for stochastic control problems: Some recent progress. Numerical Algebra, Control and Optimization, 12(2):213–253, 2022. doi: 10.3934/naco.2022004.
Kidger, P., Foster, J., Li, X., and Lyons, T. J. Neural SDEs as infinite-dimensional GANs. 139:5453–5463, 18–24 Jul 2021.
Kloeden, P. E. and Platen, E. Numerical Solution of Stochastic Differential Equations, volume 23 of Applications of Mathematics. Springer-Verlag, Berlin, Heidelberg, 1992. ISBN 978-3-662-12616-5. doi: 10.1007/978-3-662-12616-5.
Komzsik, L. Applied Calculus of Variations for Engineers. CRC Press, Boca Raton, 3rd edition, 2019. doi: 10.1201/9781003009740.
Kungurtsev, V. and Jäschke, J. A predictor-corrector path-following algorithm for dual-degenerate parametric optimization problems. SIAM Journal on Optimization, 27(1):538–564, 2017.
Levine, S., Kumar, A., Tucker, G., and Fu, J. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. CoRR, abs/2005.01643, 2020.
Li, X., Wong, T.-K. L., Chen, R. T. Q., and Duvenaud, D. Scalable gradients for stochastic differential equations. 108:3870–3882, 26–28 Aug 2020.
Liu, Q., Lee, J., and Jordan, M. A kernelized stein discrepancy for goodness-of-fit tests. 48:276–284, 20–22 Jun 2016.
Liu, X., Xiao, T., Si, S., Cao, Q., Kumar, S., and Hsieh, C.-J. Neural SDE: Stabilizing neural ODE networks with stochastic noise. arXiv preprint arXiv:1906.02355, 2019.
Maity, S., Mukherjee, D., Banerjee, M., and Sun, Y. Predictor-corrector algorithms for stochastic optimization under gradual distribution shift. 2023.
Nualart, D. and Nualart, E. Introduction to Malliavin Calculus. Cambridge University Press, Cambridge, 2018. ISBN 9781107611986.
Oh, J. H., Pouryahya, M., Iyer, A., Apte, A. P., Tannenbaum, A., and Deasy, J. O. Kernel wasserstein distance. arXiv preprint arXiv:1905.09314, 2019.
Puterman, M. L. Markov Decision Processes: Discrete Stochastic Dynamic Programming. Wiley Series in Probability and Statistics. Wiley, 2014. ISBN 9780471727828.
Simonetto, A. and Massioni, P. Nonlinear optimization filters for stochastic time-varying convex optimization. International Journal of Robust and Nonlinear Control, 34(12):8065–8089, 2024.
Simonetto, A., Dall'Anese, E., Paternain, S., Leus, G., and Giannakis, G. B. Time-varying convex optimization: Time-structured algorithms and applications. Proceedings of the IEEE, 108(11):2032–2048, 2020. doi:10.1109/JPROC.2020.3003156.
Strini, J. A. On Stochastic Optimization Problems and an Application in Finance. BestMasters. Springer Spektrum, Wiesbaden, 2019. ISBN 978-3-658-25690-6. doi: 10.1007/978-3-658-25691-3.
Sun, S., Cao, Z., Zhu, H., and Zhao, J. A survey of optimization methods from a machine learning perspective. IEEE Transactions on Cybernetics, 50(8):3668–3681, 2020. doi: 10.1109/TCYB.2019.2950779.
Tzen, B. and Raginsky, M. Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit. arXiv preprint arXiv:1905.09883, 2019.
Zhang, J., Viktorov, J., Jung, D., and Pitler, E. Efficient training of neural stochastic differential equations by matching finite dimensional distributions. 2025. Poster.
A. Preliminaries
This section introduces preliminary results needed to prove Theorems 4.1 and F.1. We begin by recalling Stein's lemma: for zero-mean Gaussian random variables and , and a vector-valued, square-integrable function , the following holds:
Theorem A.1. Assume that is a vector-valued function in the domain of the Malliavin derivative; is a Wiener-driven, Malliavin-differentiable, and square-integrable process; and , with , are adapted and square-integrable processes. Then,
where is the Malliavin derivative of with respect to the Wiener process .
Proof. This theorem extends the integration-by-parts formula from Malliavin calculus (see Section 3.2) to the multivariate setting. Without loss of generality, we prove it for the case , which generalizes directly to other cases (Nualart & Nualart, 2018; Alòs & García Lorite, 2021). Let denote the -algebra generated by the processes and up to time . Then,
where (a) uses Stein's lemma from Eq. (19), and (b) follows from . The interchange of integral and expectation is justified, as is square-integrable and Malliavin-differentiable.
B. Proof of Theorem 4.1
We use variational analysis to derive the necessary optimality conditions for Problem TV-SO. Let denote an optimal -adapted process, where depends on the paths of . We therefore consider variations that depend on these paths. To this end, we analyze the variation of the objective by introducing perturbations drawn from the Hilbert space of admissible variations:
where is the space of -valued square-integrable functions. Here, represents a stochastic variation and a deterministic one. We perturb the optimal process along a direction using
Let the variation of along be denoted as . We obtain
(21)
\begin{align*}\delta_{\mathbf{d}}\mathbb{E}f(\mathbf{x}_{t},\boldsymbol{\xi}_{t},t)&=\lim_{\epsilon\to0}\frac{1}{\epsilon}\Big(\mathbb{E}\{f(\mathbf{x}_{t}^{\epsilon},\boldsymbol{\xi}_{t},t)\}-\mathbb{E}\{f(\mathbf{x}_{t},\boldsymbol{\xi}_{t},t)\}\Big)\\&=\mathbb{E}\left\{\nabla_{\mathbf{x}}f(\mathbf{x}_{t},\boldsymbol{\xi}_{t},t)^\top\left(\mathbf{k}_{t}+\sum_{l=1}^{d}\int_0^{t} \mathbf{g}_{s}^{l} dw_{s}^{l}\right)\right\}\\&\overset{(a)}{=}\mathbb{E}\left\{\nabla_{\mathbf{x}}f\right\}^\top\mathbf{k}_{t}+\sum_{l=1}^{d}\int_0^{t} \mathbf{g}_{s}^{l}^\top\mathbb{E}\left\{\nabla_{\mathbf{x}}^{2}f D_{s}\mathbf{x}_{t}^{l}\right\}ds+\int_0^{t} \mathbf{g}_{s}^{l}^\top\mathbb{E}\left\{\nabla_{\mathbf{x}}\boldsymbol{\xi}f D_{s}\boldsymbol{\xi}_{t}^{l}\right\}ds\\&=\mathbb{E}\left\{\nabla_{\mathbf{x}}f\right\}^\top\mathbf{k}_{t}+\sum_{l=1}^{d}\int_0^{t} \mathbf{g}_{s}^{l}^\top\mathbb{E}\left\{\nabla_{\mathbf{x}}^{2}f D_{s}\mathbf{x}_{t}^{l}+\nabla_{\mathbf{x}}\boldsymbol{\xi}f D_{s}\boldsymbol{\xi}_{t}^{l}\right\}ds.\end{align*}Here, (a) follows from Theorem A.1 and the following identity derived from Stein's lemma:
For to be optimal, must hold for all in the Hilbert space . This jointly requires and for all , in accordance with the fundamental lemma of the calculus of variations. Hence, the statement follows.
C. Proof of Proposition 5.1
According to Eq. (5), the Malliavin derivative —for a given and as a function of —is a diffusion process adapted to the filtration . Therefore, based on Eq. (6), the -to- stochastic flow , for a given , is adapted to . Moreover, from Eq. (7), we obtain
Hence, the statement follows.
D. Details of the PDM Algorithm
We adopt the PDM framework (Tzen & Raginsky, 2019; Liu et al., 2019) as a learning-based baseline for joint optimization over the time horizon, i.e., optimization for every . This approach formulates parametric optimality conditions based on a specific diffusion process. Note that the optimality conditions in Eq. (8) are non-parametric and do not depend on any particular parameterization policy. However, the TV-SO problem can also be addressed through a parametric reformulation. To that end, we impose a parameterized SDE as in Eq. (15), so that, given an initial state , the full trajectory is determined by a set of parameters . The TV-SO problem can then be solved via
(22)
Taking the derivative with respect to yields the condition
which must hold for every . Here, is the pathwise Jacobian of with respect to and satisfies the variational SDE
(23) with the initial condition . Since the sign of may vary with , and the condition should hold jointly for all , the corresponding parametric loss is defined as
where the differentials inside the norm can be simplified using Itô’s formula. Note that the loss in Eq. (24) serves as the stochastic analogue of the deterministic loss in Eq. (3), differing in that it explicitly depends on the parameters of the SDE in Eq. (15), whereas the losses in Eq. (11) and Eq. (27) do not. Accordingly, the PDM algorithm (referred to simply as PDM) proceeds as follows:
-
Forward pass: jointly simulate the parametric SDE in Eq. (15) and the variational SDE in Eq. (23) under the current .
-
Loss evaluation: compute the parametric loss using Eq. (24).
-
Parameter update: update the drift and diffusion parameters based on the computed loss.
E. Algorithm Setup for Baselines
We use the same neural network structure for the SPF (respectively, PDM) algorithm. To this end, we consider a deep-learning architecture with 3 hidden layers, each with 32 neurons, equipped with normalization layers and activation functions LipSwish( ) (respectively, tanh( )). We employ the Adam optimizer with a learning rate in the range . The number of batches, which simulate realizations of the diffusion process, is set to 400.
F. Functional Stochastic Optimization
We next consider functional stochastic optimization (F-SO) problems, defined as follows:
where:
• X and are -adapted, Malliavin-differentiable processes.
-
(respectively, ) is an independent copy of (respectively, ), i.e., the processes and (respectively, and ) share the same law (respectively, ) but arise from independent Wiener processes and .
-
The function is twice continuously differentiable with respect to its arguments, square-integrable, and symmetric in the pairs and .
The following theorem specifies non-parametric optimality conditions for Problem F-SO.
Theorem F.1. Consider Problem F-SO, where and are two -adapted, Malliavin-differentiable processes driven by the Wiener process . Moreover, (respectively, ) is an independent copy of (respectively, ). Then Problem F-SO can be optimized by enforcing the following optimality conditions:
for and , where abbreviates , and (respectively, ) denotes the Malliavin derivative of (respectively, ) with respect to .
Proof. As in Appendix B, we use the variational Hilbert space from Eq. (20) to compute the variation of the objective . The processes and share the same dynamics but are driven by independent Wiener processes and . Accordingly, we consider the variational directions and \mathbf{d}_t' = \mathbf{k}_t + \sum_{l=1}^d \int_0^t \mathbf{g}_s^l \, dw_s^l' for and , respectively. Let and denote the Malliavin derivatives of and with respect to . Then,
where (a) uses Theorem A.1, and (b) follows from changing the order of integration.
For to be optimal, we require for all in the Hilbert space . By the fundamental lemma of the calculus of variations and the symmetry of in and , this jointly implies for and for , which yields the stated conditions.
Remark F.2. Problem F-SO can be optimized using the following energy-functional criterion:
where is shorthand for .
F.1. Probability Law Following
In this section, we aim to construct a diffusion process whose marginal trajectory matches a given non-stationary distribution. Langevin dynamics (Brosse et al., 2018) can be applied in the case of stationary laws. Let be a family of probability laws. We seek a diffusion process inducing the law such that for almost every .
We employ the kernelized Stein discrepancy (KSD) (Liu et al., 2016) to enforce similarity between the distributions and . This discrepancy uses a smooth, positive definite kernel and is defined as , where
and is the score function of , i.e., . We then formulate an F-SO problem that uses the average KSD as the objective and minimize it over the diffusion process in Eq. (12):
To minimize this objective, we use the optimality condition in Eq. (27) and apply the SPF algorithm with learning loss to enforce alignment between the induced and target laws.
Experiment: We now consider several target distributions, with for , where , , . We also consider for , where and , and , all for .
For comparison, we employ the Finite Dimensional Matching (FDM) and Truncated Signature kernel (TruncSig) approaches (Bonnier & Oberhauser, 2024; Zhang et al., 2025) as learning-based baselines. These methods use neural SDEs
Table 4. Average KSD (mean std) for the law-following problems with defined in Section §F.1. Comparison of our SPF algorithm against SOTA methods (FDM and TruncSig). SPF outperforms SOTA for most of the considered laws .
| Model | |||||
|---|---|---|---|---|---|
| SPF (ours) | |||||
| FDM | |||||
| TruncSig |
together with scoring rules designed to learn probability laws of diffusion processes. FDM employs a rule tailored to Markov processes, whereas TruncSig uses a rule based on truncated signature kernels (Zhang et al., 2025). We apply these approaches to solve the F-SO problem in Eq. (28) and compare their performance with that of SPF.
Settings: For this experiment, we use a Gaussian kernel
with bandwidth (Zhang et al., 2025). The neural architecture consists of 4 hidden layers, each with 32 neurons and activations. We employ Adam/AdamW optimizers with learning rates in , and set the number of batches to 500. For FDM and TruncSig, we use the respective scoring rules proposed in (Zhang et al., 2025; Bonnier & Oberhauser, 2024) as training losses for learning the probability laws.
Results: Tab. 4 reports the performance of SPF relative to the state-of-the-art methods FDM and TruncSig in terms of average KSD (mean std) for the law-following problems with . The mean and std of the average KSD are computed from multiple episodes after convergence. Our method outperforms these baselines for most target laws and achieves comparable performance for . SPF attains these results by directly enforcing the optimality condition through its loss function, thereby providing a more structured search direction toward optimal solutions.