Simulation-Free Training of Neural ODEs on Paired Data

Semin Kim, Jaehoon Yoo, Jinwoo Kim, Yeonwoo Cha, Saehoon Kim, Seunghoon Hong

TL;DR

This paper introduces a method to train Neural Ordinary Differential Equations (NODEs) for supervised learning without the need for expensive numerical ODE solvers during training. By jointly learning a latent embedding space and a flow matching objective, the authors "untangle" crossing trajectories. This enables fast, stable training and high-performance inference even with very few function evaluations.

The Problem: Crossing Trajectories in Flow Matching

Neural ODEs (NODEs) are a powerful class of continuous-depth models that treat neural network layers as steps in a differential equation. While they are parameter-efficient and offer a flexible trade-off between speed and accuracy, they are notoriously difficult to train. Standard training requires an ODE solver to simulate the system's evolution, which is slow, memory-intensive, and numerically unstable.

A newer technique called Flow Matching (FM) allows for "simulation-free" training by directly regressing the model to a predefined velocity field. However, FM has mostly been used for generative modeling. When applied to supervised tasks with fixed input-output pairs $(x, y)$, a simple linear path between data points often results in "crossing trajectories." Because ODEs are deterministic, a single point in space cannot have two different velocities at the same time. Thus, standard flow matching fails to learn these conflicting paths, leading to poor performance.

Comparison of trajectories: Standard Flow Matching fails due to crossing paths, while the proposed method learns a non-crossing embedding space.

Methods: End-to-End Latent Flow Matching

To solve the crossing trajectory problem, the authors propose End-to-End Latent Flow Matching. Instead of matching the flow in the raw data space, they map inputs and labels into a shared embedding space where trajectories can be safely untangled.

  1. Learnable Encoders: A data encoder $f_\phi$ and a label encoder $g_\varphi$ project the input pairs into a latent space.
  2. Latent Flow Matching: The flow matching objective is applied in this embedding space, typically assuming simple linear dynamics ($z_t = (1-t)z_0 + t z_1$).
  3. Joint Optimization: The encoders and the dynamics function $h_\theta$ are trained together. To prevent the embeddings from collapsing to a single point (a trivial solution), they add a Label Autoencoding Loss, ensuring the label embedding can be decoded back to the original label $y$ via a decoder $d_\psi$.
  4. Refined Training: Specific techniques, like explicitly sampling the starting time $t=0$ and adding noise to label embeddings, are used to improve robustness and generalization.
Overview of the framework: Data and labels are projected into an embedding space where target trajectories are forced to be non-crossing.

Key Insights and Results

The method was validated across several standard benchmarks, including image classification (MNIST, SVHN, CIFAR10) and various UCI regression datasets.

  • The "Untangling" Effect: The core insight is that the model can use the extra degrees of freedom in the embedding space to rearrange data points such that their paths to their respective labels never cross. This makes the dynamics much easier for the NODE to learn.
  • Simulation-Free Efficiency: By using flow matching, the training cost per step is reduced to a single function evaluation (NFE=1), compared to dozens or hundreds for standard NODEs. This results in a training throughput that is often 10x to 100x faster because it avoids the ODE solver during backpropagation.
  • Straight Trajectories for Fast Inference: Because the model is trained to follow a linear path in the latent space, it can often produce accurate predictions during inference using a simple 1-step Euler solver. On CIFAR10, it achieved ~88.9% accuracy with just 1 inference step, drastically reducing computational cost at deployment.
  • Stability: Standard NODE training often suffers from unstable loss curves and NFE explosions. This latent flow matching method provides a much smoother and more predictable training process.

Limitations and Future Work

While highly effective, the current work primarily relies on a fixed linear dynamics assumption. The authors suggest that introducing learnable target dynamics could further improve performance for highly complex data. Additionally, the paper notes a conceptual connection to Koopman operator theory, which seeks linear representations of nonlinear systems. Exploring this link more deeply could provide stronger theoretical foundations for why latent flow matching is so effective, potentially opening doors for broader applications like model compression or knowledge distillation.

Summary updated

BibTeX
@inproceedings{kim2024simulation,
  author = {Semin Kim and Jaehoon Yoo and Jinwoo Kim and Yeonwoo Cha and Saehoon Kim and Seunghoon Hong},
  title = {{Simulation-Free Training of Neural ODEs on Paired Data}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=GOgKhunkfw},
}
Figure