Skip to main content
QUICK REVIEW

[Paper Review] Symplectic Adjoint Method for Exact Gradient of Neural ODE with Minimal Memory

Takashi Matsubara, Yuto Miyatake|arXiv (Cornell University)|Feb 19, 2021
Model Reduction and Neural NetworksPhysics and Astronomy36 references5 citations
TL;DR

This paper proposes the symplectic adjoint method, a novel approach for computing exact gradients in Neural ODEs using symplectic integrators to solve the adjoint system. By applying backpropagation only per neural network use and leveraging symplectic integration, the method achieves exact gradients with memory consumption proportional to the number of steps plus network size—significantly lower than backpropagation or checkpointing, while outperforming standard adjoint methods in speed and robustness to rounding errors.

ABSTRACT

A neural network model of a differential equation, namely neural ODE, has enabled the learning of continuous-time dynamical systems and probabilistic distributions with high accuracy. The neural ODE uses the same network repeatedly during a numerical integration. The memory consumption of the backpropagation algorithm is proportional to the number of uses times the network size. This is true even if a checkpointing scheme divides the computation graph into sub-graphs. Otherwise, the adjoint method obtains a gradient by a numerical integration backward in time. Although this method consumes memory only for a single network use, it requires high computational cost to suppress numerical errors. This study proposes the symplectic adjoint method, which is an adjoint method solved by a symplectic integrator. The symplectic adjoint method obtains the exact gradient (up to rounding error) with memory proportional to the number of uses plus the network size. The experimental results demonstrate that the symplectic adjoint method consumes much less memory than the naive backpropagation algorithm and checkpointing schemes, performs faster than the adjoint method, and is more robust to rounding errors.

Motivation & Objective

  • To address the high memory consumption of backpropagation and checkpointing schemes in training Neural ODEs.
  • To reduce computational cost and improve robustness to numerical errors in gradient computation for Neural ODEs.
  • To enable exact gradient computation in discrete time using symplectic integrators without requiring smaller step sizes.
  • To achieve memory efficiency comparable to the adjoint method while maintaining high accuracy and speed.
  • To provide a robust, scalable solution for training Neural ODEs on stiff or high-order systems, such as physical PDEs.

Proposed method

  • The method uses a symplectic integrator to solve the adjoint system backward in time, preserving geometric structure and enabling exact gradients up to rounding error.
  • Backpropagation is applied only to each individual use of the neural network $ f $, not to the full computation graph, reducing memory footprint.
  • Appropriate checkpoints are used to store intermediate states $ x_n $ and internal stage values $ X_{n,i} $, minimizing memory overhead.
  • The approach is compatible with any Runge–Kutta method and supports both explicit and implicit integrators.
  • The symplectic structure ensures numerical stability and reduces error accumulation during backward integration.
  • The method avoids the need for small step sizes in the adjoint integration, enabling faster computation than standard adjoint methods.

Experimental results

Research questions

  • RQ1Can a symplectic integrator be used to compute exact gradients in Neural ODEs with minimal memory overhead?
  • RQ2How does the memory consumption of the proposed method compare to backpropagation, checkpointing, and standard adjoint methods?
  • RQ3Does the symplectic adjoint method achieve faster computation than the standard adjoint method while maintaining gradient accuracy?
  • RQ4How robust is the method to rounding errors compared to traditional backpropagation and adjoint approaches?
  • RQ5Can the method effectively handle stiff or high-order systems such as the KdV and Cahn–Hilliard equations?

Key findings

  • The symplectic adjoint method achieves exact gradients (up to rounding error) using the same step size as forward integration, unlike standard adjoint methods that require smaller steps to control error.
  • Memory consumption is $ O(MN + s) $, where $ M $ is the number of components, $ N $ the number of time steps, and $ s $ the number of internal stages—dramatically lower than backpropagation ($ O(MNsL) $) and comparable to the adjoint method.
  • In experiments on the KdV equation, the method achieved an MSE of $ 1.61 \pm 4.00 \times 10^{-3} $ with only 79.8 MiB memory, outperforming the adjoint method in speed (162 ms/itr vs. 276 ms/itr).
  • For the Cahn–Hilliard system, the method achieved an MSE of $ 5.47 \pm 1.46 \times 10^{-6} $ with 80.3 MiB memory and 568 ms/itr, demonstrating robustness and efficiency on stiff systems.
  • The method is more robust to rounding errors than backpropagation and checkpointing schemes, as it computes gradients per integration stage rather than accumulating them over long graphs.
  • The symplectic adjoint method is faster than the standard adjoint method in practice because it avoids the need for small step sizes to suppress numerical errors.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.