Discretize-Optimize vs. Optimize-Discretize for Time-Series Regression and Continuous Normalizing Flows

Derek Onken, Lars RuthottoarXiv 2020 · arXiv

Introduction

Neural Ordinary Differential Equations (Neural ODEs) represent a paradigm shift in deep learning, conceptualizing hidden layers as a continuous transformation or "flow" of data. While this approach offers elegant mathematical properties, training these models is computationally intensive. The prevailing standard, the Optimize-Discretize (Opt-Disc) approach (often called the adjoint method), prioritizes memory efficiency but frequently suffers from slow convergence and numerical instability.

This paper challenges the dominance of the adjoint method by advocating for Discretize-Optimize (Disc-Opt). By treating the ODE solver's steps as fixed layers and applying standard backpropagation, the authors demonstrate significant improvements in gradient accuracy and training speed—achieving up to a 97% reduction in training time in some cases.

The Core Conflict: Opt-Disc vs. Disc-Opt

The fundamental difference between these two approaches lies in the sequence of operations:

  1. Optimize-Discretize (The Adjoint Method): Gradients are derived from the continuous ODE formulation. A separate "adjoint" ODE is solved backward in time to compute these gradients. While memory-efficient (it doesn't store intermediate states), it relies on numerical integrators to match the forward and backward passes. If the solver isn't highly accurate, the computed gradient can "drift" away from the true gradient.
  2. Discretize-Optimize (Backprop through the Solver): The continuous ODE is first converted into a discrete sequence of operations using a numerical scheme (e.g., Runge-Kutta). This discrete model is then treated as a standard deep neural network, and gradients are computed via automatic differentiation (backpropagation).
Conceptual framework of a Continuous Normalizing Flow (CNF) mapping an initial distribution through state and control layers.

Methodology and Innovations

Beyond the basic comparison, the authors introduce techniques to mitigate the traditional downsides of Disc-Opt:

  • Re-discretization: To ensure mathematical properties like invertibility in Normalizing Flows, models can be trained on a coarse, fast grid and then evaluated on a finer, more accurate grid during inference.
  • Multilevel Training: Borrowing from multigrid methods, training begins with a very coarse discretization and gradually increases the number of steps, accelerating early-stage convergence.

Key Insights: The "Ghost Gradient" Problem

A critical finding is the existence of "ghost gradients" in the Opt-Disc method. Because the gradient is derived from a continuous ideal but computed using a numerical solver with finite tolerance, the resulting vector may not actually be a descent direction for the discretized function used in the forward pass. In contrast, Disc-Opt provides an "exact" gradient for the specific discretized model being optimized, leading to more stable and reliable training trajectories.

Experimental Results

The study evaluated these methods across synthetic time-series, Gaussian mixtures, and high-dimensional benchmarks including the UCI Machine Learning Repository and BSDS300.

Training progress of the Discretize-Optimize (Disc-Opt) method on a time-series task, showing rapid convergence and low loss by iteration 300.

The results were stark:

  • Massive Speedups: Disc-Opt reduced training costs in six out of seven problems, with speedups ranging from 39% to 97%.
  • Scalability: On the BSDS300 dataset, training time dropped from nine days (Opt-Disc) to less than 14 hours (Disc-Opt).
  • Performance Parity: Despite being much faster, Disc-Opt models achieved test losses comparable to or better than the state-of-the-art FFJORD implementation.

Conclusion

While the adjoint method remains valuable for memory-constrained environments, this research suggests that Discretize-Optimize should be the default choice for many time-series and density estimation tasks. By providing more reliable gradients and enabling massive speedups without sacrificing accuracy, Disc-Opt addresses the primary bottleneck in the practical application of continuous-depth models.

Summary updated

BibTeX
@misc{onken2020discretize,
  author = {Derek Onken and Lars Ruthotto},
  title = {{Discretize-Optimize vs. Optimize-Discretize for Time-Series Regression and Continuous Normalizing Flows}},
  year = {2020},
  eprint = {2005.13420},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.13420},
}
Figure