Manuscript Offprint
arXiv:2611.08883Learning to Restart: Differentiable Restart Policies for Optimization Dynamics
ABSTRACT
Adaptive restart mechanisms, which reset the momentum or other auxiliary state of an iterative optimizer, play a central role in the empirical performance of accelerated first-order methods, yet existing restart rules remain almost entirely hand-designed. The obstruction to learning restart policies is that, unlike the typical Learning to Optimize (L2O) setting, the discrete restart events make the resulting trajectory non-differentiable in the algorithm parameters and thus block gradient-based optimization of the restart policy. We resolve this obstruction by developing a differentiable framework for restart policies through their continuous-time limit. We introduce surrogate gradients for the restart events and optimization trajectories that are efficient to compute and provably converge to their continuous-time counterparts. We validate the effectiveness of our surrogate gradients in L2O settings, training restart policies that improve upon standard handcrafted adaptive restart criteria on quadratic and linear programs, and that transfer zero-shot from synthetic quadratics to logistic regression on real datasets.
1 INTRODUCTION
Optimization algorithms underlie a wide range of modern applications, including operations research (Taha, 1997), the training of large-scale machine learning models (Zhao et al., 2025), and decision-making in finance (Pilbeam, 2018). Substantial effort has therefore been devoted to accelerating these algorithms, both by analytical design and, more recently, by data-driven approaches such as hyperparameter optimization (Feurer & Hutter, 2019) and learning to optimize (L2O) (Chen et al., 2022; 2024). In this line of work, the training objective is differentiable in the parameters to be optimized, which enables efficient gradient-based optimization.
What is largely missing from this data-driven toolbox is the restart mechanism: adaptive resets of the momentum or other auxiliary state of an iterative algorithm. Restart is routinely used to accelerate convergence on a wide range of convex optimization problems (O'Donoghue & Candès, 2015; Giselsson & Boyd, 2014; Feroq & Qu, 2019, etc.), and it is also a key ingredient behind the empirical performance of PDLP on large-scale linear programs (Applegate et al., 2021; 2023; Lu & Yang, 2025; Applegate et al., 2025). The vast majority of existing restart rules, however, are designed analytically in a case-by-case manner. It is therefore natural to follow the L2O paradigm and learn the restart criterion, by parameterizing it via a neural network and optimizing it directly against a downstream optimization objective. The key obstacle is that the restart events are discrete in time, so the resulting optimization trajectory is non-differentiable, which precludes a naive application of gradient-based learning.
In this work, we resolve this obstacle by developing a differentiable framework for learning restart rules in optimization dynamics. Our starting point is the observation that, although the restart events of a discrete-time algorithm are non-differentiable in the algorithm parameters, the restart events in its continuous-time limit dynamics are differentiable. Our main contributions are summarized as follows:
-
Continuous-time differentiable restart. In continuous-time dynamics, we apply the implicit function theorem to obtain closed-form representations of the gradients for both the restart times and the trajectory (Theorem 2.2). We demonstrate that by using these gradient surrogates, a parameterized restart rule can be optimized to outperform the standard hand-designed adaptive restart criteria on the underlying ODE dynamics (Section 2.4).
-
Efficient discrete approximation. We develop a surrogate gradient (Theorem 3.2)—the discrete-time analogue of the continuous restart sensitivity that can be implemented efficiently (e.g., through the standard automatic-differentiation framework). We prove that, whenever the discrete dynamics are consistent with their continuous-time limit, the surrogate gradients converge to the continuous gradients (Theorem 3.4).
-
Applications to L2O. We instantiate the framework in the L2O setting through experiments on Quadratic Programming (Section 4.1) and on Linear Programming (Section 4.2), each with a synthetic training family and real test problems. The learned restart policies consistently outperform the standard handcrafted restart criteria on both problem families, confirming the effectiveness of our discrete surrogate gradients. In particular, a policy trained only on synthetic quadratics transfers zero-shot to logistic regression on real datasets and to tomographic reconstruction from real scanner measurements (Section 4.1), where it improves over the best handcrafted criterion.
Learning to optimize. L2O is a paradigm in which optimization algorithms are designed by training a parameterized model on a distribution of problem instances; see (Chen et al., 2022; 2024) for surveys. One line of work parameterizes either the per-step update directly by a neural network (Andrychowicz et al., 2016; Lv et al., 2017) or the algorithm's coefficients by a small parametric family motivated by an ODE limit (Xie et al., 2024). Another line of work studies when L2O can come with convergence and generalization guarantees (Liu et al., 2023; Yang et al., 2023a;b). The dominant training objective in both lines is to minimize the loss reached after a fixed iteration budget in the absence of restarts, which is differentiable in the algorithm parameters and admits standard gradient-based meta-learning.
ODE perspectives on optimization. The gradient flow perspective provides both theoretical justification and a practical design guide for gradient-based algorithms (e.g., Helmke & Moore, 2012; Wibisono et al., 2016) by relating discrete iterations to their continuous-time limit. Lyapunov analyses of these continuous-time models translate directly into convergence guarantees for the corresponding discrete iterations (Laborde & Oberman, 2020; Moucer et al., 2023), and a canonical instance is the ODE limit of Nesterov's accelerated gradient methods (Su et al., 2016; Shi et al., 2022). Building on this perspective, recent work (Xie et al., 2024; 2025) formulates a differentiable notion of stopping time for iterative algorithms and uses it to optimize convergence speed against a target accuracy. The underlying machinery—differentiating through state-dependent events of an ODE solve—is closely related to neural event functions for ODEs (Chen et al., 2020) and, more broadly, to implicit differentiation through optimization procedures (Blondel et al., 2022; Bertrand et al., 2022; Bolte et al., 2022; Xu et al., 2023).
2 DIFFERENTIABLE RESTARTS: A CONTINUOUS-TIME PERSPECTIVE
In the following, we first motivate the technical obstacle of applying the L2O paradigm to learn the adaptive restart policies.
A motivating example Consider NAG with parameter-dependent stepsize and momentum coefficient applied to a smooth convex objective :
where both parameter schedules are differentiable in the hyperparameter . Without restarts, the iterate produced after steps is a smooth function of , and any objective built from it—for instance —admits ordinary gradient-based optimization in .
To equip (1) with an adaptive restart in the spirit of O'Donoghue & Candès (2015), the natural construction is to introduce a parameterized restart score and trigger a restart whenever , at which point the momentum is reset by setting . The full parameter vector is then , and the L2O objective becomes to learn the within-phase schedule and the restart criterion jointly. However, the indices at which crosses below zero are integer-valued and locally constant in away from decision boundaries. The issue is particularly severe for , which influences the trajectory only through the location of the restart events: away from decision boundaries, is locally constant in , so its derivative vanishes and carries no information.¹
Our approach To circumvent this obstruction, we adopt the continuous-time perspective of optimization algorithms. Most discrete optimizers (including NAG and the primal–dual schemes considered later) admit a continuous-time limit (e.g., a gradient flow) in which the restart triggered by becomes smooth. In this section, we formalize this intuition, derive the continuous-time gradients, and validate their effectiveness. Section 3 then transfers these continuous-time gradients back to the discrete algorithm via an efficient surrogate, closing the loop between the continuous-time analysis and the practical iterative optimizers.
2.1 ODE DYNAMICS AND RESTARTS
We use the word state broadly: depending on the algorithm, it may comprise the optimization variable, momentum variables, primal–dual pairs, running averages, or any other auxiliary quantity maintained by the optimizer. The evolution of the state in the dynamical systems of interest can typically be written as a parameterized ordinary differential equation (ODE):
where encodes the instantaneous direction of state motion induced by the algorithm with (hyper-)parameter .
Many classical optimization algorithms (e.g., gradient descent, momentum methods, accelerated gradient methods, and primal–dual gradients) admit such a gradient-flow representation, in which the state collects the iterate together with any momentum or auxiliary variables maintained by the algorithm and the field encodes the corresponding update rule. We illustrate the abstraction with three concrete examples below.
Gradient flow. The simplest example is the (rescaled) gradient flow,
where is the objective and the scaling function is time- and parameter-dependent. In the form of (2), the field is .
Nesterov's accelerated gradient (NAG). Several ODE models of NAG² have been proposed in the literature (Su et al., 2016; Shi et al., 2022). On the smooth convex minimization problem , the limiting behaviour of NAG with stepsize can be captured by the high-resolution ODE (Shi et al., 2022):
¹The straight-through estimator (Bengio et al., 2013) corresponds to setting the integer-step derivative to zero and would therefore produce identically in this setting, providing no gradient information for .
²The corresponding discrete iteration and the standard hand-crafted restart rules are summarized in Appendix A.1.
with , and , which is shown to accurately track the trajectory of the discrete iteration. This second-order ODE fits the abstract form (2) if the state consists of the iterate and the momentum . We use these dynamics throughout Section 2.4 to validate the continuous-time gradients derived in Section 2.3.
Primal–dual gradient dynamics. For minimax (primal–dual) problems , the analogous continuous-time model is the primal–dual gradient flow (Arrow et al., 1958; Feijer & Paganini, 2010),
Closely related dynamics have been studied for constrained minimax problems (Feijer & Paganini, 2010; Cherukuri et al., 2016) and for accelerated primal–dual methods such as the primal–dual hybrid gradient (PDHG) method (Chambolle & Pock, 2011; Li & Shi, 2024).
2.2 DYNAMICS WITH RESTARTS
ODE dynamics with restarts can then be (informally) described by augmenting the ODE (2) with an additional scalar score that determines the restarting (with and ):
At any time such that , a restart is triggered: we reset and apply a restart map to obtain . Here specifies the joint dynamics of the state and the restart score, while specifies the restart operation, which may, for instance, leave the iterate component unchanged but reset the momentum variables to zero.
The system in (4) is hybrid: between consecutive restarts the state evolves continuously according to a smooth ODE, while at each restart it is reinitialized in a discontinuous fashion via the map R together with the score reset . Such hybrid evolutions can be analyzed rigorously within the framework of hybrid dynamical systems (Van Der Schaft & Schumacher, 2007; Goebel et al., 2009) or neural event functions for ODEs (Chen et al., 2020). In the following, we develop the minimal notation required to describe such systems.
General flow-map dynamics. To describe dynamics with restarts, we start by specifying the evolution within each restart phase. Let
be a differentiable flow map, with and at each phase initialization, where () denotes the state (score ) reached after time when the phase starts from . In the ODE setting above, is the solution at time of ODE (4) initialized at and , but our framework does not require to be of this specific form.
Intuitively, the whole trajectory is obtained by repeatedly flowing under until the learned event condition is met, and then starting the next phase from the resulting state. Formally, we consider a parameterized global trajectory obtained by concatenating phases. On the -th phase , the trajectory follows
where denotes the length of the phase determined by the score via
At a finite event, the pre-reset score satisfies , and the post-reset state is . If , the current phase continues without a further reset.
We summarize this construction in the following definition.
Definition 2.1 (Continuous restarted trajectory). The restarted trajectory is defined recursively, starting with and initial point . For each phase with starting time and initial point , we define
with restart time defined in (6). For finite , we then set
The notation here is deliberately compact, but it straightforwardly covers the standard restart rules used in practice. As a concrete instance, suppose that the restart score depends only on the elapsed time , the current state , and the state at the start of the current phase. Then admits the form
where is a parameterized function of the elapsed time, the current state, and the phase-start state. Handcrafted restart rules—such as the function-value and gradient-based rules of O'Donoghue & Candès (2015)—correspond to such fixed, problem-specific choices of . In our setting, is parameterized by a small neural network and its parameters are learned jointly with any parameters of the within-phase dynamics.
2.3 DIFFERENTIATING RESTART
The restart time is defined implicitly by the event equation , and its derivative can therefore be derived through the chain rule and the implicit function theorem, as in the differentiation of stopping times (Chen et al., 2020; Xie et al., 2025).
Theorem 2.2 (Sensitivity of learnable restart dynamics). Fix a finite horizon and an initial state . Suppose and are . At , assume there are exactly restarts in , occurring at . For every realized event , assume . Then and are in a neighborhood of , with recursion
and
where denotes the derivative of the score-flow component with respect to the phase initialization (i.e., the second argument), and we denote .
Consequently, for a fixed global time with , the state is also differentiable with respect to , with gradient
where by definition. The first term is a boundary-shift correction: at a fixed global time, perturbing moves the earlier restart boundaries, which changes the local time corresponding to . A full proof of Theorem 2.2 based on a phase-by-phase induction with the implicit function theorem is deferred to Appendix B.1.
In the remainder of this section, we validate the effectiveness of the gradients. In Section 3, we then develop a discrete-time counterpart of these continuous-time sensitivities that retains the same structure while avoiding the cost of exact ODE differentiation.
Throughout, applied to a phase quantity such as , , or denotes the total derivative with respect to , while , denote the partial derivatives of the flow and the score in their explicit argument; and are interpreted similarly.


Figure 1: Continuous-time validation on the QP family of (13). Left: ODE trajectories induced by (3) under different restart policies on a 2-dimensional quadratic instance, illustrating how the learned policy reshapes the iterate path. Right: objective gap along the optimization trajectories induced by the hand-designed and learned restart policies (). The learned restart policy consistently improves over both hand-designed criteria and approaches the strongly-convex reference.
2.4 VALIDATION: OPTIMIZING THE RESTARTS IN THE CONTINUOUS-TIME DYNAMICS
In the following, we demonstrate the effectiveness of the restart gradients of Theorem 2.2 by optimizing the restarts for the ODE (3). We consider QP problems of the form
with dimension and condition number ; the precise generation protocol of is deferred to Appendix C. On such problems the ODE (3) and the corresponding sensitivity equations can be simulated with high accuracy.
We parameterize the learnable restart score via a small MLP , where is a simple feature map (see Appendix C.1). The parameter is optimized with respect to the following loss (integrated function value):
with gradients computed through (10)–(12). We compare the learned policy against two handcrafted continuous-time restart criteria, which are continuous analogues of the standard discrete adaptive-restart rules of O'Donoghue & Candès (2015):
-
Function restart: , the continuous analogue of the function-based rule “restart iff ”.
-
Gradient restart: , the continuous analogue of the gradient-based rule “restart iff ”.
Figure 1 (right) reports the objective gap along the optimization trajectories induced by the hand-designed restart policies and the learned restart policy. The learned restart policy achieves a better final gap than the baseline restart criteria, and its convergence is more stable. As a reference-only ceiling, we also plot the strongly-convex accelerated ODE that uses the true strong-convexity parameter (detailed in Appendix C.1). This validates the learnability of the restart criterion in the continuous-time regime via the gradients derived in Section 2.3; more extensive experiments in the discrete-time setting are deferred to Section 4.1.
This last curve relies on knowing ; adaptive restart is precisely the mechanism that recovers the same exponential convergence rate without such knowledge.
3 EFFICIENT DISCRETE APPROXIMATION OF RESTART SENSITIVITIES
To apply the insights of Section 2.3 to practical optimization algorithms, which operate in discrete time, we now develop the discrete analogue of the continuous-time restart gradients. Concretely, in this section we introduce a notion of surrogate gradients for both the restart step (Theorem 3.2) and the restarted trajectory in the discrete setting, and we show that the surrogate gradients closely approximate the continuous-time gradient of Theorem 2.1 whenever the discrete dynamics are sufficiently close to the continuous-time dynamics.
Following the notation in Section 2, we assume that the discrete-time dynamics are described by a flow map as follows.
Definition 3.1 (Discrete restarted trajectory). The restarted discrete trajectory is defined recursively, starting with and . Assume and at every phase initialization. For each phase with starting step and initial point , define
for each , where the discrete restart time is defined as
For finite , we then set and .
As we have mentioned, the integer-valued restart step is locally constant in , and therefore does not admit a non-trivial ordinary derivative. To define a meaningful surrogate, we assume that is a discretization of a continuous-time system in the sense of Theorem 2.1: we consider the time grid for , where is the discretization stepsize and is the total number of steps with . Then, following Theorem 2.1, we can introduce the following surrogate gradients.
Definition 3.2 (Surrogate gradient). For a finite first crossing , let , which satisfies . Given , define the formal step sensitivity by
The restart-state sensitivity is defined by
(18)
where we denote . For interior global steps , the global-trajectory sensitivity is defined by the discrete analogue of (12),
(19)
where accumulates the boundary-shift surrogate gradients from previous phases.
Intuition We can mimic the continuous derivation in Section 2.3 and treat the discrete event equation as an implicit constraint and apply the implicit function theorem formally, replacing the derivative with respect to the (integer) step index by a backward difference. Symbolically, using the chain rule,
where , , and are formal symbols: they do not exist in the strict sense, since is integer-valued and inherits this non-differentiability. Although this manipulation is purely formal, it exposes the right structure: plays the role of the continuous restart time , with the time derivative replaced by the discrete backward difference defined below. Solving this formal equation for then motivates Theorem 3.2. We emphasize that this derivation is purely intuitive and does not by itself justify the surrogate; the actual theoretical guarantee comes from connecting Theorem 3.2 to the continuous-time gradients of Theorem 2.1, which is the subject of Theorem 3.4.
Computational efficiency The sensitivities defined in (17)–(18) are designed to be plugged directly into a standard automatic-differentiation framework (Appendix A.2). Appendix A.3 gives a single-pass forward-sensitivity implementation, including the restart and boundary-shift updates, with storage independent of trajectory length.
Theoretical guarantees We next show that the surrogate gradients are accurate: provided that the discrete flow map approximates in the quantitative sense of the following assumption, the surrogate gradients of the restart time, the restart state, and the global trajectory all converge to their continuous counterparts.
Assumption 3.3. Fix a finite horizon and a local-time interval with . On a neighborhood of the realized phase initializations and parameters, assume that there are constants such that the following holds.
(1) The event hypotheses of Theorem 2.2 hold, with restarts in , and for .
(2) Smoothness: , and and are both -Lipschitz.
(3) Consistency: for , the flow maps satisfy
where as .
Theorem 3.4 (Closeness of surrogate gradients to continuous gradients). Suppose that Assumption 3.3 holds, is independent of , and is sufficiently small. The discrete and continuous trajectories have the same restarts in . For , the surrogate gradient in Theorem 3.2 satisfies
For a sufficiently large constant , grid time with , it holds that
The proof and a more general formulation allowing nonuniform regularity near phase starts are given in Appendix B.3. Finally, in Appendix C.2, we empirically validate the surrogate gradient of Theorem 3.2 against its continuous-time counterpart in a setting where both can be computed accurately.
Policy improvement guarantees Built upon our framework, we establish second-order smoothness of the optimization dynamics with respect to the restart policy parameter (Appendix B.1). In particular, projected gradient descent (PGD) on the policy parameter with an appropriate stepsize is guaranteed to improve, or at least preserve, performance on the problems used for training. Therefore, if the restart policy is initialized at a given restart method, the learned policy is guaranteed not to perform worse than the given method on the empirical fixed-horizon training objective.
In addition, the convergence guarantees of the restarted dynamics can be inherited from the optimization backbone. Therefore, the learned policy can exploit accelerated NAG/PDLP dynamics when beneficial, while the worst case is bounded by the convergence guarantee of vanilla gradient methods.
4 EXPERIMENTS
We conduct experiments on two problem classes, QP with the NAG backbone and LP with the PDHG backbone of PDLP. All problem constructions, feature maps, and training hyperparameters are deferred to Appendices C to F.

Figure 2: Learning a restart policy for NAG on the QP family (13): mean objective gap along the trajectory for a policy trained on and evaluated on (left), 400 (middle), and 1000 (right).
Table 1: Terminal gap on real-measurement CT ridge reconstruction (77) (; geometric mean over 8 initial points). Per dataset, the two rows are the regularization levels and . Details in Appendix E.
| Dataset | No restart | Function | Gradient | Learned |
|---|---|---|---|---|
| walnut82 | 6.90e-09 | 2.46e-09 | 5.17e-11 | 1.76e-13 |
| 1.72e-08 | 1.72e-08 | 1.72e-08 | 2.65e-10 | |
| cheeseL45 | 1.56e-07 | 9.75e-11 | 4.91e-11 | 1.97e-12 |
| 5.72e-07 | 5.81e-08 | 5.01e-08 | 8.95e-09 | |
| cheeseF45 | 2.00e-07 | 3.50e-11 | 3.23e-11 | 2.27e-12 |
| 7.81e-07 | 8.35e-08 | 7.92e-08 | 1.77e-08 |
4.1 LEARNING TO RESTART FOR QP
Throughout this subsection, the optimizer is NAG and we compare the learned restart policy against two standard handcrafted adaptive restart criteria from O'Donoghue & Candès (2015): Function restart (restart iff ) and Gradient restart (restart iff ), together with No restart.
Synthetic quadratics. We evaluate the proposed differentiable restart mechanism by learning a restart policy for NAG on a family of diagonal QPs (13). The restart policy is a small two-layer MLP (4-32-1) taking four phase-level features as input. Training uses 20-dimensional problems with a two-stage procedure: warm-start from function-restart teacher labels, followed by end-to-end fine-tuning on a ratio objective. Full details are in Appendix C.3. Figure 2 reports the mean objective gap along the optimization trajectory, averaged over test problems. Results on unseen condition numbers are reported in Appendix C.3.
Zero-shot transfer to real data. We next ask whether a policy trained only on synthetic QPs transfers to real problems without retraining. We train a 7-32-1 MLP on synthetic quadratics with the same two-stage procedure and test it on two real problem families: -regularized logistic regression on five LIBSVM datasets (Chang & Lin, 2011) and ridge reconstruction from physically measured X-ray tomography data (Hämäläinen et al., 2015; Bubba et al., 2017) in dimensions up to . Although both tasks are out of distribution, the learned policy still attains the smallest terminal gap in every configuration. Table 1 reports the tomography results; the logistic-regression results and all experimental details are given in Appendices D and E.
4.2 LEARNING TO RESTART FOR LP
We next apply our framework to primal-dual hybrid gradient (PDHG) methods on standard-form LPs, s.t. , , using a Python reimplementation of the PDHG backbone and adaptive restart scheme of PDLP (Chambolle & Pock, 2011; Applegate et al., 2021); the update and restart rule are given in Appendix F. Throughout, we compare against the PDLP restart rule, periodic restarting, and no restarting, together with their instance-wise best envelope. The training procedure is the same as for QP; all training details are in Appendix F.

Figure 3: KKT residual (left), primal residual (middle), and dual residual (right) vs. iteration for the learned restart policy and PDLP-style baselines on synthetic LPs (dimension n = 12, m = 6).
Table 2: Netlib LP benchmark: median final residual under a fixed iteration budget; n is the number of retained instances per tier.
| Tier | Residual | Learned | PDLP default | Periodic-200 | No restart | vs. default |
|---|---|---|---|---|---|---|
| KKT | 2.29e-3 | 3.45e-3 | 4.62e-2 | 1.80e-1 | ||
| primal | 1.73e-5 | 1.85e-5 | 5.06e-3 | 1.48e-4 | ||
| dual | 3.16e-6 | 4.47e-6 | 6.73e-6 | 6.14e-5 | ||
| KKT | 4.83e-4 | 1.05e-3 | 2.37e-2 | 1.60e-2 | ||
| primal | 5.61e-5 | 9.88e-5 | 4.12e-3 | 2.12e-4 | ||
| dual | 3.86e-6 | 9.91e-6 | 5.26e-5 | 6.87e-5 | ||
| KKT | 1.25e-3 | 1.43e-2 | 3.63e-2 | 2.26e-1 | ||
| primal | 8.71e-7 | 3.18e-6 | 6.87e-4 | 2.38e-5 | ||
| dual | 4.85e-5 | 3.31e-4 | 8.71e-4 | 5.68e-5 |
Synthetic LPs. We parametrize the restart score by a small MLP, , with 183 trainable parameters. Figure 3 reports the KKT, primal, and dual residuals on held-out instances: the learned policy improves upon the best-baseline envelope in all three metrics, and the improvement carries over to larger unseen instances ( ) without retraining (Figure 6).
Netlib benchmark. Finally, we train a restart policy directly on real instances from the Netlib LP benchmark. Here we deliberately use a minimal policy class: the restart score is an affine function of 15 log-scale phase features, with only 16 trainable parameters. The policy is trained with the surrogate gradients on the 7 smallest instances and evaluated on the remaining instances across three problem-size tiers (Appendix F.4). Table 2 reports the result. The learned policy is best in every tier and residual.
5 CONCLUSION
We developed a differentiable framework for learning restart policies. Restart events are non-differentiable in discrete time but differentiable in the continuous-time limit; we derived the continuous-time gradients in closed form, introduced a discrete surrogate gradient that fits into standard automatic differentiation, and proved that it converges to the continuous-time gradient. Learned restart policies outperform handcrafted restart criteria on quadratic and linear programs, and transfer to unseen problem sizes and to real problems without retraining.
REFERENCES
Marcin Andrychowicz, Misha Denil, Sergio Gomez Colmenarejo, Matthew W. Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In Daniel D. Lee, Masashi Sugiyama, Ulrike von Luxburg, Isabelle Guyon, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 3981–3989, 2016. URL https://proceedings.neurips.cc/paper/2016/hash/fb87582825f9d28a8d42c5e5e5e8b23d-Abstract.html.
David Applegate, Mateo Díaz, Oliver Hinder, Haihao Lu, Miles Lubin, Brendan O'Donoghue, and Warren Schudy. Practical large-scale linear programming using primal-dual hybrid gradient. Advances in Neural Information Processing Systems, 34:20243–20257, 2021.
David Applegate, Oliver Hinder, Haihao Lu, and Miles Lubin. Faster first-order primal-dual methods for linear programming using restarts and sharpness. Mathematical Programming, 201(1):133–184, 2023.
David Applegate, Mateo Díaz, Oliver Hinder, Haihao Lu, Miles Lubin, Brendan O'Donoghue, and Warren Schudy. Pdlp: A practical first-order method for large-scale linear programming. arXiv preprint arXiv:2501.07018, 2025.
Kenneth Joseph Arrow, Leonid Hurwicz, and Hirofumi Uzawa. Studies in linear and non-linear programming, volume 2. Stanford University Press Stanford, 1958.
Amir Beck. First-order methods in optimization. SIAM, 2017.
Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
Quentin Bertrand, Quentin Klopfenstein, Mathurin Massias, Mathieu Blondel, Samuel Vaiter, Alexandre Gramfort, and Joseph Salmon. Implicit differentiation for fast hyperparameter selection in non-smooth convex learning. Journal of Machine Learning Research, 23(149):1–43, 2022.
Mathieu Blondel, Quentin Berthet, Marco Cuturi, Roy Frostig, Stephan Hoyer, Felipe Llinares-López, Fabian Pedregosa, and Jean-Philippe Vert. Efficient and modular implicit differentiation. In Advances in Neural Information Processing Systems, volume 35, pp. 5230–5242, 2022.
Jérôme Bolte, Tam Le, Edouard Pauwels, and Antonio Silveti-Falls. Nonsmooth implicit differentiation for machine learning and optimization, 2022. URL https://arxiv.org/abs/2106.04350.
Tatiana A. Bubba, Markus Juvonen, Jonatan Lehtonen, Maximilian März, Alexander Meaney, Zenith Purisha, and Samuli Siltanen. Tomographic X-ray data of carved cheese, 2017. URL https://doi.org/10.5281/zenodo.1254210.
Antonin Chambolle and Thomas Pock. A first-order primal-dual algorithm for convex problems with applications to imaging. Journal of mathematical imaging and vision, 40(1):120–145, 2011.
Chih-Chung Chang and Chih-Jen Lin. LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1–27:27, 2011. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm.
Ricky TQ Chen, Brandon Amos, and Maximilian Nickel. Learning neural event functions for ordinary differential equations. arXiv preprint arXiv:2011.03902, 2020.
Tianlong Chen, Xiaohan Chen, Wuyang Chen, Howard Heaton, Jialin Liu, Zhangyang Wang, and Wotao Yin. Learning to optimize: A primer and a benchmark. Journal of Machine Learning Research, 23(189):1–59, 2022.
Xiaohan Chen, Jialin Liu, and Wotao Yin. Learning to optimize: A tutorial for continuous and mixed-integer optimization. Science China Mathematics, 67(6):1191–1262, 2024.
Ashish Cherukuri, Enrique Mallada, and Jorge Cortés. Asymptotic convergence of constrained primal–dual dynamics. Systems & Control Letters, 87:10–15, 2016.
Diego Feijer and Fernando Paganini. Stability of primal–dual gradient dynamics and applications to network optimization. Automatica, 46(12):1974–1981, 2010.
Olivier Feroq. Quadratic error bound of the smoothed gap and the restarted averaged primal-dual hybrid gradient. arXiv preprint arXiv:2206.03041, 2022.
Olivier Feroq and Zheng Qu. Adaptive restart of accelerated gradient methods under local quadratic growth condition. IMA Journal of Numerical Analysis, 39(4):2069–2095, 2019.
Matthias Feurer and Frank Hutter. Hyperparameter optimization. In Automated Machine Learning, pp. 3–33. Springer International Publishing, 2019.
Pontus Giselsson and Stephen Boyd. Monotonicity and restart in fast gradient methods. In 53rd IEEE Conference on Decision and Control, pp. 5058–5063. IEEE, 2014.
Rafal Goebel, Ricardo G Sanfelice, and Andrew R Teel. Hybrid dynamical systems. IEEE control systems magazine, 29(2):28–93, 2009.
Keijo Hämäläinen, Lauri Harhanen, Aki Kallonen, Antti Kujanpää, Esa Niemi, and Samuli Siltanen. Tomographic X-ray data of a walnut, 2015. URL https://doi.org/10.5281/zenodo.1254206.
Uwe Helmke and John B Moore. Optimization and dynamical systems. Springer Science & Business Media, 2012.
Oliver Hinder. Worst-case analysis of restarted primal-dual hybrid gradient on totally unimodular linear programs. Operations Research Letters, 57:107199, 2024.
Maxime Laborde and Adam Oberman. A lyapunov analysis for accelerated gradient methods: From deterministic to stochastic case. In International conference on artificial intelligence and statistics, pp. 602–612. PMLR, 2020.
Bowen Li and Bin Shi. Understanding the pdhg algorithm via high-resolution differential equations. arXiv preprint arXiv:2403.11139, 2024.
Jialin Liu, Xiaohan Chen, Zhangyang Wang, Wotao Yin, and HanQin Cai. Towards constituting mathematical structures for learning to optimize. In Proceedings of the 40th International Conference on Machine Learning, pp. 21426–21449, 2023.
Haihao Lu and Jinwen Yang. On the geometry and refined rate of primal–dual hybrid gradient for linear programming. Mathematical Programming, 212(1):349–387, 2025.
Kaifeng Lv, Shunhua Jiang, and Jian Li. Learning gradient descent: Better generalization and longer horizons. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pp. 2247–2255. PMLR, 2017. URL http://proceedings.mlr.press/v70/lv17a.html.
Céline Moucer, Adrien Taylor, and Francis Bach. A systematic approach to lyapunov analyses of continuous-time models in convex optimization. SIAM Journal on Optimization, 33(3):1558–1586, 2023.
Brendan O'Donoghue and Emmanuel Candès. Adaptive restart for accelerated gradient schemes. Foundations of Computational Mathematics, 15(3):715–732, Jun 2015. ISSN 1615-3383. doi: 10.1007/s10208-013-9150-3. URL https://doi.org/10.1007/s10208-013-9150-3.
Keith Pilbeam. Finance and financial markets. Bloomsbury Publishing, 2018.
Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in Neural Information Processing Systems, volume 20, 2007.
Bin Shi, Simon S Du, Michael I Jordan, and Weijie J Su. Understanding the acceleration phenomenon via high-resolution differential equations. Mathematical Programming, 195:79–148, 2022.
Weijie Su, Stephen Boyd, and Emmanuel J. Candès. A differential equation for modeling nesterov's accelerated gradient method: Theory and insights. Journal of Machine Learning Research, 17 (153):1–43, 2016. URL http://jmlr.org/papers/v17/15-084.html.
Hamdy A Taha. Operations research: an introduction. Prentice hall Upper Saddle River, NJ, 6 edition, 1997.
Arjan J Van Der Schaft and Hans Schumacher. An introduction to hybrid dynamical systems, volume 251. springer, 2007.
Andre Wibisono, Ashia C Wilson, and Michael I Jordan. A variational perspective on accelerated methods in optimization. proceedings of the National Academy of Sciences, 113(47):E7351–E7358, 2016.
Zhonglin Xie, Wotao Yin, and Zaiwen Wen. ODE-based Learning to Optimize, 2024. URL https://arxiv.org/abs/2406.02006.
Zhonglin Xie, Yiman Fong, Haoran Yuan, and Zaiwen Wen. Accelerating optimization via differentiable stopping time. arXiv preprint arXiv:2505.22509, 2025.
Ming Xu, Timothy L Molloy, and Stephen Gould. Revisiting implicit differentiation for learning problems in optimal control. In Advances in Neural Information Processing Systems, volume 36, pp. 60060–60076, 2023.
Junjie Yang, Tianlong Chen, Mingkang Zhu, Fengxiang He, Dacheng Tao, Yingbin Liang, and Zhangyang Wang. Learning to generalize provably in learning to optimize, 2023a. URL https://arxiv.org/abs/2302.11085.
Junjie Yang, Xuxi Chen, Tianlong Chen, Zhangyang Wang, and Yingbin Liang. M-12o: Towards generalizable learning-to-optimize by test-time fast self-adaptation. arXiv preprint arXiv:2303.00039, 2023b.
Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, Yifan Du, Chen Yang, Yushuo Chen, Zhipeng Chen, Jinhao Jiang, Ruiyang Ren, Yifan Li, Xinyu Tang, Zikang Liu, Peiyu Liu, Jian-Yun Nie, and Ji-Rong Wen. A survey of large language models, 2025. URL https://arxiv.org/abs/2303.18223.
Algorithm 1 NAG with adaptive restart.
Require: Initial point , stepsize , restart score , horizon .
1: Set , , phase counter , anchor .
2: for do
3:
4:
5:
6:
7: if then
8: , , {restart: zero momentum, reset phase clock and anchor}
9: end if
10: end for
11: return
A ADDITIONAL DETAILS
A.1 NESTEROV'S ACCELERATED GRADIENT WITH RESTARTS
On the smooth convex minimization problem with stepsize , the standard NAG iteration with momentum coefficient can be written, in terms of the iterate and a velocity-like momentum variable , as
The state in the abstract flow-map formulation is the pair , and the restart map zeroes the velocity:
With , the iteration (25) is a discretization of the high-resolution ODE (3) of Shi et al. (2022); consistency for initial-position derivatives and time differences away from phase starts is verified in Appendix B.5.
The within-phase update (25) is augmented with a restart score that triggers a reset whenever it crosses zero. Algorithm 1 summarizes the resulting iteration.
The two standard hand-crafted restart rules of O'Donoghue & Candès (2015), used as baselines in Sections 2.4 and 4.1, are recovered by the following choices of :
-
Function restart: restart iff , equivalently .
-
Gradient restart: restart iff , equivalently .
The continuous-time analogues used in Section 2.4 are obtained by replacing by and by :
A.2 IMPLEMENTATION VIA AUTOMATIC DIFFERENTIATION
We now describe how the surrogate gradients of Theorem 3.2 can be realized as a single backward pass of a standard automatic-differentiation engine, with no manual chain-rule bookkeeping across phases. In what follows it is essential to keep two distinct gradient operators in mind:
An equivalent formulation uses the auxiliary sequence with , which yields the same asymptotic behaviour.
• grad( ) denotes the surrogate gradients introduced in Theorem 3.2. It is a mathematical object defined by (17)–(19), and need not be an ordinary derivative.
-
autograd( ) denotes the autodiff gradient produced by an autodiff engine (e.g., JAX or PyTorch) using the backward rules of its computation graph, including the stop-gradient rule below.
-
stopgrad( ) denotes the stop-gradient operator: it acts as the identity in the forward pass and detaches its argument from the computation graph in the backward pass.
We first construct, at each phase , two auxiliary quantities—a soft restart step and a soft phase-end state —that are numerically identical to and on the forward pass, but whose autodiff gradients reproduce their symbolic sensitivities:
We assume inductively that the engine has been initialized so that at the start of phase .
Soft restart step and soft phase-end state. Building on the construction in Section 3, at each phase i we define the soft restart time
and the interpolation mask
With this notation, the soft restart step and the soft phase-end state at phase i are
where, as in Theorem 3.2, .
Both and have a transparent forward-pass behavior. Since and stopgrad share the same numerical value, the mask satisfies in the forward pass, and therefore
That is, replacing the integer-valued boundary by its soft counterpart leaves the trajectory unchanged on the forward pass, so can be fed as the phase-end state into the next phase without altering the simulation.
Backward-pass agreement with the symbolic sensitivities. With held fixed and autograd() = grad(),
(31)
Using autograd(stopgrad( )) = autograd(stopgrad( )) = 0,
Since on the forward pass,
Fixed global-time outputs. In addition, maintain the accumulated soft boundary and , so that in the forward pass and autograd( ) = grad( ). At an interior global step , , let be the (uncorrected) phase-local state, with , and define the output
The added term is zero in the forward pass, while its backward pass gives
Therefore, we can use at each fixed-global-step output or loss evaluation.
A.3 EFFICIENT IMPLEMENTATION BY FORWARD SENSITIVITY PROPAGATION
The surrogate recursions admit a single forward pass that propagates sensitivities alongside the optimizer state for update rule of the form . This realizes the same quantities as Appendix A.2 without retaining a computation graph for the whole trajectory. We describe the propagation in the following.
Let and let contain the current optimizer state , restart score , and any auxiliary variables needed for a one-step update. Within phase , write
Here k is the local step index, held fixed when differentiating. The initialization map sets the score and auxiliary variables, including any prescribed initial momentum.
Let and initialize
Propagate the sensitivity matrix by
This is the ordinary chain rule at fixed local indices, with the incoming surrogate as its initial tangent. In particular, its state and score rows satisfy
At the restart step , set
Substituting the expression for and applying the chain rule to shows that (37) is exactly (18). Reinitialize with (34) for the next phase. Thus neither past phase snapshots nor past computation graphs are needed after this update.
Fixed global-time outputs and losses. Maintain the row vector , starting from , and update it at a restart by . At an interior step , , the global-trajectory surrogate is
This reproduces (19); applying only (35) would omit the shift of earlier phase boundaries. The matrix is used for the output; For a differentiable loss evaluated at an interior step , its surrogate row gradient is .
Runtime and memory. If is the cost of one state update, the cost of one such directional derivative, and the cost of a reset together with its sensitivity update, the total cost for iterations and restarts is
The additional sensitivity storage is , with storage for the current and preceding states and the temporary workspace for a single update. Thus, storage is independent of trajectory length and runtime is linear in the iteration count.
B PROOFS FROM SECTION 2 AND SECTION 3
B.1 PROOF OF THEOREM 2.2
Proof. Let and . Starting from , induction and the implicit function theorem give
For sufficiently small and a smaller neighborhood ,
Hence on , and
All derivatives of and in this display are evaluated at . For fixed strictly inside phase , shrink the parameter neighborhood so that . Then
In the final phase, strict positivity of the score on and compactness give a positive margin. By continuity, this margin persists on a slightly longer interval and in a smaller parameter neighborhood, so no additional event enters the horizon. This also justifies the fixed-phase differentiation at .
B.2 MONOTONE IMPROVEMENT
Theorem B.1 (Monotone improvement). Let be open and convex, and let be a fixed initial state. Suppose the restart hypotheses of Theorem 2.2 hold throughout . Assume Theorem 3.3(1)–(2) hold uniformly, and is uniformly Lipschitz and smooth. Then the terminal loss is -smooth on for some .
As a corollary, suppose and , projected gradient descent (PGD) with the exact terminal-loss gradient satisfies
Thus every nonzero update strictly improves the loss, and . If projection is eventually inactive, then as well.
Proof. There are restarts in . Let bound the first derivatives and their Lipschitz constants in Theorem 3.3(2). For functions on , write and for the supremum norm and Lipschitz constant. By Appendix B.1, .
Phase sensitivities. Set , , , and . Equations (10)–(11) give
For and ,
Define
Then
Moreover,
Thus for all realized phases, and .
Terminal loss. Put and . From (12),
Consequently,
Take .
Projected descent. Together with the smoothness bounds, the standard results for proximal gradient descent gives the desired inequalities; see Beck (2017, Lemma 10.4). □
B.3 DETAILED FORMULATION AND PROOF OF THEOREM 3.4
We first prove a local version of the consistency theorem that allows nonuniform regularity near phase starts, as needed for NAG. Under the uniform assumptions in the main text the proof also applies.
Assumption B.2. Fix a finite horizon and a slightly larger local-time interval , . All bounds below hold on a neighborhood of the realized phase initializations and parameters.
(1) The event hypotheses of Theorem 2.2 hold, and for .
(2) The first derivatives of and are bounded by , and is -Lipschitz. For every fixed , the first derivatives of are jointly -Lipschitz on local times .
(3) For , the value and initialization/parameter derivatives satisfy
For every fixed , the forward time differences satisfy
Here , and all constants are independent of .
Theorem B.3 (Closeness of surrogate gradients to continuous gradients). Suppose Theorem B.2 holds, is independent of , and is sufficiently small. The discrete and continuous trajectories then have the same restarts in , and
For every fixed ,
uniformly over with . Such sample times belong to corresponding phases for small . The value and sensitivity at the fixed initial point agree exactly.
The theorem also applies when the continuous reference is a family , as in the high-resolution NAG model, provided all constants and neighborhoods above are uniform. In addition, all regularity and consistency bounds can be realaxed.
In Appendix B.4 and Appendix B.5, we establish consistency with for forward Euler and for NAG. For NAG, the phase coordinate is the initial position with prescribed initial velocity, and the time-difference estimate is restricted to positive local times as above. Under the event hypotheses, the corresponding surrogate sensitivities converge at these rates.
Proof of Theorem B.3. Empty maxima below are zero. Set , , , , and . Constants are independent of ; for a family , use the uniform margins stated above. The finite recursion (10)–(11) gives
The forward-difference assumption also controls the backward differences used by the surrogate. For fixed and , applying it at and using the time-Lipschitz bound on gives
First crossings. Write and choose with
By (43),
(48)
For and ,
Consequently,
The reset and accumulated-time errors satisfy
For the final-phase positive margin on ,
Event sensitivities. Define
The consistency estimates at give
Thus
Reset sensitivities. Let , , and . Then
(51)
With ,
Finite induction yields
which proves (45)–(46).
Matched global times. For and ,
For the final phase, the same implications hold with its right endpoint beyond T. Define
By (43)–(44),
B.4 CONSISTENCY FOR FORWARD EULER DISCRETIZATION
We first verify Theorem 3.3 for the simplest case: forward Euler discretization of the generic restart-augmented ODE (4). The argument is standard but is included here to make the use of Theorem 3.4 self-contained.
Setup. Consider the ODE (4):
and the forward Euler discretization with stepsize h > 0:
The flow map F and are defined accordingly.
In the following, we verify the consistency condition (20) and (21) separately. We pack the variable and define .
Consistency condition (20) We first prove (20) for this setting.
Proposition B.4 (Forward-Euler consistency I). Suppose there exists such that , and for all . Then there exists such that, for any stepsize and any integer with ,
Proof. Let , , , and .
State error. For ,
Sensitivity error. Set , , and , . Then
Thus, with ,
Consistency condition (21) Next, we prove (21).
Proposition B.5 (Forward-Euler consistency II). Under the assumptions of Theorem B.4, there exists such that, for any stepsize and any integer with ,
Proof. For , (52) and Theorem B.4 give
□
B.5 CONSISTENCY FOR NAG AND ITS ODE
We compare the NAG iteration with to the h-dependent high-resolution ODE (3). All initialization derivatives are with respect to the phase-start position; the initial velocity is prescribed as a function of that position.
Write , , , and . The discrete and continuous dynamics are
At a phase start , initialize the discrete state at and the continuous state at . Thus describes a discrete momentum reset, while gives the initialization in (3).
Proposition B.6 (NAG consistency on the prescribed initialization manifold). Let be convex and assume global smoothness: for some ,
Thus the gradient and Hessian are globally Lipschitz. Assume have globally bounded first and second derivatives. Fix and a bounded open set of initial positions. For a function of , define
using Euclidean and induced operator norms. Put and . Then
For every fixed , uniformly in ,
The constants are independent of h and k.
The global derivative bounds are imposed for simplicity. They can be relaxed to the corresponding bounds on bounded convex neighborhoods containing the initializations, continuous and discrete trajectories, and all intermediate evaluation points, provided these neighborhoods are independent of , and the policy parameters under consideration.
Proof. Constants may depend on , the global derivative bounds, and , but not on .
Continuous bounds. Set and . This removes the Hessian term from the second equation:
The integrating-factor formula is
The kernel is at most one, and global smoothness gives . This formula and the equation for therefore yield by Gronwall's inequality. Similarly, (56) gives
Thus the continuous states, discrete states, and extrapolated points are uniformly bounded on the finite horizon, and so is at these points. Differentiating (61) in , using , and applying Gronwall's inequality gives and . Together with the undifferentiated formula, this yields
Indeed, the integral equations bound by ds and by ds. Differentiating (60) in time now gives
Only enter these bounds. Twice differentiating the integral equations introduces the bounded forcing ; the same Gronwall argument gives and .
One-step stability and error. In the transformed coordinates, the discrete map is
The original NAG map has derivative and second derivative . The change of coordinates and its inverse have derivative and second derivative . Since , the chain rule gives
Along , write . Direct subtraction gives
(65)
Here and . The latter identity and the Lipschitz bound on imply . Consequently, (62) yields . Taylor's integral formula and (63) therefore give
(66)
Accumulation. Let and . The initial discrepancy gives . By (64), the chain rule, and the bound on ,
Returning to preserves this bound in , proving the state and initialization-derivative estimate.
Time differences. The discrete equations give the exact identities
For , the state estimate and the continuous bounds imply . The coefficients and differ by , and the remaining -weighted terms in (57) are . Comparing the two equations proves (59).
Scores. All score bounds below are uniform for policy parameters in a fixed bounded set. Assume the score has globally bounded first and second derivatives in all its arguments for , and set and . Writing , the chain rule gives
The mean-value formula applied to along the segment from to , together with (59), gives for .
For an integrated score, assume the field has globally bounded first and second derivatives in all its arguments for , and let
Global Lipschitz continuity of and Gronwall's inequality bound and their first initialization/parameter derivatives on . Since , the equations for and have Euler residuals , uniformly down to time zero. For ,
The update then gives . Twice differentiating the score equation yields a linear equation for with bounded forcing, so . For either score construction, first derivatives in are uniformly bounded and second derivatives are bounded by for , as required by Theorem B.2.
Application to restarted trajectories. Apply the proposition and use the phase-start position as the abstract state coordinate, with , , and the identity on positions. Each phase internally initializes its velocity with or ; its score may observe the full position–velocity state. Thus the initialization derivative is precisely , and Theorem B.3 applies with .
C EXPERIMENT DETAILS FOR QP
We provide details for the experiments in Section 2.4, Appendix C.2, and Section 4.1.
Problem instances. With a given dimension and condition number , we generate QP problems of the form (13) as
where the diagonal entries are placed on a geometric grid,
so that the smallest and largest eigenvalues are and . This corresponds to setting and .
The minimizer is sampled from the standard Gaussian distribution with random seed 0. The initial point is sampled as .
We remark that it is without loss of generality to assume the matrix A in (13) is diagonal as the NAG updates are rotation-invariant.
C.1 DETAILS OF SECTION 2.4
ODE dynamics. Within each restart phase, the continuous-time dynamics are the high-resolution ODE (3), written in joint state with :
with , and . The reference stepsize is and the terminal time is with . Trajectories are integrated with a fourth-order Runge-Kutta method at fixed step . When a restart is triggered, the phase is reset by and the current state is stored as the new phase anchor.
As a reference-only ceiling, in Figure 1 we also report the high-resolution accelerated ODE for -strongly-convex objectives of Shi et al. (2022):
with and . Unlike the ODE (3), this dynamics requires the strong-convexity parameter explicitly, and is therefore not a practical baseline; it is included here only as a reference that adaptive restart aims to recover without knowledge of .
Network architecture and training. The learnable score is an MLP with embedding map defined as
where is the starting point of the current phase. The MLP has input dimension 5, a single hidden layer of width 16 with tanh activations, and a scalar output logit, for a total of 113 trainable parameters.
Training proceeds in two stages. We first warm-start the network on a dataset of feature-label pairs with examples collected from trajectories driven by the function-restart ODE; the warm-start is fitted by minimizing the binary cross-entropy with positive-class reweighting to compensate for the rarity of restart labels. Starting from the warm-started parameters, we then fine-tune the network using the surrogate gradients of Theorem 3.2 on the loss (14) for 20 epochs, with the AMSGrad optimizer at learning rate .
Restart policies. Figure 1 compares six trajectories on the test instance:
-
ODE no restart: the ODE (69) with no restart applied.
-
Function-restart ODE: restart triggered by the score , the continuous analogue of the discrete rule “restart iff ”.
-
Gradient-restart ODE: restart triggered by the score , the continuous analogue of the discrete rule “restart iff ”.
-
Periodic-restart ODE: restart triggered at for a fixed choice of restart length .
-
Oracle SC-NAG ODE: the strongly-convex accelerated ODE that uses the true strong-convexity constant ; this is a reference-only ceiling, since is not available in practice.
-
Learned restart: the trained policy.
For both handcrafted scores, a restart is triggered when the corresponding score crosses from nonnegative to negative between two consecutive RK4 states (i.e., ); the precise crossing time is approximated by linear interpolation within the step.
Final results on the test instance. Table 3 reports the terminal objective gaps at for the trajectories plotted in Figure 1.
Table 3: Terminal objective gaps on the held-out test initialization (). The learned restart policy improves over both handcrafted scores by several orders of magnitude and approaches the oracle strongly-convex curve.
| Method | Terminal gap |
|---|---|
| ODE no restart | |
| Function-restart ODE | |
| Gradient-restart ODE | |
| Learned restart | |
| Oracle SC-NAG ODE (reference) |

Terminal Gap Gradient Relative Error vs Time Step Size
Figure 4: Relative error between the discrete surrogate gradient and the continuous-time gradient , plotted as a function of the stepsize (with ) for dimensions ranging from 10 to 1000. The error decreases as at a rate consistent with Theorem 3.4 and remains stable across dimensions. Details are in Appendix C.1.
C.2 VALIDATION OF THE APPROXIMATION ACCURACY
We now empirically validate the surrogate gradient of Theorem 3.2 against its continuous-time counterpart in a setting where both can be computed accurately. We reuse the QP problem family of Section 2.4 together with a simple parameterized restart score . We compare:
-
Continuous-time dynamics () driven by ODE (3) with gradients computed via Theorem 2.1.
-
Discrete-time dynamics () driven by NAG iteration with stepsize (detailed in Appendix A.1) with gradients computed via Theorem 3.2 (via the autodiff implementation of Appendix A.2).
We evaluate the average relative error
across a range of stepsizes and dimensions , and report them in Figure 4. As predicted by Theorem 3.4 together with the consistency analysis of Appendix B.5, both errors decrease as and remain stable across dimensions, confirming that the surrogate gradient faithfully approximates its continuous counterpart at the same order as the underlying discretization error.

Figure 5: Out-of-distribution transfer to unseen condition numbers. The policy is trained on at and evaluated zero-shot on (top) and (bottom) with . The learned policy transfers across both dimensions and condition numbers not seen during training.
C.3 DETAILS FOR SECTION 4.1
The base optimizer is the NAG iteration of Appendix A.1 with step size . The learned restart rule is a two-layer tanh MLP with embedding dimension 4 and hidden dimension 32 and input features
where is the last restart state.
Training uses 20-dimensional problems with condition numbers and the two-stage procedure of Section 4.1: warm-start from function-restart teacher labels, followed by end-to-end fine-tuning on a ratio objective that normalizes the learned policy's terminal gap by the best handcrafted baseline. The mean objective gap along the trajectory on is reported in Figure 2 in the main text.
Additional out-of-distribution evaluation. To further probe generalization, we evaluate the same policy on condition numbers not seen during training: . Figure 5 shows results on and ; the learned policy continues to outperform both handcrafted baselines on these unseen values.
D EXPERIMENT DETAILS FOR REAL-DATA LOGISTIC REGRESSION
This appendix collects the details deferred from Section 4.1: the construction of the evaluation instances, the exact computation of , the training distribution and protocol of the transferred policy, and the evaluation protocol.
Problem instances. We use the five binary-classification datasets a9a, w8a, ijcnn1, covtype (binarized) and phishing from the LIBSVM collection (Chang & Lin, 2011), with raw dimensions 123, 300, 22, 54 and 68 respectively. Each instance is generated from a dataset , by the following deterministic-given-seed procedure.
-
Draw rows without replacement and standardize each raw feature column to zero mean and unit variance.
-
Draw random Fourier features (Rahimi & Recht, 2007) with , and , where the bandwidth is set by the median heuristic on a 300-point subsample of pairwise squared distances.
-
Rescale the resulting design matrix to unit spectral norm, so that the data-term smoothness constant is shared across instances (using for the logistic loss ).
-
Set and .
The resulting objective is the -regularized logistic regression
where with the smoothness constant of the data term. Since and , the instance is -smooth and -strongly convex, giving the condition number bound .
Exact minimizer. Unlike the QP family, (74) has no closed-form minimizer. We compute by damped Newton with Armijo backtracking in the -dimensional primal, started from the origin and iterated until ; the achieved residual is recorded per instance and is of order in all runs. The reported gaps are therefore exact to machine precision and involve no long reference run, which matters here because the gaps of interest are as small as .
Training distribution and policy. The policy has the same architecture family as in Section 4.1 and is trained exclusively on synthetic quadratics of the form (67); no real data and no logistic objective is seen during training. The training distribution draws, per problem, a dimension , a condition number , a spectrum shape in , and an initialization scale with ; each problem is a batch of 8 instances run for iterations.
For transfer across problem scales the feature map (73) is replaced by a log-scaled extension: magnitudes enter through and all remaining coordinates are dimensionless ratios,
(75)
where is the normalized one-step decrease (the scale-free analogue of the function-restart signal), is the gradient-momentum alignment (the scale-free analogue of the gradient-restart signal), and measures within-phase progress relative to the phase anchor . No coordinate depends explicitly on or , so the same architecture can be evaluated at higher dimension after training at . The features are not invariant to objective rescaling: replacing by , , shifts the first coordinate by . The network is a two-layer tanh MLP of width 32 with a scalar output logit (7-32-1, 289 trainable parameters), whose output bias is initialized to +0.5 so that the initial policy does not restart.
Training protocol. Training follows the same two stages as Section 4.1. In the warm-start stage we roll out the function-restart rule on 24 sampled training problems and record every pair along the trajectories, giving examples; the network is fitted for 300 full-batch Adam steps at learning rate on the binary cross-entropy with restart logit and positive-class reweighting to compensate for the rarity of restart labels (converged loss 0.062–0.070 across seeds). Because a restart is a hard threshold event whose straight-through gradient vanishes identically, this cloned policy is also the strongest derivative-free trainable baseline available.
In the fine-tuning stage the warm-started network is trained end-to-end through the surrogate gradient of Theorem 3.2 for 30 epochs of 8 freshly sampled problems each, minimizing the clipped log-ratio of the terminal gap to the best handcrafted baseline on the same problem,
where the minimum is over {no restart, function restart, gradient restart} and the floor at prevents a single easy problem from dominating the batch. We use AMSGrad at learning rate with gradient-norm clipping at 5, and select the checkpoint attaining the best value of (76) on a held-out set of 16 validation problems drawn from the same synthetic distribution. The entire two-stage procedure takes about two CPU-minutes per seed. We repeat it for 5 independent seeds and report all of them; no seed selection is performed anywhere in Section 4.1.
Evaluation protocol. All methods are run on the same instance, from the same , with the same stepsize and the same horizon ; the only difference is the restart rule. We evaluate 6 instances per configuration and all 5 training seeds, giving 30 paired (instance, seed) comparisons per cell and 300 in total across the ten configurations. Per-configuration numbers are geometric means of the terminal gap over instances (and additionally over seeds for the learned policies). Because different datasets have gaps of different magnitude, aggregate improvements are reported as geometric means of the per-configuration ratios. We compare against the instance-wise envelope of the three handcrafted rules, , which is a strictly stronger competitor than any fixed single rule since it is allowed to select the best criterion separately on each instance.
Table 4: Terminal gap on real-data logistic regression (74) (, ). Each dataset occupies two rows, one per regime: the first row is the regularization level with iteration budget , and the second row is with ; recall .
| Dataset | No restart | Function | Gradient | Learned |
|---|---|---|---|---|
| a9a | 2.89e-04 | 1.16e-04 | 1.13e-04 | 8.19e-05 |
| 1.74e-04 | 1.74e-04 | 1.74e-04 | 2.33e-05 | |
| w8a | 3.15e-05 | 2.14e-05 | 2.08e-05 | 7.82e-06 |
| 1.30e-05 | 3.51e-06 | 3.45e-06 | 1.55e-06 | |
| ijcnn1 | 1.45e-04 | 9.52e-05 | 7.73e-05 | 4.35e-05 |
| 7.48e-05 | 5.02e-05 | 4.93e-05 | 1.00e-05 | |
| covtype | 2.64e-04 | 1.66e-04 | 1.63e-04 | 7.41e-05 |
| 1.71e-04 | 6.90e-05 | 6.67e-05 | 2.81e-05 | |
| phishing | 1.06e-04 | 4.59e-05 | 4.54e-05 | 3.03e-05 |
| 6.71e-05 | 5.06e-05 | 5.04e-05 | 1.07e-05 |
Full results. Table 4 reports the terminal gaps of the learned policy against the three handcrafted rules.
E EXPERIMENT DETAILS FOR REAL-MEASUREMENT COMPUTED TOMOGRAPHY
This appendix collects the details deferred from Section 4.1, the second zero-shot transfer experiment, complementary to Appendix D: the same synthetic-QP training pipeline is applied, without retraining, to ridge reconstruction from physically measured X-ray tomography data.
Problem instances. We use three open tomographic datasets released by the Finnish Inverse Problems Society: a walnut scanned at an reconstruction grid (Hämäläinen et al., 2015), and the carved-cheese phantom scanned at a grid in both a full-angle and a limited-angle configuration (Bubba et al., 2017). Each dataset supplies a sparse fan-beam system matrix and the measured sinogram ; no forward projection is simulated and no synthetic noise is added. We denote the three problems walnut82, cheeseF45 and cheeseL45. Their dimensions are with nonzeros (1.47% dense, 120 projection angles
× 82 detector bins) for walnut82, and 44505 × 16384 with 8.54 · 10⁶ nonzeros (1.17% dense, 45 projection angles × 989 detector bins) for both cheese problems. The two cheese operators have identical size and differ only in angular coverage: cheeseF45 distributes its 45 angles over the full circle, whereas cheeseL45 confines them to a restricted arc, which makes the limited-angle operator substantially more ill-posed. This is a standard difficulty axis in tomography and is the reason both configurations are reported.
The reconstruction problem is the ridge least-squares objective
where is computed by 300 power iterations on and cached. Since , the instance is -smooth and -strongly convex, and the Hessian condition number is . The three datasets differ by an order of magnitude in the scale of the data themselves — for walnut82 against 10.8 and 11.4 for cheeseF45 and cheeseL45, with sinogram entries in [0, 0.92] versus [0.013, 2.45] — so these datasets also test transfer across objective scales.
A configuration is a triple (dataset, , ), and each configuration contains 8 instances that share and differ only in the initial point, with drawn from a fixed seed and alternating over across , so that the two groups have different starting magnitudes. This makes the 8 instances a controlled sweep over initialization distance rather than 8 i.i.d. repetitions.
Exact minimizer. Unlike (74), (77) is a quadratic, so solves the normal equations . We solve them by conjugate gradients to machine precision (rtol = ) and certify the result by the strong-convexity bound , which is evaluated at the returned iterate and asserted to be below ; the measured certificates lie between and , i.e. at least 14 orders of magnitude below the smallest gap appearing in Table 1. The reported gaps therefore involve no long reference run, which matters here because the smallest entry of the table is of order . As a sanity check on the reconstructions themselves, the relative data residual at is 2.8%, 4.4% and 7.2% on walnut82, cheeseL45 and cheeseF45.
Training distribution and policy. The policy is trained exclusively on synthetic diagonal quadratics of the form (67); no tomographic data, no measured operator and no sparse problem is seen during training. Per problem the training distribution draws a dimension , a condition number , a spectrum shape in {geometric, power, log-random, bulk-tail}, and an initialization scale with ; each problem is a batch of 6 instances. The feature map is the log-scaled map (75) and the network is the same two-layer tanh MLP as in Appendix D (7-32-1, 289 parameters, output bias initialized to +0.5 so the initial policy never restarts); all arithmetic is in float64.
Training protocol. Training follows the two stages of Appendix D. The warm-start stage rolls out the function-restart rule on 24 sampled training problems and fits the network for 300 full-batch Adam steps at learning rate on the positively reweighted binary cross-entropy with restart logit . The fine-tuning stage then trains end-to-end through the surrogate gradient of Theorem 3.2 for 40 epochs of 5 freshly sampled problems each, minimizing the clipped log-ratio objective (76) with AMSGrad at learning rate and gradient-norm clipping at 5; the checkpoint with the best score on 8 held-out synthetic validation problems is retained. No tomographic result is used at any point to select the checkpoint.
Evaluation protocol. All methods are run on the same instance, from the same , with the same stepsize , the same NAG momentum and the same horizon ; the only difference is the restart rule. Per-configuration numbers are geometric means of the terminal gap over the 8 instances. As in Appendix D we additionally compare against the instance-wise envelope , a strictly stronger competitor than any single handcrafted rule.
Results. Table 1 reports the terminal gaps. The learned policy attains the smallest gap in all six configurations. Against the envelope it improves the geometric-mean terminal gap by (range to ) and wins 40 of the 48 paired comparisons.
F EXPERIMENT DETAILS FOR LP
This appendix collects the details deferred from Section 4.2: the PDHG backbone used in our implementation and its associated runtime state, the default FirstOrderLP restart logic, the feature design and architecture of the learned monitor, the synthetic LP generation and training setup, and the precise definition of each curve in Figure 3.
F.1 PROBLEM GENERATION
Our best small-scale result is obtained on a synthetic dense LP family with . Each instance is a standard-form primal LP
with dual
Then , so satisfies primal feasibility, dual feasibility, and complementarity exactly. A problem family is defined by the dimensions . We first sample a matrix entrywise from and normalize by its spectral norm:
We then construct a certified primal–dual optimal solution and back-solve for . Specifically, we sample an active support set of size
set for and otherwise, sample , set on , and sample on the inactive coordinates. We then define
By construction, satisfies primal feasibility, dual feasibility, and complementarity exactly, so each generated instance comes with a certified KKT point.
For each LP instance, the initial state is
with independent coordinates.
F.2 PDHG BACKBONE AND RESTART SCORE
We describe the primal–dual algorithm for LP as implemented in our codebase, following the FirstOrderLP(FOLP) algorithm from Applegate et al. (2023).
Scaled state and PDHG update. The implementation first applies Ruiz scaling to the LP data: with diagonal row and column rescalings , the scaled data are , , , and the iterates live in the scaled coordinates , . The runtime maintains a scalar stepsize and primal weight , with primal/dual stepsizes and . The PDHG half-step is
(84)
An adaptive movement test compares a quadratic primal–dual displacement to a cross-interaction term and accepts the half-step iff or ; otherwise is set to . The stepsize is updated multiplicatively at every iteration toward the local stability limit. Throughout, the runtime maintains weighted running averages
which are used at restart checks and as the post-restart anchor.
Stepsize and primal-weight initialization. With the scaled data , the runtime is initialized by
where is the maximum absolute row sum of and is the primal_importance hyperparameter. Define the displacement and cross-interaction
with per-step stability limit when and otherwise. The stepsize is updated by
with defaults a = 0.3, b = 0.6.
KKT residual. For a state in the unscaled coordinates, define the normalized residual blocks
where is applied elementwise. The KKT residual used as our evaluation and training metric is
Duality gap and proxy. The adaptive restart scheme of Applegate et al. (2021) triggers a restart according to the normalized duality gap
where and . Computing requires solving a trust-region subproblem at each restart check. For LP, substituting the Lagrangian into (91) yields
Since is linear in , the trust-region maximization in (92) reduces to aligning with the residual vector subject to and . When the non-negativity constraint is inactive, the maximizer simply points along the residual direction, giving
where is the dual slack (we write to avoid confusion with the stepsize ). In this regime, is the norm of the combined residual vector.
Motivated by this observation, our implementation replaces the trust-region solve with the following closed-form proxy. Let denote the last restart anchor. For any restart candidate and anchor , define the scaled distance
and the LP-specific restart proxy
(95)
At a primal–dual feasible pair, is the primal–dual objective gap. At an infeasible pair, its absolute value is only an objective-mismatch statistic and need not bound the localized Lagrangian gap. The residual blocks separately measure feasibility and complementarity. The factor weights their contribution by the distance from the phase anchor, with a floor of one; it is not derived from the normalization in (91).
We use as a computationally cheap proxy for the localized normalized duality gap used in PDLP. The proxy is designed to capture the same qualitative residual information used by the restart rule, including primal feasibility, dual feasibility, complementarity, and primal–dual objective mismatch. However, it does not solve the trust-region maximization problem that defines the localized normalized duality gap in the original Julia implementation. Therefore, we do not claim that is equal or theoretically equivalent to the exact PDLP gap measure. We use it only as a low-cost restart monitor in our Python implementation. Once the residual components are available, evaluating costs and requires no inner solve, which allows restart checks to be performed frequently.
Default FirstOrderLP restart rule. At a restart checkpoint, let denote the current restart anchor. The default FOLP logic first compares the current iterate and the averaged iterate through
where and . The restart candidate is whichever of the two has the smaller value. If is the chosen candidate, define
where denote the gap proxy and distance of the previous restart segment. The default FOLP implementation restarts if either the artificial safeguard
where is the current phase length, or the normalized reduction test
After restart, the iterate is reset to the chosen candidate, the averaging buffers (85) are cleared, and the primal weight is updated from the primal/dual movement ratio with smoothing coefficient 0.5.
F.3 LEARNING RESTART POLICY FOR LP
Network architecture. The policy is a small MLP with 4 layers (embedding dimensions 10, 8, 7, 4) and ReLU activations. The feature vector has entries being the logarithm of: the duality gap , the residual sum , the primal/dual travel distances and , the runtime stepsize and primal weight , summary statistics from the previous phase, and the relative phase length . The first output coordinate is the restart logit; the remaining three outputs predict log-scale phase-summary statistics used to update the monitor state after each restart. The total number of trainable parameters is 183.

Best-baseline env. FOLP-freq200 Tuned FOLP-no-restart
Figure 6: KKT residual (left), primal residual (middle), and dual residual (right) vs. iteration for the learned restart policy and FirstOrderLP (Applegate et al., 2023) baselines on synthetic LPs (dimension n = 18, m = 6).
Training objective. The training objective is the weighted-path KKT residual
with as in (90) and up-weighting later iterates. Training proceeds in two stages. We first warm-start the network on a dataset of feature-label pairs with examples collected from the baselines; the warm-start is fitted by minimizing the binary cross-entropy with restart logit . Starting from the warm-started parameters, we then fine-tune the network using the surrogate gradients of Theorem 3.2 on the loss (100) for 6 epochs with AdamW (learning rate and weight decay ). The selected checkpoint is epoch 5, chosen by validation performance.
Baseline set. We compare against three FirstOrderLP baselines and their pointwise best envelope:
-
FOLP-default: the default FirstOrderLP reference solver;
-
FOLP-freq200: the same FirstOrderLP solver but with restart checks every 200 iterations;
-
FOLP-no-restart: the same FirstOrderLP solver with restart checks effectively disabled.
-
Best-baseline-env: the pointwise-best KKT residual achieved by the above three baselines at each iteration, serving as a conservative comparison envelope.
Out-of-distribution performance. To test generalization beyond the training scale, we evaluate the learned policy on synthetic LP instances with n = 18 variables and m = 6 constraints—50% larger than the training instances—without any additional fine-tuning. As shown in Figure 6, the learned restart policy continues to match or improve upon the best-baseline envelope on these out-of-distribution instances, indicating that the policy captures transferable phase-level restart structure rather than overfitting to the training problem size.
F.4 NETLIB BENCHMARK: POLICY CLASS, TRAINING, AND EVALUATION
This appendix details the Netlib experiment reported in Section 4.2. It differs from the synthetic-LP study above in three respects: the instances are real benchmark LPs, the policy class is an affine score rather than an MLP with monitor state, and the policy is trained on a small, a-priori-chosen subset of the benchmark and evaluated on the rest.
Policy class. Every check_every iterations the solver asks whether to restart, i.e. whether to take the running average as the new anchor. The learned score is affine in standardized features,
with the phase features listed below and the only trainable parameters.
The reason for this restricted class is that it contains the handcrafted rule as a special case: taking supported on the coordinate and recovers the PDLP sufficient-decrease test exactly. Training can therefore be initialized at the baseline rule and can be read as improving a known rule inside a class that contains it, rather than fitting an unconstrained function that might be worse. With 16 parameters and 7 training instances the capacity is also small enough that overfitting is implausible, and the fitted weights are directly interpretable. We note explicitly that this is a simplification relative to the architecture of Appendix F; we adopt it because it suffices on these features, not because the MLP fails.
Features. The feature map collects, all on a logarithmic scale: the duality gap and residual sum at the current iterate; the KKT residuals and of the current and averaged iterates; the squared primal and dual movements within the current phase; the stepsize and primal weight ; the candidate's normalized duality gap , the value from the previous phase, and the previous trial ratio ; the phase length and the relative phase length ; the per-iteration decrease rate of ; and finally the test statistic of the handcrafted rule, with , which is the coordinate that makes (101) contain the PDLP rule.
Training instances. Of the 86 Netlib instances that our parser handles, we take the 7 with the fewest nonzeros in the MPS file: afiro, sc50b, sc50a, kb2, sc105, adlittle, scagr7. The selection rule is fixed in advance and uses no evaluation outcome. These seven instances are removed from every statistic we report. No mid- or large-tier instance is used for training, so both of those tiers are size extrapolation.
Randomized initial points. Rather than training from one fixed starting point, each rollout draws a fresh initialization,
so that the magnitudes themselves vary across rollouts and the policy sees a wide family of trajectories instead of a single one.
Objective and gradients. We minimize the same weighted-path KKT residual as in (100), in logarithmic form so that instances of different difficulty contribute on a common scale,
with the linearly increasing weights biasing the optimization towards terminal accuracy. Restart times are integer-valued and hence not differentiable in ; gradients are obtained with the surrogate of Theorem 3.2.
Optimization. The parameters are initialized at the PDLP rule as described above. We train for 40 epochs with AdamW (learning rate , weight decay , gradient-norm clipping at 1.0). Checkpoints are selected on a fixed panel of 7 instances held-out initial points (seeds 2001–2003) that never enter any gradient.
Evaluation protocol. Iteration budgets are and 50000 for the small, mid and large tier, with check_every = 1. Each instance is run from 4 independent random initial points (seeds 0–3); a cell of Table 2 is the median across seeds within each instance, then the median across instances in the tier. To avoid letting non-converged runs dominate the medians, an instance is dropped from the comparison—for all methods simultaneously—whenever any method ends above a KKT residual of , leaving and 10 instances. The baselines are the PDLP default rule, periodic restarting every 200 iterations, and no restarting.