TL;DR
Training Neural Ordinary Differential Equations (Neural ODEs) usually forces an uncomfortable trade-off between running out of memory, running out of patience, or settling for unstable approximate gradients. This paper introduces a clever mathematical wrapper that turns any standard single-step ODE solver into an algebraically reversible one, letting you reconstruct the forward pass on the fly during backpropagation. The result is exact gradients in $O(n)$ time and $O(1)$ memory—slashing training times in half while using over $10\times$ less memory than state-of-the-art checkpointing.
What Problem Does This Paper Address?
Imagine a neural network where, instead of passing data through discrete layers, your hidden state flows continuously through time, governed by an Ordinary Differential Equation (ODE) parameterized by a neural network. That’s a Neural ODE—a fantastic tool for modeling physics and irregularly sampled time series.
To train a Neural ODE, you have to backpropagate through the numerical solver that computes this trajectory. Historically, you had two main options:
- Optimize-then-discretize (the continuous adjoint method): Low memory, because you solve a second ODE backward in time instead of saving intermediate states. Unfortunately, numerical approximations here often lead to inaccurate gradients and unstable training.
- Discretize-then-optimize: Backpropagate directly through the solver’s internal math operations. This gives exact gradients, which makes training behave nicely, but storing every step of a long trajectory blows up GPU memory.
To make exact gradients feasible, the standard state-of-the-art workaround is recursive checkpointing—saving only $O(\sqrt{n})$ strategic snapshots along an $n$-step trajectory and recomputing the gaps during the backward pass, which bumps runtime to $O(n \log n)$.
What if we didn't have to store any intermediate states, nor suffer from approximate gradients? A few algebraically reversible solvers have tried this before—allowing step $n$ to be reconstructed in closed form from step $n+1$—achieving $O(1)$ memory and $O(n)$ time. However, existing reversible solvers were stuck at low accuracy (second-order) and suffered from terrible numerical stability (literally nowhere linearly stable), limiting their practical use.
Methods
McCallum and Foster introduce a general recipe that takes any standard single-step ODE solver $\Psi_h$ (like Euler, Midpoint, or classic 4th-order Runge-Kutta) with step size $h$, and wraps it into an algebraically reversible system.
Instead of tracking a single state $y_n$, the method evolves a coupled pair of states $(y_n, z_n)$, initialized identically at $y_0 = z_0 = y(0)$:
- Advance $y_{n+1}$ using a convex combination of $y_n$ and $z_n$ (controlled by a coupling parameter $\lambda \in (0, 1]$), plus a forward step $\Psi_h(t_n, z_n)$.
- Update the auxiliary state $z_{n+1}$ by subtracting a local backward step $\Psi_{-h}(t_{n+1}, y_{n+1})$ from $z_n$.
Because $y_{n+1}$ is already known at the end of the step, reversing the process during backpropagation is trivial algebra: you add $\Psi_{-h}(t_{n+1}, y_{n+1})$ back to $z_{n+1}$ to recover $z_n$ exactly, and then invert the first equation to recover $y_n$. You only ever hold the final terminal state in memory, reconstructing the computation graph step-by-step on the fly to compute exact vector-Jacobian products via standard automatic differentiation. Furthermore, if the base solver $\Psi_h$ supports adaptive step-sizing (like Bosh3), the reversible wrapper seamlessly inherits its local error estimates.
Datasets
No new benchmarks are introduced; the authors evaluate their solvers across six established scientific modeling and time-series benchmarks:
- Chandrasekhar’s White Dwarf Equation: Simulated data modeling stellar density as a non-linear, "time"-dependent ODE.
- Coupled Oscillators & Chaotic Double Pendulum: Real-world physical system trajectories from Schmidt et al. (2009).
- PhysioNet Sepsis (2019 Challenge): Irregularly sampled, partially observed clinical patient data (predicting sepsis from 72 hours of measurements).
- EigenWorms (UEA Archive): Very long multivariate time series (length 17,984) tracking roundworm movements across 5 classes.
- Speech Commands: Audio recordings of 10 spoken words, preprocessed into 20-channel mel-frequency cepstrum time series.
Key Insights and Ideas
- Plug-and-play high-order accuracy: Previous reversible solvers had low-order convergence baked into their architecture. Here, the reversible scheme directly inherits the $k$-th order convergence of whatever base solver $\Psi$ you plug in—meaning you get a reversible RK4 just by dropping RK4 into the wrapper.
- The magic of the coupling parameter $\lambda$: The state-coupling looks a lot like Reversible ResNets (RevNets) or normalizing flows, except for $\lambda$. The authors prove that $\lambda$ is the secret sauce for numerical stability: previous reversible ODE solvers had zero linear stability regions, whereas tuning $\lambda < 1$ creates a genuine, non-zero stability region.
- The forward-backward stability tug-of-war: Decreasing $\lambda$ improves stability on the forward pass, but introduces $\lambda^{-1}$ terms on the backward pass that hurt reverse stability. Keeping $\lambda$ very close to—but strictly less than—1 (specifically $\lambda \in [0.99, 0.999]$) hits the sweet spot.
Key Results
Because gradients are exact, test accuracy and final losses match recursive checkpointing across the board—the story is all about speed and memory (where the reversible solver's augmented state $\{y_n, z_n\}$ equals the memory footprint of just $c=2$ checkpoints):
- Latent Dynamics: On Chandrasekhar's equation, reversible solvers are at least $2.5\times$ faster than optimal checkpointing ($c=44$) while using $22\times$ less memory—and over $100\times$ faster at equal memory ($c=2$). On Coupled Oscillators, it is over $2\times$ faster with $15.5\times$ less memory.
- Time Series (CDEs & RDEs): On PhysioNet Sepsis (Neural CDE), it matches test AUC (~87.7% with RK4) while cutting runtime by $2\times$ and memory by $5.5\times$. On EigenWorms (Neural RDE), it runs over $2\times$ faster using up to $23\times$ less memory.
- Adaptive Step Sizes: Using adaptive Bosh3 on the chaotic double pendulum, reversible backprop is $2.9\times$ faster with $16\times$ less memory ($37\times$ faster at equal memory). On Speech Commands, it achieves ~90.9% accuracy in 3.28 hours (at $c=2$ memory), beating checkpointing at both $c=16$ (10.5 hours) and $c=128$ (5.34 hours, $64\times$ more memory). Remarkably, the reversible solver takes nearly the exact same number of adaptive steps (~706 vs ~695) despite a smaller theoretical stability region.
Limitations and Future Work
- 2x Forward Cost: Every reversible step evaluates both $\Psi_h$ and $\Psi_{-h}$, doubling the cost of the forward pass compared to a standard solver—though during training, this overhead is completely dwarfed by the massive savings in backpropagation.
- Reduced Stability Region: While strictly more stable than prior reversible solvers, the linear stability region is still smaller than that of the underlying base solver, leaving room for future mathematical improvements.
- Extensions to SDEs and PDEs: The authors note their framework naturally extends to Stochastic Differential Equations (when paired with virtual Brownian trees to reconstruct random noise) and semi-discrete Partial Differential Equations (PDEs), where $O(1)$ memory could be transformative for finely discretized spatial grids.
Summary updated