Source-linked AI summary

How to train your neural ODE: the world of Jacobian and kinetic regularization

Chris Finlay, Jörn-Henrik Jacobsen, Levon Nurbekyan, Adam M Oberman

arXiv:2002.02798v3stat.MLcs.LG

TL;DR

Neural ODE training can be prohibitively slow because learned dynamics may force adaptive solvers to take many evaluations. The paper introduces RNODE, combining optimal-transport-inspired kinetic and Jacobian regularization to encourage well-behaved dynamics. RNODE matches baseline performance while reducing wall-clock training time, though kinetic regularization alone guarantees regularity only on training trajectories.

  • Problem

    Neural ODEs can take prohibitively long to train because unconstrained learned dynamics may be poorly conditioned for numerical integration.

  • Method

    RNODE modifies FFJORD with kinetic-energy and Jacobian regularization derived from an optimal-transport viewpoint.

  • Results

    RNODE achieves the same performance as the baseline while reducing wall-clock training time by many hours or even days.

  • Takeaways & Limitations

    Regularized neural ODEs require fewer discretizations and can enable fixed-grid solvers during training, bringing neural ODEs closer to large-scale applications.

  • Takeaways & Limitations

    Kinetic-energy regularization guarantees regularity only on training-data trajectories, so flows may remain irregular on off-distribution or perturbed inputs.

Abstract

from arXiv · show

Training neural ODEs on large datasets has not been tractable due to the necessity of allowing the adaptive numerical ODE solver to refine its step size to very small values. In practice this leads to dynamics equivalent to many hundreds or even thousands of layers. In this paper, we overcome this apparent difficulty by introducing a theoretically-grounded combination of both optimal transport and stability regularizations which encourage neural ODEs to prefer simpler dynamics out of all the dynamics that solve a problem well. Simpler dynamics lead to faster convergence and to fewer discretizations of the solver, considerably decreasing wall-clock time without loss in performance. Our approach allows us to train neural ODE-based generative models to the same performance as the unregularized dynamics, with significant reductions in training time. This brings neural ODEs closer to practical relevance in large-scale applications.

1. Introduction

Neural ODEs connect dynamical systems with neural networks, offering flexible continuous-depth models but often requiring prohibitively long training. RNODE addresses this bottleneck by regularizing learned dynamics to achieve faster training without performance loss.

  • Neural ODEs use adaptive ODE solvers to define network dynamics without fixing the number of layers beforehand.This provides a continuous-time generalization of residual networks and permits flexible model depth.
  • Prohibitively long training time remains a major obstacle to the widespread adoption of neural ODEs.The computational burden arises despite their memory efficiency.
  • RNODE regularizes learned dynamics using two theoretically motivated optimal-transport-based penalties.The penalties encourage well-behaved dynamics rather than irregular trajectories that merely minimize the objective.
  • RNODE achieves the same performance as the baseline while reducing wall-clock training time by many hours or even days.The reported result motivates neural ODE deployment on large-scale datasets.

2. Neural ODEs & Continuous normalizing flows

Neural ODEs provide adaptive, memory-efficient continuous-depth models and support continuous normalizing flows, but unconstrained flows can be irregular and costly to integrate. The paper motivates kinetic and Jacobian regularization to promote numerically easier trajectories and speed training.

  • Neural ODEs: Neural ODEs replace fixed-depth residual updates with dynamics solved by an adaptive ODE solver that chooses step sizes on the fly.Their adaptive nature avoids specifying network depth in advance.
  • Neural ODEs: Neural ODEs can offer smaller training memory footprints than standard ResNets, but their long training time is an apparent drawback.They are also presented as flexible models for generative modeling and density estimation.
  • Continuous normalizing flows: Continuous normalizing flows parameterize distributions with a vector field and evaluate likelihood through the solution map and its Jacobian determinant.The change-of-variables formulation uses a known terminal distribution q and the transformed point z(x,T).
  • Continuous normalizing flows: The Jacobian determinant can be handled through an identity relating its time derivative to the vector-field divergence.Divergence is used as the tractable quantity in the continuous-flow likelihood calculation.
  • The need for regularity: Likelihood-maximizing FFJORD vector fields are non-unique, and some can have rapidly varying local trajectories and non-constant speed.Such poorly conditioned dynamics create numerical-integration difficulties and correlate with more adaptive-solver steps.
  • The need for regularity: The proposed regularizers penalize travel distance through kinetic energy and penalize the vector-field Jacobian.Together they encourage straight, constant-speed paths and nearly constant force, producing trajectories that are easier to integrate.

3. Optimal transport maps & Benamou-Brenier

The paper connects continuous normalizing flows to the Benamou–Brenier optimal transport formulation. Kinetic-energy regularization therefore favors flows whose particles move along straight paths at constant speed, reducing numerical solution effort.

  • Continuous normalizing flows closely resemble optimal transport between source and target densities.
  • The Benamou–Brenier formulation replaces direct transport-map optimization with flow optimization under a vector field.The flow is constrained to conserve probability mass while minimizing kinetic energy.
  • Optimal flows move particles along straight lines at constant speed and can have a unique solution map under suitable distributional conditions.
  • Because optimal trajectories are simple, the resulting ODE can be solved numerically with minimal computational effort.
  • For sampled data mapped toward a unit normal, the discrete optimal-transport formulation motivates adding kinetic-energy regularization to continuous normalizing flows.The paper identifies this regularized discrete transport problem with the FFJORD optimization setting.

4. Unbiased Frobenius norm regularization of the Jacobian

The paper regularizes the Jacobian of the learned vector field because large Jacobian norms can make adaptive numerical integration expensive. It estimates the Frobenius penalty efficiently through Monte Carlo and integrates it into RNODE training.

  • Large Jacobian norms can increase numerical integration error and force an adaptive solver to make many function evaluations.The paper reports a strong empirical correlation between function evaluations and Jacobian norm in CIFAR10 FFJORD training.
  • RNODE training uses Jacobian Frobenius-norm regularization alongside kinetic-energy regularization.The algorithm samples Gaussian noise, solves the augmented dynamics, computes adjoint gradients, and updates the parameters.
  • Kinetic-energy regularization alone guarantees regularity only along training-data trajectories, leaving off-distribution or perturbed inputs as a generalization boundary.The paper motivates Jacobian regularization as an additional constraint on map regularity.
  • The Frobenius norm is the Euclidean norm of a matrix’s singular values and can be estimated using a Monte Carlo trace estimator.
  • The Jacobian penalty is available with essentially no extra computational cost because FFJORD already computes the required vector–Jacobian product for divergence estimation.

5. Algorithm description

RNODE modifies the FFJORD objective by adding kinetic-energy and Jacobian regularization penalties, computed within an augmented ODE system. The method retains FFJORD’s adjoint-gradient training procedure and achieves comparable likelihood with substantially faster training.

  • RNODE modifies the FFJORD continuous normalizing-flow objective with kinetic-energy and Jacobian regularization penalties.RNODE is the paper’s shorthand for regularized neural ODE.
  • RNODE has comparable log-likelihood to FFJORD while being significantly faster in the reported validation-image experiments.
  • The objective averages regularization terms over samples and input dimensions so their strengths do not depend on dataset or dimension size.
  • An augmented ODE simultaneously computes kinetic energy, the log determinant of the Jacobian, and the integrated Jacobian Frobenius norm.
  • The divergence and Jacobian penalties use Monte Carlo trace estimates, while kinetic energy requires only a dot product.The implementation therefore scales linearly with the number of solver time steps, as in FFJORD.

6. Experimental design

The experiments evaluate RNODE on four image datasets using FFJORD-like architectures and compare adaptive and fixed-grid ODE solvers. The study also examines how each regularizer affects flow regularity and solver evaluations.

  • Experiments use CIFAR10, MNIST, downsampled ImageNet64, and 5bit CelebA-HQ256 with an architecture matching Grathwohl et al. (2019).
  • The ablation compares Jacobian Frobenius norm, kinetic energy, and function evaluations during fixed-step MNIST training.Without regularization, training becomes numerically unstable just before 50 epochs; each regularizer controls the Jacobian norm.
  • The vector field uses piecewise-constant network parameters with 10, 14, 18, and 26 temporal pieces for MNIST, CIFAR10, ImageNet64, and CelebA-HQ, respectively.
  • Training uses single-GPU runs for MNIST and CIFAR10, while the two larger datasets use four GPUs with dataset-specific batch sizes.
  • FFJORD requires an adaptive Runge–Kutta 4(5) solver, whereas RNODE can use a fixed-grid four-stage Runge–Kutta solver on the smaller datasets.RNODE also reduces function evaluations for adaptive solvers and uses the same adaptive solver as FFJORD at test time.
  • RNODE is initialized as the identity map, whose transport cost and Frobenius norm are zero and which is straightforward for numerical solvers.

7. Results

RNODE maintains generative-model performance while substantially reducing training time, and regularization stabilizes dynamics by controlling Jacobian growth and particle travel.

  • 2.8x faster than FFJORD on both datasets while achieving or surpassing FFJORD performance.The comparison includes RNODE, vanilla FFJORD, and originally reported FFJORD results.
  • Vanilla FFJORD could not be trained on ImageNet64 because the adaptive solver’s time step suffered numerical underflow.Increasing solver error tolerance would bias validation log-likelihood estimates.
  • 7.1. Ablation study on MNIST: Without regularization, training dynamics become numerically unstable and fail just under 50 epochs as the Jacobian norm grows large.Each regularizer controls the Jacobian norm, while the Jacobian regularizer is better suited to this task.
  • 7.1. Ablation study on MNIST: The kinetic-energy regularizer encourages flows to travel a minimal distance, while the Jacobian norm regularizer also beneficially affects particle travel.The ablation results empirically support the theoretical reasoning behind both regularizers.

8. Previous generative flows inspired by optimal transport

Earlier generative-flow approaches connect neural ODE dynamics to optimal transport through scalar potential gradients, but this paper avoids that formulation because it is computationally expensive.

  • Zhang et al. define neural ODE flows whose dynamics are gradients of scalar potential functions, connecting them to optimal transport.The optimal transport map is itself the gradient of a convex potential function.
  • Yang and Karniadakis likewise define optimal transport through a scalar potential gradient and enforce it by penalizing the objective.
  • The paper does not implement scalar-potential flows because computing the Laplacian and parameter gradients would require triple backpropagation.Ruthotto et al. avoid this issue using special residual-network structure to compute the Laplacian efficiently.

9. Discussion

RNODE is simple to implement with minimal added computation and little hyperparameter tuning, but its classification benefits remain untested.

  • RNODE augments the ODE dynamics with two scalar equations for kinetic energy and the Jacobian penalty.In FFJORD, intermediary terms used for divergence estimation can be recycled, making the extra evaluation cost minimal.
  • Classification was not considered, although the authors believe RNODE may similarly improve training time and classifier regularity.The expected computational overhead is marginal relative to the anticipated training-time gains.

10. Conclusion

The paper presents RNODE as a theoretically motivated regularization method that makes neural ODE dynamics easier to integrate, enabling faster training while preserving empirical performance.

  • RNODE encourages neural ODEs to learn well-behaved dynamics that require fewer discretizations during numerical integration.
  • In many circumstances, RNODE permits replacing adaptive solvers with more efficient fixed-grid solvers during training.
  • Rewriting the optimal-transport problem in Lagrangian coordinates connects continuous normalizing flows to transported source distributions.The flow map pushes the source distribution forward to the time-dependent distribution.
  • Because the terminal distribution constraint is difficult to implement directly in grid-free coordinates, the method introduces a penalty measuring deviation from the target distribution.The resulting objective can be expressed as an expectation over samples from the source distribution.

B. Additional results

The paper reports additional FFJORD RNODE evaluations on CelebA-HQ and ImageNet64, including generated samples and bits-per-dimension results. Model statistics and validation measurements are also provided for comparison.

  • Generated samples: Additional generated samples are presented for CelebA-HQ and ImageNet64.These are the two larger datasets considered in the additional-results evaluation.
  • Generated samples: Figures 7 and 8 show FFJORD RNODE generated-image quality on ImageNet-64 and CelebA-HQ, respectively.
  • Generated samples: Temperature annealing is used to generate visually appealing images, with T = 0.5, . . . , 1.
  • Quantitative evaluation: Table 2 reports validation bits/dim on clean and uniformly dequantized validation images, along with trainable model-parameter counts.Uniform variational dequantization perturbs validation images with uniform noise.
Loading 2002.02798v3…