Simulation-Free Training of Neural ODEs on Paired Data

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

Abstract

In this work, we investigate a method for simulation-free training of Neural Ordinary Differential Equations (NODEs) for learning deterministic mappings between paired data. Despite the analogy of NODEs as continuous-depth residual networks, their application in typical supervised learning tasks has not been popular, mainly due to the large number of function evaluations required by ODE solvers and numerical instability in gradient estimation. To alleviate this problem, we employ the flow matching framework for simulation-free training of NODEs, which directly regresses the parameterized dynamics function to a predefined target velocity field. Contrary to generative tasks, however, we show that applying flow matching directly between paired data can often lead to an ill-defined flow that breaks the coupling of the data pairs (e.g., due to crossing trajectories). We propose a simple extension that applies flow matching in the embedding space of data pairs, where the embeddings are learned jointly with the dynamic function to ensure the validity of the flow which is also easier to learn. We demonstrate the effectiveness of our method on both regression and classification tasks, where our method outperforms existing NODEs with a significantly lower number of function evaluations.

Introduction

Neural Ordinary Differential Equations (NODEs) represent a powerful paradigm of "continuous-depth" models, treating neural network layers as continuous transformations over time. While parameter-efficient and flexible, NODEs are notoriously slow to train because standard methods require an ODE solver to simulate the entire trajectory of data at every step. This leads to a high Number of Function Evaluations (NFEs) and potential numerical instability.

A promising alternative is flow matching, which enables "simulation-free" training by regressing the model directly onto a predefined velocity field. However, applying flow matching to paired data (e.g., $x \to y$ regression) presents a significant challenge: if straight-line paths are defined between every input $x$ and its label $y$, these paths often cross. Because standard ODEs cannot have crossing trajectories—as a single point cannot move in two directions simultaneously—the model fails to learn the correct mapping in the raw data space.

Comparison of trajectory learning across different methods. Standard Flow Matching (c) fails due to crossing trajectories, while the proposed method (d) achieves zero MSE with a single function evaluation by learning in an embedding space.

Methodology: End-to-End Latent Flow Matching

To resolve the crossing trajectory problem, we propose End-to-End Latent Flow Matching. Instead of matching flows in the raw data space, the model projects both the input $x$ and the label $y$ into a shared embedding space using learnable encoders ($f_\phi$ and $g_\varphi$).

Architecture of End-to-End Latent Flow Matching. Data and labels are mapped to an embedding space to resolve trajectory crossings present in the raw data space.

The architecture consists of three core components:

  1. Data & Label Encoders: These map inputs and labels to latent states $z_0$ and $z_1$, respectively.
  2. Dynamics Function ($h_\theta$): This learns the velocity field within the embedding space.
  3. Label Decoder ($d_\psi$): This maps the final latent state back to the original label space.

The training objective is a joint loss function comprising a Flow Matching Loss, which forces the dynamics function to follow a linear path between embeddings $z_0$ and $z_1$, and a Label Autoencoding Loss, which ensures consistency between the label encoder and decoder to prevent representation collapse. By learning the embeddings and the flow jointly, the model "arranges" the data in the latent space such that trajectories never cross, making the flow well-defined and computationally efficient.

Results and Discussion

The method was evaluated on image classification (MNIST, SVHN, CIFAR10) and various UCI regression datasets. Key findings include:

  • Computational Efficiency: The proposed method requires only 1 NFE per training step, compared to dozens or hundreds for standard NODEs. This results in a training throughput orders of magnitude higher (e.g., ~29 batches/sec vs ~0.9 batches/sec on MNIST).
  • Inference Speed: On complex datasets like SVHN and CIFAR10, the method achieves near-peak accuracy with just 1 or 2 inference steps, whereas baselines like RNODE require 20+ steps.
  • Performance: The method consistently outperformed conditional diffusion-based models (CARD) and other NODE variants, particularly in low-step regimes. The embedding space acts as a "traffic controller," resolving topological conflicts and allowing for straight, easy-to-learn trajectories.

Conclusion

This work demonstrates that latent flow matching effectively overcomes the limitations of traditional NODEs for supervised learning. By resolving trajectory crossings in an embedding space, we achieve simulation-free training and high-efficiency inference. Future research may explore learnable target dynamics to further enhance performance on highly complex data and investigate deeper theoretical links to Koopman operator theory.

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