Skip to content

Menu

WorksPhysics and Astronomy

StePPO: Adaptive Step-Size Control for Initial-Value Problems Using Proximal Policy Optimisation

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_dceakuy9. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

ODE solvers are used to model, simulate, and analyse continuous-time systems found in many signal processing applications. Time integration of these initial-value problems is traditionally performed using adaptive embedded Runge–Kutta methods. For proper time-step selection, adaptive solvers accept or reject each candidate step according to a local error estimate. Their efficiency is therefore controlled by the rule that selects the next step size. Classical proportional–integral–derivative (PID) controllers are computationally inexpensive per decision and reliable, but their reactive design can lead to costly numerical solves near stiff transitions. We formulate step-size selection for parametrised IVPs as a Markov decision process and train a continuous-action policy using proximal policy optimisation. The policy processes its observation signals using a deep network while maintaining the embedded solver logic. We evaluate on a decay function, the Van der Pol system, and the Brusselator system at matched tolerances, and compare against a standard PID controller and a multi-scale DeepONet network. We find that the proposed learned policy remains within prescribed error tolerances while reducing the required number of solve steps by up to 60%, achieving a wall-clock time reduction of 58%, for both in- and out-of-distribution settings.

Introduction

Solving initial value problems (IVPs) is central to many fields of science and engineering, including physics [1]. Moreover, it is also an important component for data-driven methods, such as generating high-quality training data [2, 3, 4, 5]. Given an ordinary differential equation (ODE) with a known initial state and system parameter, one typically solves this using adaptive embedded Runge–Kutta (RKRK) methods, which combine multiple evaluations of the local vector field to determine the update and an embedded local error estimate [6]. Given a fixed error tolerance, the sequence of step sizes during an integral solve determines whether a solve is cheap or expensive: excessively large steps waste computation on rejected attempts, whereas overly conservative steps require unnecessarily many steps. This trade-off becomes particularly important when the local dynamics vary strongly along the trajectory. Stiff systems provide a prominent example, as their widely separated time scales can cause the appropriate step size to change substantially throughout the integration interval. Efficient integration therefore depends not only on satisfying the local error tolerance, but also on adapting step sizes rapidly to changes in the numerical behaviour of the system.

This adaptation is conventionally performed by proportional–integral–derivative (PID) controllers [7, 8]. Classical PID controllers are reactive by construction: their feedback law is fixed in advance and performs well on smooth systems, but they cannot respond to (sufficiently large) changes in numerical behaviour before local error evidence from within that region has already been observed, and a rejected step is only ever corrected after the wasted computation has already occurred. Moreover, PID control has a limited observation space, namely the local error (or its recent history), and is therefore constrained to infer information only from this limited, causal observation. When expanding the observation space, possibly capturing state-dependent behaviour, one could inform a controller for a specific (family of) ODEs with a learned model, due to its broader model capacity. Two relevant paradigms are: surrogate models that predict a state given system coordinates and adaptive controllers that adjust the step online from feedback observed during the solve. Here, we restrict focus to initial-value problems for ODEs.

Surrogate approaches learn a function mapping coordinates (e.g. time) directly to state, most notably in physics-informed neural networks (PINNs) [9]. Once trained, inference can be substantially faster compared to classical solvers, and they have been applied widely to both partial differential equations [10] and ODEs [5]. Their central limitation is generalisation: a PINN is learned for a single instance and does not extend to, or is very limited for, a distribution of decay coefficients without retraining for specific coefficients; it moreover struggles on systems with sharp transients [11]. Neural operators, such as DeepONet, address this by learning a function-to-function map rather than a single solution [4, 12, 13], and have been used to solve differential equations directly [3]. However, this broader generality typically requires expressive models and substantial training data, which is itself costly, while accurately solving functions exhibiting sharp transitions remains challenging [4].

A different approach is to keep the embedded solver with step-size control, and optimise step direction [14], [15], step size, or both [16]. We choose to focus on step size due to the widespread availability of preconfigured solvers, and because it keeps the same measured local error, which allows us to directly compare to current algorithms. For this approach, the classical solver is in full control of the update and we learn only its step-size controller; that is, we replace the fixed PID feedback law with a learned one. Learning a controller that generalises across a distribution of task instances requires a model capable of relating the observed numerical state to the consequences of candidate step-size decisions. This relation is difficult to obtain through supervised learning: there is generally no labelled data for a particular solver state, and the quality of a decision depends not only on its immediate outcome but also on how it affects the subsequent integration trajectory. The numerical outcome of a candidate step is not available to the controller before that step is evaluated. We therefore treat the outcome of the solver as an unknown transition process and learn the step-size policy through model-free reinforcement learning (RL), using observed transitions and rewards. A clear reward signal can be defined from observations without requiring ground-truth data, and the resulting policy can be trained across a distribution of task instances rather than fit to a single trajectory.

To this end, we learn a continuous-action policy that adapts the step size from the observed solver state aiming for a single policy that generalises across a distribution of parametrised IVPs. To address learning on a task distribution, we augment the instantaneous observation with a latent representation learned from the preceding interaction history. This representation provides the policy with information about trajectory- and task-dependent behaviour that is not available from the current observation alone. Our main contributions are as follows.

  • We formulate adaptive IVP step-size control as a sequential decision problem in which a learned continuous-action policy selects the step size while the embedded numerical solver retains full authority over state evolution and local-error acceptance.

  • We augment the policy with a learned representation of the observed solver trajectory, allowing it to condition step-size decisions on temporal information beyond the instantaneous solver state.

  • We evaluate the proposed hybrid approach against pure model- and data-driven methods on both non-stiff and stiff ODEs, including task-parameter interpolation and extrapolation, and assess both accuracy and computational cost.

The use of RL for adaptive time stepping is recent and has seen relatively few contributions. One example selects a step size from a predefined candidate set using deep Q-learning [17]. The authors also fit the output weights bjb_j of an explicit RKRK scheme by linear regression for a given problem class. Both forms of adaptation are restricted to structured parametrisations: the action space is intrinsically discrete, and because the authors set γ=0\gamma= 0 the objective is greedy, so the controller cannot trade a locally expensive step against future savings. The explicit integrator further confines admissible step sizes to a narrow stability domain, whereas we target implicit schemes with a correspondingly wider admissible range. Continuous-action RL has also been used for step-size selection in nonsmooth systems [18]. Their policy directly selects the next time step and incorporates the estimated local error into a reward that trades accuracy against computational cost. Consequently, the learned policy participates in determining the achieved accuracy; more specifically, the reward shapes the speed–accuracy trade-off during training. In contrast, we treat RL strictly as an adaptive controller around an otherwise unchanged embedded IVP solver: proposed steps remain subject to the solver’s conventional tolerance-based acceptance criterion. We further formulate this controller over a distribution of parametrised IVPs and investigate whether trajectory-conditioned policies can exploit information beyond the local error signal and generalise to unseen task parameters.

Neural operators are an adjacent paradigm that aims to reduce the computational cost of repeatedly solving differential equations by learning a direct map from inputs to solutions, rather than using a numerical integrator. Given input coordinates together with a task parameter, a neural operator produces output values in a single forward pass; this pass is not autoregressively dependent on the coordinates, which allows the full trajectory to be computed in parallel. Neural operators have been trained on ODEs [19], [20], demonstrating their ability to approximate parametrised trajectories. Because our focus is on stiff systems, this provides a relevant comparison to adaptive numerical integration. Since “vanilla” neural operators can struggle with sharp transitions, we employ a multi-scale architecture that aims to exploit oscillatory behaviour to compensate for this [13].

Background

Initial Value Problem using adaptive time stepping

An initial value problem (IVP) consists of an ODE together with an initial condition: given t0t_0 and y0y_0, find y(t)y(t) such that y˙(t)=f(t,y(t))\dot{y}(t) = f(t, y(t)) and y(t0)=y0y(t_0) = y_0. In general, y(t)y(t) is not available in closed form, so one resorts to numerical integration. A time integrator discretises the continuous variable tt into solver steps ii with times tit_i and numerical states yi≈y(ti)y_i \approx y(t_i). An RKRK method evaluates the vector field at several intermediate stages within each step and combines these evaluations to obtain an order-pp approximation, with local truncation error O(Δtip+1)\mathcal{O}(\Delta t_i^{p+1}). For stiff systems, explicit RKRK methods may require prohibitively small step sizes to remain stable; hence implicit methods are commonly used [6]. Fig. 1(a) illustrates this discretisation of y(t)y(t) into numerical states yny_n.

In the absence of an analytical solution, there is no ground truth to compare against. Instead, a proposed step is accepted if it lies within a prescribed error tolerance. This is typically done by comparing the primary embedded approximation

yi+1(p)=yi+Δti⋅di(p)(1)y_{i+1}^{(p)}=y_i+\Delta t_i\cdot d_i^{(p)} \tag*{(1)}

to a second embedded approximation

yi+1(p^)=yi+Δti⋅di(p^)(2)y_{i+1}^{(\hat{p})}=y_i+\Delta t_i\cdot d_i^{(\hat{p})} \tag*{(2)}

where pp and p^\hat{p} denote the orders of the two methods. Their difference gives ϵi=yi+1(p)−yi+1(p^)\epsilon_i=y_{i+1}^{(p)}-y_{i+1}^{(\hat{p})}. We then define the normalised error of element kk for step ii as

ei(k)=ϵi(k)atol+rtol⋅max⁡(∣yi(k)∣,∣yi+1(p,k)∣)(3)e_i^{(k)}=\frac{\epsilon_i^{(k)}}{\mathrm{atol}+\mathrm{rtol}\cdot\max\left(\left|y_i^{(k)}\right|,\left|y_{i+1}^{(p,k)}\right|\right)} \tag*{(3)}

where yi(k)y_i^{(k)} is the current state component, and atol/rtol\mathrm{atol}/\mathrm{rtol} are the absolute and relative tolerances defined for each system. Since we have a multi-dimensional problem, we take the root-mean-square error

ei=1d∑k=1d(ei(k))2(4)e_i=\sqrt{\frac{1}{d}\sum_{k=1}^{d}\left(e_i^{(k)}\right)^2} \tag*{(4)}

to transform this multi-dimensional vector into a scalar. This provides a scalar normalised embedded error estimate (error ratio) for the local step. Crucially, the step yi+1y_{i+1} is accepted whenever ei≤1e_i\leq1 and rejected otherwise; a rejected step is retried from the same tit_i with a reduced step size. As shown in Figure 1(b), the proposed step depends directly on Δt\Delta t, which requires a complete recalculation of eie_i.

Figure 1. Overview of the adaptive time-stepping problem and proposed controller. (a) Integral solve of y˙(t)=−λ⋅y(t)\dot{y}(t)=-\lambda\cdot y(t). We can write this expression analytically as y(t)=y0e−λty(t)=y_0e^{-\lambda t}, providing a ground-truth trajectory. Red chords denote the steps taken by an elementary controller, whereas orange dashed chords indicate optimal step h⋆h^\star, the largest step from the same state whose embedded error estimate still satisfies the prescribed tolerance. This indicates the potential of an improved controller. (b) Basic principle of the learned adaptive time-step controller. State and static information are supplied to the encoder and policy to determine the subsequent step-size action, which is used by the embedded solver.

In adaptive time stepping, Δti+1\Delta t_{i+1} is adapted during an integral solve and given by Δti+1=f(ei)\Delta t_{i+1}=f(e_i). Choices for f(⋅)f(\cdot) can be based on heuristics or feedback loops [21]. The latter is widely adopted, for example via PID controllers. The PID controller uses eie_i together with the error history to control Δt\Delta t. Given the default configuration kp=0k_p=0, ki=1k_i=1 and kd=0k_d=0,

the controller reduces to the classical elementary (integral) controller

ui=clip⁡(ηei−1/p^,umin⁡,umax⁡).(5)u_i=\operatorname{clip}\left(\eta e_i^{-1/\hat{p}},u_{\min},u_{\max}\right). \tag*{(5)}

where p^\hat{p} denotes the order of the error estimate. The resulting step-size update is

Δti+1=uiΔti.(6)\Delta t_{i+1}=u_i\Delta t_i. \tag*{(6)}

Intuitively, a small error (ei≪1e_i\ll1) yields ui>1u_i>1 and the step grows, while a large error (ei>1e_i>1) yields ui<1u_i<1 and the step shrinks; the factor 1p^\frac{1}{\hat{p}} ties the rate of adaptation to the convergence order of the error estimate. As shown in Figure 1(a), a PID step is not necessarily optimal; h⋆h^\star indicates the optimal step that still lies within the error tolerances. As such, there is ample room to improve such a controller.

Initial value problems as a Markov Decision Process

Numerical integration of an IVP can be interpreted as a sequential state-transition process. Starting from (t0,y0)(t_0,y_0), the solver iteratively advances the numerical state until t≥tendt\geq t_{\mathrm{end}} or the budget NstepsN_{\mathrm{steps}} is exhausted. We refer to such a full sequence of states as a trajectory τ\tau. At each iteration, the outcome of the next solver attempt is determined by the current numerical state and the proposed step size. We denote the complete numerical state of the integration process at step ii by sis_i, including tit_i, yiy_i, the previous step size Δti−1\Delta t_{i-1}, and any relevant controller history. For a fixed numerical integration scheme, the subsequent state depends only on the current complete state, the proposed step size, and the task parameter ξ\xi. Consequently, the integration process satisfies the Markov property,

p(si+1∣s0,…,si,ai,ξ)=p(si+1∣si,ai,ξ).(7)p(s_{i+1}\mid s_0,\ldots,s_i,a_i,\xi)=p(s_{i+1}\mid s_i,a_i,\xi). \tag*{(7)}

where aia_i is the multiplicative step-size action. For IVP parametrisation ξ\xi and numerical scheme RKRK, the solver induces an action-conditioned transition

si+1=T(si,ai).(8)s_{i+1}=\mathcal{T}(s_i,a_i). \tag*{(8)}

Although this transition is deterministic for the systems considered here, its outcome is not available to the controller at decision time. In particular, the candidate state yi+1y_{i+1}, the corresponding local error estimate eie_i, and the eventual accept/reject decision are obtained only after evaluating the proposed numerical step. Evaluating Tξ(si,ai)T_{\xi}(s_i, a_i) is therefore precisely the computation whose cost the step-size controller seeks to use efficiently.

Classical adaptive controllers do not explicitly predict this action-conditioned transition. Instead, they select the next step size from quantities observed during previous solver evaluations, most prominently the local error history. The resulting control law is therefore primarily reactive: whether the newly proposed step was appropriate becomes clear only after that transition has been evaluated. This motivates a controller that can exploit the observed trajectory to anticipate the likely numerical consequence of a candidate step before executing it. The controller observation is a projection of the complete numerical state; in particular, the current step size need not be included in the observation even though it affects the transition.

Reinforcement learning

Reinforcement learning aims to learn a stochastic policy

ai∼πθ(ai∣oi),(9)a_i \sim\pi_\theta(a_i \mid o_i), \tag*{(9)}

where oio_i denotes the observation available to the controller and θ\theta denotes the learnable policy parameters [22]. The environment evolves from state sis_i according to si+1=T(si,ai;ξ)s_{i+1} = T(s_i, a_i; \xi), where ξ\xi denotes task parameters that may vary between environments. The task parameter ξ\xi may be supplied as part of oio_i, but the controller need not have access to the complete environment state sis_i; instead, it selects its action from the available observation oio_i. Each transition produces a subsequent observation oi+1o_{i+1} and reward ri+1r_{i+1}. Given the sequence of state transitions (trajectory), we can describe a complete sequence as

τ=(o0,a0,r1,o1,…,aN−1,rN,oN),(10)\tau= (o_0, a_0, r_1, o_1, \ldots, a_{N-1}, r_N, o_N), \tag*{(10)}

with NN the sequence budget. The objective is to maximise the expected return over the complete trajectory,

J(θ)=Eτ∼πθ[∑i=0N−1γiri+1](11)J(\theta) = \mathbb{E}_{\tau\sim\pi_\theta}\left[\sum_{i=0}^{N-1} \gamma^i r_{i+1}\right] \tag*{(11)}

with discount factor γ∈[0,1]\gamma\in[0, 1].

Directly attributing (11) to individual actions is non-trivial; as such, we optimise the policy using Proximal Policy Optimisation (PPO) [23]. PPO follows an actor–critic formulation, where the actor πθ(ai∣oi)\pi_\theta(a_i \mid o_i) defines the action distribution and the critic Vϕ(oi)V_\phi(o_i) estimates the expected future return used as a baseline for evaluating sampled actions.

This difference is represented through the advantage estimate. We employ generalised advantage estimation (GAE) [24]

δi=ri+1+γVϕ(oi+1)−Vϕ(oi),(12)\delta_i = r_{i+1} + \gamma V_\phi(o_{i+1}) - V_\phi(o_i), \tag*{(12)}
A^i=∑l=0N−i−1(γ⋅λGAE)l⋅δi+l,(13)\hat{A}_i = \sum_{l=0}^{N-i-1}(\gamma\cdot\lambda_{\mathrm{GAE}})^l \cdot\delta_{i+l}, \tag*{(13)}

where λGAE∈[0,1]\lambda_{\mathrm{GAE}} \in[0, 1] controls the bias–variance trade-off of the estimate. The advantage estimate determines how the probability density of the sampled action should be adjusted: actions with A^i>0\hat{A}_i > 0 performed better than expected and should become more likely, whereas actions with A^i<0\hat{A}_i < 0 should become less likely. PPO incorporates this signal through the clipped surrogate objective

Lclip(θ)=Ei[min⁡(ρi(θ)A^i,clip⁡(ρi(θ),1−ϵ,1+ϵ)A^i)],(14)L^{\mathrm{clip}}(\theta) = \mathbb{E}_i\left[\min\left(\rho_i(\theta)\hat{A}_i,\operatorname{clip}\left(\rho_i(\theta),1-\epsilon,1+\epsilon\right)\hat{A}_i\right)\right], \tag*{(14)}

where

ρi(θ)=πθ(ai∣oi)πθold(ai∣oi)(15)\rho_i(\theta) = \frac{\pi_\theta(a_i \mid o_i)}{\pi_{\theta_{\mathrm{old}}}(a_i \mid o_i)} \tag*{(15)}

is the probability-density ratio for the sampled action. The critic is simultaneously fitted to the return target

R^i=A^i+Vϕ(oi),(16)\hat{R}_i = \hat{A}_i + V_\phi(o_i), \tag*{(16)}

where A^i\hat{A}_i and R^i\hat{R}_i are computed from the collected rollout and treated as fixed targets during the subsequent PPO update. This target is used in

LV(ϕ)=1N∑i[Vϕ(oi)−R^i]2.(17)L^V(\phi) = \frac{1}{N}\sum_i\left[V_\phi(o_i)-\hat{R}_i\right]^2. \tag*{(17)}

Finally, an entropy term Lent=Ei[H[πθ(⋅∣oi)]]L^{\mathrm{ent}} = \mathbb{E}_i[H[\pi_\theta(\cdot\mid o_i)]] encourages exploration during training. We maximise the complete objective

L=Lclip−c1LV+c2Lent,(18)L = L^{\mathrm{clip}} - c_1L^V + c_2L^{\mathrm{ent}}, \tag*{(18)}

where c1c_1 and c2c_2 respectively weight the value and entropy terms.

Methods

Our central design is based on separating numerical accuracy from computational efficiency. Specifically, the embedded solver remains responsible for the state update and for enforcing numerical accuracy, while our controller merely focuses on efficient solver step proposals. Consequently, the policy cannot improve efficiency by relaxing the error criterion. Classical controllers determine the next step proposal from error estimates. We instead hypothesise that the numerical consequence of a candidate step can be better anticipated by exploiting a richer description of the current trajectory and task. We therefore learn a controller that maps the available solver information to a multiplicative step-size factor gig_i

Δti=giΔti−1,(19)\Delta t_i = g_i\Delta t_{i-1}, \tag*{(19)}

with ai=gia_i = g_i and as such πθ:oi↦ai=gi\pi_\theta: o_i \mapsto a_i = g_i. Given the expected complexity of this mapping, we use a deep neural network fθ(⋅)f_{\theta}(\cdot) with learnable parameters θ\theta. To learn such a policy, we must define a reward function. A desirable policy reaches tendt_{\mathrm{end}} using as few solver evaluations as possible while respecting the prescribed numerical tolerance. We therefore define the relative progress through the integration interval as

Φ(ti)=min⁡(ti−t0tend−t0,1),(20)\Phi(t_i)=\min\left(\frac{t_i-t_0}{t_{\mathrm{end}}-t_0},1\right), \tag*{(20)}

such that

ΔΦi=Φ(ti+1)−Φ(ti)(21)\Delta\Phi_i=\Phi(t_{i+1})-\Phi(t_i) \tag*{(21)}

measures the progress resulting from a solver attempt. An accepted step yields positive progress, whereas a rejected step leaves tt unchanged and consequently gives ΔΦi=0\Delta\Phi_i=0. We additionally reward completion with unused computational budget,

ri+1=ΔΦi+1{ti+1=tend}⋅cterm(1−Ni+1Nmax⁡)(22)r_{i+1}=\Delta\Phi_i+\mathbb{1}_{\{t_{i+1}=t_{\mathrm{end}}\}}\cdot c_{\mathrm{term}}\left(1-\frac{N_{i+1}}{N_{\max}}\right) \tag*{(22)}

where NiN_i is the number of solver attempts used (including rejected attempts), and Nmax⁡N_{\max} denotes the trajectory budget. Trajectories terminate upon reaching tendt_{\mathrm{end}} or exhausting the budget; no separate failure penalty is applied, and the terminal coordinate is constrained such that ti≤tendt_i\leq t_{\mathrm{end}}. Notably, the local error eie_i does not enter the reward explicitly: the local-error acceptance criterion remains enforced by the embedded error estimator of the numerical solver.

Interaction with the solver follows the conventional reset/step formulation. We define an episode as one complete integration from (t0,y0)(t_0,\mathbf{y}_0) until either tendt_{\mathrm{end}} is reached or the step budget is exhausted. At the beginning of an episode, a task parameter ξ\xi is sampled and the numerical state is initialised at (t0,y0)(t_0,\mathbf{y}_0). The observation supplied to the policy contains only quantities available during numerical integration,

oi=[y~i;e~i−1;Δe~i−1;αi−1;ξ].(23)o_i=\left[\widetilde{\mathbf{y}}_i;\widetilde{e}_{i-1};\Delta\widetilde{e}_{i-1};\alpha_{i-1};\xi\right]. \tag*{(23)}

Here, y~i\widetilde{\mathbf{y}}_i is the normalised solution state, Δei−1=ei−1−ei−2\Delta e_{i-1}=e_{i-1}-e_{i-2} is the error difference, e~i−1\widetilde{e}_{i-1} and Δe~i−1\Delta\widetilde{e}_{i-1} denote the corresponding normalised error features, and αi−1∈{0,1}\alpha_{i-1}\in\{0,1\} indicates whether the previous solver attempt was accepted.

Tracking trajectory dynamics is expected to have a positive effect on performance. We therefore use an encoder–decoder alongside the policy to maintain a latent state ziz_i summarising the interaction history. The policy and value function are conditioned on this embedding, πθ(ai∣oi,zi)\pi_{\theta}(a_i\mid o_i,z_i) and Vϕ(oi,zi)V_{\phi}(o_i,z_i). The embedding provides trajectory context that is useful for control; it is not interpreted as an inferred task parameter. The task parameter ξ\xi is supplied to the policy and used as an auxiliary decoder target to provide a task-specific learning signal to the latent space. We train the variational auto-encoder on a buffer D={τi}\mathcal{D}=\{\tau_i\}, similar to VariBAD [25]. We use a four-dimensional latent state with encoder widths [128,128][128,128] and decoder widths [128,64,32][128,64,32]. The decoder objectives rrewardr_{\mathrm{reward}}, racceptr_{\mathrm{accept}}, rtaskr_{\mathrm{task}}, and rstater_{\mathrm{state}} are weighted 0.450.45, 0.300.30, 0.200.20, and 0.050.05, respectively, where rtaskr_{\mathrm{task}} and rstater_{\mathrm{state}} are our additions.

Experiment

ODE systems

We evaluate three ODE systems with varying task parameters: scalar decay, the Van der Pol oscillator [26], and the Brusselator [27]. The scalar decay problem is

y˙=−μy,(24)\dot{y}=-\mu y, \tag*{(24)}

where increasing μ\mu imposes increasingly restrictive stability requirements. The Van der Pol oscillator is given by

y˙1=y2,y˙2=μ(1−y12)y2−y1,(25)\begin{aligned} \dot{y}_1 &= y_2,\\ \dot{y}_2 &= \mu(1-y_1^2)y_2-y_1, \tag*{(25)} \end{aligned}

with state y=(y1,y2)T\mathbf{y}=(y_1,y_2)^{\mathsf{T}} and nonlinearity parameter μ\mu. Its state-dependent dynamics and sharp transitions can make PID control inefficient. The Brusselator is

y˙1=A+y12y2−(B+1)y1,y˙2=By1−y12y2,(26)\begin{aligned} \dot{y}_1 &= A+y_1^2y_2-(B+1)y_1,\\ \dot{y}_2 &= By_1-y_1^2y_2, \tag*{(26)} \end{aligned}

where A=1A=1 and B∈[1,50]B\in[1,50]. Its stiffness depends on the parameter regime and trajectory. We denote the generic task parameter by ξ\xi, corresponding to μ\mu for the first two systems and to BB for the Brusselator.

To solve the trajectories, we use Kvaerno5 from Diffrax, with the Diffrax PID controller as the baseline adaptive controller [28]. We use the elementary controller kp=0k_p=0, ki=1k_i=1 and kd=0k_d=0 with η=0.9\eta=0.9 and [umin⁡,umax⁡]=[0.2,10][u_{\min},u_{\max}]=[0.2,10]. Moreover, we include an “oracle” controller to provide an approximate efficiency reference. Starting from a PID step, it probes larger accepted steps using relative gains of 25%, 12.5%, 6.25%, and so on. If the PID step is rejected, the candidate step is reduced by 25% until recovery or termination. Rejected candidates do not replace the best accepted state, so the oracle is an approximate reference rather than a computational lower bound.

PPO

All agents are trained for 750 PPO iterations across Nenv=256N_{\mathrm{env}} = 256 parallel environments, using rollout horizons T=50T = 50, 750, and 1200 for scalar decay, Van der Pol, and Brusselator, respectively. We use γ=0.99\gamma= 0.99, λGAE=0.95\lambda_{\mathrm{GAE}} = 0.95, a clip range of 0.2, value coefficient c1=0.5c_1 = 0.5, and entropy coefficient βH=0.005\beta_H = 0.005 [29]. Each iteration uses four PPO epochs with four minibatches per epoch. The policy uses hidden widths [128, 64, 32] with tanh activations. Adam is initialised at 10−310^{-3} and annealed to 10−510^{-5}. For the latent variant, the VAE is updated twice per iteration from the same collected trajectories using the same learning-rate schedule. We run four seeds per configuration.

DeepONet

We adopt a custom DeepONet implementation based on the Cartesian-product formulation [4] as implemented in DeepXDE [12], extended with a multi-scale Fourier feature trunk following the multiscale DeepONet formulation for oscillatory operator learning described for seismic wave response modelling [13]. Input coordinates are projected through two parallel random Gaussian Fourier features at scales σ=1,10\sigma= 1, 10 before entering shared trunk layers. Both branch and trunk networks use five hidden layers of width 256 with ReLU activations and Glorot normal initialisation, trained jointly with Adam for 1k epochs on 8192 training and 8192 held-out test trajectories with batch size 256. We have observed a plateau during training well before the number of epochs was reached. We simulate the systems over [0, 10], [0, 50], and [0, 100], respectively, using rtol=10−3\mathrm{rtol} = 10^{-3} and atol=10−6\mathrm{atol} = 10^{-6}. Figure 2 shows the trajectories and local error estimates eie_i from (4) of PID (elementary), StePPO and DeepONet; proposed steps with ei>1e_i > 1 are rejected for PID and StePPO and therefore omitted from the trajectories. We consider the integrated error

State trajectories and corresponding local error estimates

Figure 2. The state trajectory and the corresponding local error estimate given by (4). The max error threshold is set at emax⁡=1e_{\max}=1, where ei>1e_i>1 is rejected. Note how for the scalar decay, the non-stiff problems (small qq) operate far below the error threshold, while highly damped system (initially) operate near error threshold. Also note that DeepONet operates orders of magnitude above the error threshold than acceptable for adaptive time steppers.

eint=(1tend−t0)∑i=1N−1e^(i)+e^(i−1)2(27)e_{\mathrm{int}} = \left(\frac{1}{t_{\mathrm{end}} - t_0}\right)\sum_{i=1}^{N-1}\frac{\hat{e}(i) + \hat{e}(i-1)}{2} \tag*{(27)}

where e^(i)\hat{e}(i) is the relative error compared to the reference trajectory.

Results

Figure 3 shows the integrated error einte_{\mathrm{int}} and number of steps nstepsn_{\mathrm{steps}} for the decay, Van der Pol, and Brusselator systems. DeepONet produces substantially larger errors than the adaptive controllers under the prescribed error tolerances and varying task dynamics. PID and StePPO achieve comparable errors, with small differences arising from deviations of the numerical trajectories relative to yrefy_{\mathrm{ref}}.

Performance across the three benchmark systems

Figure 3. Performance across the three benchmark systems. Left column: integrated error einte_{\mathrm{int}} with respect to the reference trajectory. Right column: number of solver steps nstepsn_{\mathrm{steps}} required by PID and StePPO. The Oracle indicates a lower bound on the number of steps required for the corresponding task parameter λ\lambda. Rows show (a) scalar decay, (b) Van der Pol, and (c) Brusselator.

For the decay problem, StePPO initially requires more steps than PID. Given the short integration interval tend=10.0t_{\mathrm{end}} = 10.0 and low decay rates ξ<5\xi< 5, the potential reduction in solver steps is small. Although some runs outperform PID across the task distribution, this improvement is not consistent. For both Van der Pol and Brusselator, StePPO substantially reduces the number of steps required and approaches the local oracle reference. This reduction is achieved through fewer rejected steps and larger accepted step sizes. The learned controller therefore adapts more effectively in regions where the admissible step size changes rapidly, reducing the number of costly rejected attempts. Nevertheless, StePPO does not achieve oracle controller performance, indicating theoretical room for improvement.

Robustness of learned models.

PID is task-agnostic by construction, whereas learned models may exhibit reduced performance outside their training support. We therefore consider two training protocols on the Van der Pol system: a full-range setting, trained on ξ∈[1,50]\xi\in[1, 50], and a binned setting, trained only on ξ∈[5,15]∪[35,45]\xi\in[5, 15] \cup[35, 45]. All models are evaluated on ξ∈[1,50]\xi\in[1, 50]. For the binned setting, this yields in-distribution evaluation inside the two training bins, interpolation on ξ∈(15,35)\xi\in(15, 35), and extrapolation on ξ∈[1,5)∪(45,50]\xi\in[1, 5) \cup(45, 50].

Figure 4 reports the integrated error across the full evaluation range. For DeepONet, we show both the full-range and binned variants. StePPO was also trained under both protocols; however, the resulting curves were nearly identical, so only one StePPO curve is shown for readability. StePPO achieves accuracy comparable to PID across the full evaluation range, whereas DeepONet degrades markedly when training is restricted to the binned support, particularly outside the training bins.

Figure 4. Robustness on the Van der Pol system under two training protocols. A full-range model is trained on ξ∈[1,50]\xi\in[1,50], whereas a binned model is trained only on ξ∈[5,15]∪[35,45]\xi\in[5,15] \cup[35,45]. All models are evaluated on ξ∈[1,50]\xi\in[1,50]. In panel (a), the shaded regions indicate the binned training intervals. We report the integrated error for PID, StePPO, and DeepONet; DeepONet is shown for both the full-range and binned training protocols. StePPO was also trained under both protocols, but the resulting curves were nearly identical, so only one is shown. Panels (b) and (c) show example trajectories for ξ=7\xi= 7 (inside the binned training support) and ξ=2\xi= 2 (outside the binned training support), respectively, comparing PID with DeepONet trained on the full range and on the binned support. For visualisation purposes, we set tend=25t_{\mathrm{end}} = 25 and show only every 5th data point.

Study on the wall-clock time.

Fewer numerical steps do not necessarily reduce runtime because learned controllers add a neural-network evaluation at each solver step. We therefore measure end-to-end wall-clock time for PID, StePPO, and DeepONet (Figure 5), excluding JIT compilation and using warm-up runs. PID and StePPO runtimes track their solver-step counts. Although StePPO evaluates a policy every iteration, it is substantially faster than PID over most task parameters, showing that step-count reductions outweigh inference overhead. For scalability, we repeat the experiment with nenv=2in_{\mathrm{env}} = 2^i, i∈{1,2,3,4,5,6}i \in\{1, 2, 3, 4, 5, 6\}. Batch latency stays constant, so throughput increases with nenvn_{\mathrm{env}} via batched GPU execution, at the cost of higher GPU memory use. DeepONet behaves differently: it predicts the solution with a fixed number of network evaluations, so its inference time is largely independent of adaptive step count and nearly constant across task parameters. This highlights the inference-time efficiency of a fully learned surrogate, separate from accuracy and generalisation.

Wall-clock time versus task parameter for the Van der Pol system

Figure 5. Wall-clock (ms) vs ξ\xi for Van der Pol for nenv=1n_{\mathrm{env}} = 1 on GPU using PID, StePPO and DeepONet. Indicated shaded regions show the wall-clock reduction of RL over PID and the remaining reduction of DeepONet over RL. DeepONet maintains a nearly constant wall-clock time.

Discussion

The results suggest that learned control is most beneficial for trajectories with state-dependent stiff regions, where trajectory information can help anticipate step-size changes before repeated rejections occur. This is consistent with the larger PID–StePPO separation for Van der Pol and Brusselator and the smaller gain for scalar decay.

In contrast to fully data-driven approaches—such as surrogate models like DeepONet—two key differences stand out. To begin with, using a surrogate model can enable inference that is orders of magnitude faster. However, these models often have difficulty capturing trajectories accurately, particularly in systems with sharp transients or with widely varying task parameters. In addition, their performance typically degrades when asked to predict out-of-distribution data. Neither increasing the model size nor training for longer led to meaningful improvements. Since these models demand substantial computational resources for training while inference is often carried out on comparatively narrow or simple data, their practical applicability remains limited.

We have found that training dynamics are sensitive to the distribution of “task difficulty”. We note that different ranges in the binned training produced different convergences for Brusselator. Given A=1A = 1 and B∈[1,50]B \in[1,50], there is a large difference in trajectory dynamics. Without a proper choice of sampling-bin ranges and distribution, models could fail to learn properly, even in-distribution. We initially sampled log⁡B∼U(log⁡1,log⁡100)\log B \sim\mathcal{U}(\log1,\log100). However, given A=1A = 1, the hardest tasks were around B=20B = 20, and this distribution tended to oversample the easy tasks, causing a complete failure of training. As such, for future research we are interested in applying a sampling strategy that better targets harder tasks from a given task distribution [30].

Conclusion

We formulated adaptive step-size control for parametrised initial value problems as a model-free Markov decision process and trained a continuous-action controller using PPO that preserves an embedded solver’s local-error scaling and accept/reject rule. The policy augments classical error feedback with solution state and acceptance statistics. Results show little improvement on smooth scalar decay, but substantial reductions in solver attempts and wall-clock time for Van der Pol and Brusselator at matched tolerance, including held-out task parameters. This positions learned control as an extension of classical adaptive integration when avoided solver evaluations outweigh policy-inference cost.

References

  1. [1]F. S. Guzmán, Numerical methods for initial value problems in physics. Springer, 2023.DOI
  2. [2]L. M. Navarro, L. Martin-Moreno, and S. G. Rodrigo, “Solving differential equations with deep learning: a beginner’s guide,” European Journal of Physics, vol. 45, no. 1, p. 015803, Jan. 2024. [Online]. Available: https://doi.org/10.1088/1361-6404/ad0a9f
  3. [3]Q. Cao, S. Goswami, and G. E. Karniadakis, “Laplace neural operator for solving differential equations,” Nature Machine Intelligence, vol. 6, no. 6, pp. 631–640, Jun. 2024. [Online]. Available: https://doi.org/10.1038/s42256-024-00844-4
  4. [4]L. Lu, P. Jin, and G. E. Karniadakis, “DeepONet: Learning nonlinear operators for identifying differential equations based on the universal approximation theorem of operators,” Nature Machine Intelligence, vol. 3, no. 3, pp. 218–229, Mar. 2021, arXiv:1910.03193 [cs.LG]. [Online]. Available: http://arxiv.org/abs/1910.03193
  5. [5]M. De Florio, E. Schiassi, F. Calabrò, and R. Furfaro, “Physics-Informed Neural Networks for 2nd order ODEs with sharp gradients,” Journal of Computational and Applied Mathematics, vol. 436, p. 115396, Jan. 2024. [Online]. Available: https://linkinghub.elsevier.com/retrieve/pii/S0377042723003400DOI
  6. [6]J. C. Butcher, “Implicit runge-kutta processes,” Mathematics of computation, vol. 18, no. 85, pp. 50–64, 1964.DOI
  7. [7]G. Söderlind, “Digital filters in adaptive time-stepping,” ACM Transactions on Mathematical Software, vol. 29, no. 1, pp. 1–26, 2003. [Online]. Available: https://dl.acm.org/doi/10.1145/641876.641877DOI
  8. [8]———, “Automatic Control and Adaptive Time-Stepping,” Numerical Algorithms, vol. 31, pp. 281–310, 2002. [Online]. Available: https://doi.org/10.1023/A:1011600290090
  9. [9]M. Raissi, P. Perdikaris, and G. Karniadakis, “Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations,” Journal of Computational Physics, vol. 378, pp. 686–707, Feb. 2019. [Online]. Available: https://linkinghub.elsevier.com/retrieve/pii/S0021999118307125DOI
  10. [10]K. Luo, J. Zhao, Y. Wang, J. Li, J. Wen, J. Liang, H. Soekmadji, and S. Liao, “Physics-informed neural networks for PDE problems: a comprehensive review,” Artificial Intelligence Review, vol. 58, no. 10, p. 323, Jul. 2025. [Online]. Available: https://link.springer.com/10.1007/s10462-025-11322-7DOI
  11. [11]A. S. Krishnapriyan, A. Gholami, S. Zhe, R. M. Kirby, and M. W. Mahoney, “Characterizing possible failure modes in physics-informed neural networks,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 34, 2021, pp. 26548–26 560. [Online]. Available: https://arxiv.org/abs/2109.01050
  12. [12]L. Lu, X. Meng, Z. Mao, and G. E. Karniadakis, “DeepXDE: A deep learning library for solving differential equations,” SIAM Review, vol. 63, no. 1, pp. 208–228, 2021.DOI
  13. [13]L. Liu and W. Cai, “Multiscale DeepONet for nonlinear operators in oscillatory function spaces for building seismic wave responses,” Nov. 2021. [Online]. Available: http://arxiv.org/abs/2111.04860
  14. [14]G.-L. Goodship, S. O’Sullivan, and L. Miralles-Pechuán, “Dynamic Heuristic Optimization in High-Order Runge–Kutta Schemes Using Reinforcement Learning and Genetic Algorithms,” IEEE Access, vol. 13, pp. 173752–173767, 2025. [Online]. Available: https://ieeexplore.ieee.org/document/11187364/
  15. [15]S. Ouala, L. Debreu, A. Pascual, B. Chapron, F. Collard, L. Gaultier, and R. Fablet, “Learning Runge-Kutta Integration Schemes for ODE Simulation and Identification,” May 2021, arXiv:2105.04999 [math.NA]. [Online]. Available: http://arxiv.org/abs/2105.04999
  16. [16]Y. Liu, J. N. Kutz, and S. L. Brunton, “Hierarchical deep learning of multiscale differential equation time-steppers,” Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, vol. 380, no. 2229, p. 20210200, 2022. [Online]. Available: https://doi.org/10.1098/rsta.2021.0200
  17. [17]M. Dellnitz, E. Hüllermeier, M. Lücke, S. Ober-Blöbaum, C. Offen, S. Peitz, and K. Pfannschmidt, “Efficient Time-Stepping for Numerical Integration Using Reinforcement Learning,” SIAM Journal on Scientific Computing, vol. 45, no. 2, pp. A579–A595, Apr. 2023. [Online]. Available: https://epubs.siam.org/doi/10.1137/21M1412682DOI
  18. [18]D. M. Riley, A. Stathas, D. Gutiérrez-Oribio, and I. Stefanou, “Reinforcement Learning-based adaptive time-integration for nonsmooth dynamics,” Machine Learning for Computational Science and Engineering, vol. 1, no. 2, p. 44, Dec. 2025. [Online]. Available: https://link.springer.com/10.1007/s44379-025-00048-6DOI
  19. [19]Q. Cao, S. Goswami, and G. E. Karniadakis, “LNO: Laplace Neural Operator for Solving Differential Equations,” May 2023, arXiv:2303.10528 [cs.LG]. [Online]. Available: http://arxiv.org/abs/2303.10528
  20. [20]G. Li, S. Ran, W. Yang, and L. Hong, “Improving generalization ability of deep-learning-based ODE solvers using continuous dependence,” npj Artificial Intelligence, vol. 1, no. 1, p. 22, Sep. 2025. [Online]. Available: https://www.nature.com/articles/s44387-025-00026-6DOI
  21. [21]G. Söderlind, “Time-step selection algorithms: Adaptivity, control, and signal processing,” Applied Numerical Mathematics, vol. 56, no. 3-4, pp. 488–502, Mar. 2006. [Online]. Available: https://linkinghub.elsevier.com/retrieve/pii/S01689274050000954DOI
  22. [22]R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed. Cambridge, MA: MIT Press, 2018.
  23. [23]J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, “Proximal Policy Optimization Algorithms,” Aug. 2017, arXiv:1707.06347 [cs.LG]. [Online]. Available: http://arxiv.org/abs/1707.06347
  24. [24]J. Schulman, P. Moritz, S. Levine, M. Jordan, and P. Abbeel, “High-Dimensional Continuous Control Using Generalized Advantage Estimation,” Oct. 2018, arXiv:1506.02438 [cs.LG]. [Online]. Available: http://arxiv.org/abs/1506.02438
  25. [25]L. Zintgraf, S. Schulze, C. Lu, L. Feng, M. Igl, K. Shiarlis, Y. Gal, K. Hofmann, and S. Whiteson, “VariBAD: Variational bayes-adaptive deep RL via meta-learning,” in International Conference on Learning Representations (ICLR), 2020. [Online]. Available: https://arxiv.org/abs/1910.08348
  26. [26]B. Van Der Pol, “LXXXVIII. On “relaxation-oscillations”,” The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, vol. 2, no. 11, pp. 978–992, Nov. 1926. [Online]. Available: http://www.tandfonline.com/doi/abs/10.1080/14786442608564127DOI
  27. [27]I. Prigogine and R. Lefever, “Symmetry Breaking Instabilities in Dissipative Systems. II,” The Journal of Chemical Physics, vol. 48, no. 4, pp. 1695–1700, Feb. 1968. [Online]. Available: https://pubs.aip.org/jcp/article/48/4/1695/83930/Symmetry-Breaking-Instabilities-in-DissipativeDOI
  28. [28]P. Kidger, “On Neural Differential Equations,” Feb. 2022, arXiv:2202.02435 [cs.LG]. [Online]. Available: http://arxiv.org/abs/2202.02435
  29. [29]M. Andrychowicz, A. Raichuk, P. Stańczyk, M. Orsini, S. Girgin, R. Marinier, L. Hussenot, M. Geist, O. Pietquin, M. Malinowski, S. Gelly, and O. Bachem, “What Matters In On-Policy Reinforcement Learning? A Large-Scale Empirical Study,” Jun. 2020, arXiv:2006.05990 [cs.LG]. [Online]. Available: http://arxiv.org/abs/2006.05990
  30. [30]I. Greenberg, S. Mannor, G. Chechik, and E. Meirom, “Train hard, fight easy: Robust meta reinforcement learning,” in Advances in Neural Information Processing Systems (NeurIPS), 2023. [Online]. Available: https://arxiv.org/abs/2301.11147

Machine contribution statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How machine contributions are recorded

Paper details

Citation

Cite
Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Contents

Pick where to look, or just type