Here is one of the most beautiful ideas in modern deep learning. You know how a Residual Network computes its output? Each layer takes the current hidden state and adds a small update: h(t+1) = h(t) + f(h(t), theta_t). The output of layer 6 is the input of layer 1, plus six small increments stacked on top of each other. Now squint at that formula. Does it remind you of anything from calculus?
It should. That is Euler's method — the simplest way to numerically solve a differential equation, with step size 1. Every ResNet you have ever trained was secretly doing numerical integration. The authors of this paper asked a question that seems obvious in hindsight: what if we took the step size to zero and the number of layers to infinity? Instead of a staircase of discrete layers, you get a smooth ramp — a continuous transformation governed by an ordinary differential equation.
This is not just a mathematical curiosity. It unlocks three practical superpowers. First, constant memory: you do not need to store intermediate layer activations for backprop because the adjoint method recomputes them on the fly. Second, adaptive computation: the ODE solver automatically decides how many steps to take based on how complex the dynamics are — simple inputs get fewer steps, hard inputs get more. Third, parameter efficiency: one set of parameters shared across continuous time, instead of separate weights per layer.
From ResNets to Neural ODEs: The Continuous Limit
A ResNet computes a sequence of discrete transformations: h(t+1) = h(t) + f(h(t), theta_t). Each layer adds a residual to the hidden state. What if we take infinitely many infinitesimal steps?
The Key Insight
A ResNet with residual connections is an Euler discretization of an ODE. Taking the continuous limit gives us a Neural ODE: instead of a fixed stack of layers, we have a continuous transformation parameterized by a neural network. The ODE solver replaces the layer stack.
The Euler Connection
Euler's method approximates an ODE dy/dt = f(y) as y(t+h) = y(t) + h*f(y(t)). A ResNet with step size h=1 is exactly this. Neural ODEs make this connection rigorous: use a proper ODE solver instead of a fixed Euler step, share parameters across continuous time instead of per-layer, and get constant memory for free.
Did You Know?
The connection between ResNets and ODEs was noticed by several groups around 2017-2018. Weinan E (Princeton) published influential work on the dynamical systems view of deep learning. But Chen et al. were the first to make it fully practical by solving the memory problem with the adjoint method and demonstrating competitive results on real tasks. The paper won the NeurIPS 2018 Best Paper award — the most prestigious recognition in machine learning.
Let us be precise about what a Neural ODE actually computes. Instead of specifying a discrete sequence of hidden layers, we parameterize the derivative of the hidden state using a neural network f. Given an input h(0), the output h(T) is the solution to an initial value problem: start at h(0) and follow the velocity field defined by f for time T. The answer is whatever state you end up at.
Think of it this way: the neural network f does not transform data directly. Instead, it defines a velocity at every point in space and time. If you are at position h and the clock reads t, then f(h, t, theta) tells you which direction to move and how fast. The ODE solver follows these instructions, tracing out a smooth curve from h(0) to h(T). The same parameters theta define the velocity everywhere — unlike a ResNet where each layer has its own independent parameters.
Why does this matter? Because the dynamics function f is shared across all times, a Neural ODE is dramatically more parameter-efficient. A 6-block ResNet has 6 separate parameter sets. A Neural ODE with equivalent representational power has just one. And because the ODE solver chooses how many steps to take, the effective depth is adaptive — not fixed at architecture design time.
Forward Pass
Given initial state h(0), integrate the ODE forward to time T. The ODE solver chooses how many steps to take — this is the effective "depth" of the network, and it varies per input.
Key Properties
- Constant memory: O(1) via adjoint method — does not grow with depth
- Adaptive depth: Solver decides computation per input — simple inputs are cheap
- Shared parameters: One f for all times — 3x fewer parameters than equivalent ResNet
- Invertible: Run ODE backward for exact inverse — free invertibility
The Inversion Superpower
Here is something ResNets cannot do easily: run backward. If you have h(T) and want to recover h(0), just integrate the ODE in reverse from T to 0. The same dynamics function f, the same parameters — just flip the direction of time. This free invertibility is what makes Neural ODEs so powerful for normalizing flows, where you need to map between distributions in both directions.
The ODE solver is the forward pass of a Neural ODE. It is not an approximation or a hack — it is a rigorous numerical method for computing the exact solution to the differential equation (up to solver tolerance). Different solvers offer different trade-offs between accuracy, speed, and stability, and choosing the right one is critical for both training and inference.
The paper uses Dormand-Prince (DOPRI5), a 5th-order adaptive step-size Runge-Kutta method that has been the workhorse of scientific computing for decades. Here is how it works: at each step, it computes two estimates of the next state — one 4th-order and one 5th-order. The difference between them estimates the local truncation error. If the error is too large, the step is rejected and retried with a smaller step size. If the error is tiny, the next step is made larger. This means the solver automatically takes big steps through smooth regions and tiny steps through turbulent ones.
Why not just use Euler's method with many small steps? Because Euler is 1st-order — halving the step size only halves the error. DOPRI5 is 5th-order — halving the step size reduces the error by a factor of 32. For the same accuracy, DOPRI5 needs far fewer function evaluations, which translates directly to fewer neural network forward passes and faster training.
ODE Solvers: How Neural ODEs Compute Forward Passes
Euler: Simplest method: use slope at current point. Error scales as O(h1).
Why Solvers Matter
The ODE solver is the forward pass of a Neural ODE. Higher-order solvers are more accurate per step but cost more function evaluations. Adaptive solvers like Dormand-Prince automatically adjust step size for efficiency and accuracy.
Why Adaptive Step Sizes Change Everything
Fixed-step solvers (Euler, RK4) use the same step size everywhere — they waste computation in smooth regions and may be inaccurate in complex ones. Adaptive solvers like DOPRI5 automatically use larger steps where the dynamics are smooth and smaller steps where they change rapidly. In practice, this means 5-10x fewer function evaluations for the same accuracy. Since each function evaluation is a neural network forward pass, this translates directly to 5-10x faster training and inference. The DOPRI5 solver is implemented in torchdiffeq, the library the authors released alongside the paper.
Here is the problem that almost killed Neural ODEs before they were born. To train a neural network, you need gradients. Standard backpropagation computes gradients by storing all intermediate activations and walking backward through them. But an ODE solver might take hundreds of internal steps during a single forward pass. Storing all those intermediate states would require enormous memory — potentially more than the entire GPU.
The adjoint sensitivity method solves this elegantly. It is a technique from optimal control theory (1960s!) that computes exact gradients with O(1) memory — constant memory regardless of how many solver steps are taken. The idea is beautiful in its simplicity: instead of storing the forward trajectory and walking backward through it, we define a new ODE — the adjoint equation — that computes the gradient by integrating backward in time.
Define the adjoint state a(t) = dL/dh(t) — how the loss changes with the hidden state at time t. The key insight: a(t) satisfies its own ODE: da/dt = -a(t)^T (df/dh). We can integrate this backward from t=T to t=0, simultaneously recomputing the forward state h(t) on the fly and accumulating parameter gradients. No stored activations. No checkpointing. Just solve three coupled ODEs backward: the adjoint, the state, and the parameter gradient.
The Adjoint Sensitivity Method: O(1) Memory Backpropagation
Forward pass: Integrate the ODE from t=0 to t=T using a numerical solver (Euler, Runge-Kutta, Dormand-Prince). The solver evaluates f(h(t), t, theta) at each step and advances the state.
Why the Adjoint Method Matters
The adjoint method enables constant-memory training of Neural ODEs. Without it, memory would scale with solver steps, making deep continuous models impractical. It computes exact gradients by solving an augmented ODE backward in time.
The Adjoint ODE
The adjoint evolves backward, tracking how the loss depends on the hidden state at each moment. Starting from a(T) = dL/dh(T) (the loss gradient at the final time), it propagates sensitivity information backward through the continuous dynamics. No intermediate states need to be stored — the state h(t) is recomputed during the backward pass.
Parameter Gradient
Parameter gradients are accumulated during the backward pass — they are the integral of the adjoint state times the parameter Jacobian over the entire time horizon. All three quantities (state, adjoint, param grad) are solved together in one backward integration. This is what makes O(1) memory possible.
The Memory Trade-off
The adjoint method trades compute for memory. Instead of storing N intermediate states (O(N) memory), it recomputes them during the backward pass (O(1) memory but ~2x compute). For a solver taking 100 steps, standard backprop stores 100 activation tensors. The adjoint stores just 3: the final state, the adjoint, and the parameter gradient accumulator. When your dynamics network has millions of parameters and the solver takes hundreds of steps, this memory saving is the difference between fitting on a GPU and running out of memory.
One of the paper's most impactful contributions was not just theoretical — it was a new way to build generative models. Traditional normalizing flows transform a simple distribution (like a Gaussian) into a complex one through a chain of carefully designed invertible layers. The catch? Each layer must be invertible with an efficiently computable Jacobian determinant. This severely restricts what architectures you can use — coupling layers, autoregressive transforms, and other constrained designs.
Continuous Normalizing Flows (CNFs) blow this restriction wide open. Since an ODE is automatically invertible (just reverse time), you can use any neural network architecture for the dynamics function f. No coupling layers. No autoregressive constraints. No architectural gymnastics to ensure invertibility. The ODE solver handles it all.
But wait — how do you compute the density? In discrete normalizing flows, you need the log-determinant of each layer's Jacobian, which costs O(D^3). The magic of CNFs comes from the instantaneous change of variables formula: the log-density changes at a rate given by just the trace of the Jacobian — O(D) instead of O(D^3). For D=1000 dimensions, that is a billion times cheaper. And the trace can be estimated stochastically using the Hutchinson estimator: just compute v^T (df/dz) v for a random vector v. One Jacobian-vector product instead of the full Jacobian matrix.
Continuous Normalizing Flows: Free-Form Density Transformation
Normalizing Flows transform a simple distribution (like a Gaussian) into a complex one through a chain of invertible transformations. Continuous Normalizing Flows (CNFs) replace the chain with a continuous ODE.
Advantages of Continuous Flows
Why Continuous Normalizing Flows Matter
CNFs provide exact log-likelihood computation with free-form architectures. No need for invertible coupling layers or autoregressive constraints. The ODE solver handles invertibility automatically, and the trace estimator keeps density computation cheap.
Free-Form Architecture
No invertibility constraints on f. Use any MLP, CNN, or attention network. The ODE solver guarantees invertibility by construction.
O(D) Log-Density
Only the trace of the Jacobian is needed, not the full determinant. Stochastic estimation via Hutchinson makes this even cheaper.
Exact Likelihood
No ELBO approximation needed. The change of variables gives exact log-likelihoods, enabling true maximum likelihood training.
Why CNFs Changed Generative Modeling
Before CNFs, normalizing flows required restrictive architectures to ensure invertibility and efficient Jacobian computation. CNFs removed both constraints: use any architecture for f, and compute densities with O(D) trace instead of O(D^3) determinant. This directly inspired FFJORD (Grathwohl et al., 2019) for practical large-scale flows, and later the probability flow ODE in score-based diffusion models (Song et al., 2020) — which powers modern image generators like Stable Diffusion.
A Neural ODE learns a vector field over the hidden state space. At every point, the network defines a velocity: which direction and how fast the state should move. The ODE solver traces trajectories through this field, and the collection of all possible trajectories is called the phase portrait — one of the most powerful tools in dynamical systems theory.
Understanding the phase portrait reveals what the model has actually learned. You can see fixed points (where the dynamics stop — these are attractors or repellers), limit cycles (closed loops — periodic behavior), and separatrices (boundaries between regions with qualitatively different behavior). A classification Neural ODE, for instance, learns a vector field that routes different classes into different regions of space.
But here is a fundamental constraint that limits what Neural ODEs can represent: by the Picard-Lindelof uniqueness theorem, two ODE trajectories starting from different initial conditions cannot cross in the same phase space. If two data points start at different positions, their trajectories will never pass through the same point at the same time. This means Neural ODEs preserve the topology of the input — they cannot untangle interleaved spirals or separate concentric circles. This is a real limitation, and it drove the development of Augmented Neural ODEs (which add extra dimensions to allow effective crossing).
Phase Portraits: Visualizing Neural ODE Dynamics
Stable Spiral
State spirals inward to a fixed point. Damped oscillation.
A Neural ODE learns a vector field like this. The network f(h, t, theta) defines how hidden states flow through the phase space. Different parameters create different dynamics.
Phase Portraits and Neural ODEs
The neural network in a Neural ODE defines a learned vector field. Each point in hidden space has a velocity determined by f(h, t, theta). The ODE solver traces trajectories through this field. Training adjusts the vector field to solve the task.
Expressiveness vs. Structure
The non-crossing constraint is both a limitation and a feature. It limits expressiveness (Neural ODEs cannot represent all homeomorphisms), but it also means the learned transformations are topology-preserving — smooth, continuous, and physically meaningful. For applications in physics simulation, molecular dynamics, and other domains where the underlying process is actually an ODE, this constraint is not a bug but a correct inductive bias.
The paper introduces the Latent ODE model — perhaps the most practically impactful contribution for real-world applications. The idea: combine a Variational Autoencoder (VAE) with a Neural ODE decoder. An encoder processes observations (potentially at completely irregular times) to produce a distribution over latent initial states. The Neural ODE decoder then evolves this state forward to generate predictions at any desired time.
Why is this so powerful? Consider medical data. A patient visits the hospital at random times. Their blood pressure is measured at 9am, temperature at 11am, blood test at 2pm tomorrow, another visit next week. Traditional RNNs treat these as a fixed-step sequence, discretizing time into bins and padding with zeros. But a Latent ODE models the patient's state as evolving continuously. Between observations, the hidden state follows the learned dynamics — no padding, no binning, no information loss. When an observation arrives, the state is updated with a GRU-like jump.
The encoder is an ODE-RNN: between observations, the hidden state evolves continuously according to a learned ODE. At observation times, it receives a discrete update. This explicitly models the passage of time between events — unlike a standard RNN where the hidden state is frozen between observations. The decoder then samples z(0) from the encoded distribution and integrates forward, producing a smooth trajectory that can be queried at any time point.
Latent ODEs: Continuous-Time Generative Models
A Latent ODE is a VAE where the decoder is a Neural ODE. An encoder (ODE-RNN) processes irregularly-spaced observations backward in time to produce a latent initial state z(0). A Neural ODE then evolves z(0) forward to generate predictions.
Latent ODEs for Time Series
Latent ODEs combine VAEs with Neural ODEs to handle irregularly-sampled time series. The encoder processes observations in reverse time, the decoder evolves the latent state forward with an ODE. This naturally handles missing data, irregular sampling, and extrapolation.
ODE-RNN vs Standard RNN
Between observations, an RNN's hidden state is frozen — it does not change no matter how much time passes. An ODE-RNN's hidden state evolves continuously according to the learned dynamics. Whether 5 minutes or 5 days pass between measurements, the state evolves appropriately. This is a fundamentally different and more principled model of temporal processes.
Natural Uncertainty
Because the Latent ODE is a variational model, it provides natural uncertainty estimates. Multiple samples from q(z0) produce different trajectories that diverge over time. Near observed data, the trajectories cluster tightly (low uncertainty). Far from data, they spread out (high uncertainty). This uncertainty quantification comes for free from the VAE framework.
Here is something no fixed-depth network can do: trade accuracy for speed at inference time by turning a single dial. In a Neural ODE, that dial is the solver's error tolerance. Tighter tolerances (e.g., 10^-5) mean more function evaluations (NFE), more computation, and higher accuracy. Looser tolerances (e.g., 10^-1) mean fewer evaluations, faster inference, and a controlled accuracy sacrifice.
The Number of Function Evaluations (NFE) is the effective depth of a Neural ODE. A ResNet-6 always has depth 6, whether the input is trivial or complex. A Neural ODE might use 8 evaluations for a simple input and 45 for a complex one — the adaptive solver automatically allocates more computation where it is needed. This is input-dependent adaptive computation without any architecture changes, conditional paths, or early-exit mechanisms. The solver just does it.
An interesting observation from the paper: NFE tends to increase during training as the model learns more complex dynamics. At initialization, the dynamics are nearly zero (random weights produce small outputs), so the solver needs few steps. As training progresses and the model learns to solve the task, the dynamics become more complex and the solver takes more steps. This can be problematic — later work on regularized Neural ODEs addresses this by penalizing the dynamics magnitude to keep NFE manageable.
The Speed-Accuracy Trade-off: NFE and Error Tolerance
Neural ODEs let you trade accuracy for speed at inference time. Tighter solver tolerances mean more Number of Function Evaluations (NFE)but higher accuracy. This is unique to continuous-depth models.
Fixed-Depth Networks
Neural ODEs
Adaptive Computation
The ODE solver adapts computation per input. Regions where the dynamics are smooth need fewer steps. Regions with sharp changes get more steps. This is automatic — no architecture search or conditional computation logic needed.
Practical NFE Numbers
In the paper's experiments, MNIST classification used about 20 NFE in the forward pass and ~26 NFE in the backward pass (adjoint). For comparison, a 6-layer ResNet always uses exactly 6 forward evaluations. The Neural ODE uses more function evaluations but with shared parameters, resulting in roughly 3x fewer total parameters (220K vs 600K) at comparable test error (0.42%). The speed-accuracy-memory trade-off is different from discrete networks, and understanding this triangle is key to using Neural ODEs effectively.
Training Neural ODEs requires careful attention to solver choice, tolerance settings, and regularization. The paper demonstrates results on three very different tasks — image classification, density estimation, and time series modeling — each requiring different training strategies. Let us look at the concrete numbers and learn what makes Neural ODE training succeed or fail.
MNIST Classification
Density Estimation (CNF)
Training Recipes That Work
Did You Know?
The paper also showed that Neural ODEs achieve lower test error than ResNets on MNIST with 3x fewer parameters. This was surprising — people expected continuous models to be less expressive than discrete ones. The secret is parameter sharing: instead of 6 independent transformation matrices, the ODE has one that is reused at every time step. This acts as a strong regularizer, preventing overfitting while maintaining expressiveness through the richness of the continuous trajectory.
Neural ODEs are elegant but have real limitations. Understanding these limitations is important not just for using the models correctly, but because they drove a wave of follow-up work that significantly expanded the continuous-depth model family. Every limitation spawned at least one new paper with a clever solution.
Core Limitations
Extensions That Fixed Each Limitation
The Connection to Diffusion Models
Neural ODEs directly inspired the probability flow ODE formulation of score-based diffusion models (Song et al., 2020). The key insight: the denoising process in a diffusion model can be modeled as an ODE whose velocity field depends on the learned score function. This means you can generate samples by solving an ODE — deterministically — rather than simulating a stochastic process. This connection between Neural ODEs and diffusion models is one of the most impactful legacies of the paper, since diffusion models now power state-of-the-art image, video, and audio generation.
Neural ODEs found their niche in domains where data is naturally continuous, where physics provides dynamical constraints, and where adaptive computation is valuable. They shine brightest when the underlying process you are modeling is actually governed by differential equations — which turns out to be surprisingly many real-world problems.
In scientific computing, Neural ODEs learn physical dynamics directly from data: planetary orbits, molecular interactions, fluid flows. Hamiltonian Neural Networks (a direct descendant) guarantee energy conservation by parameterizing the Hamiltonian rather than the vector field. In healthcare, Latent ODEs model patient disease trajectories from sparse clinical visits, predicting outcomes and treatment responses with proper uncertainty. In generative modeling, CNFs enabled the probability flow ODE that powers modern diffusion models.
Applications: Where Neural ODEs Shine
Irregular Time Series
Model data arriving at irregular intervals — medical records, sensor data, financial events.
Patient monitoring
Vital signs measured at random times. Latent ODE interpolates and predicts between measurements.
Climate data
Weather stations report at different frequencies. Neural ODE unifies multi-resolution data.
Financial events
Market events are asynchronous. ODE models continuous price dynamics from discrete trades.
Neural ODEs Excel When...
- - Data is continuous or irregularly sampled
- - Physical laws constrain the dynamics
- - Adaptive computation is valuable
- - Memory efficiency is critical
- - Exact likelihoods are needed
Neural ODEs Struggle When...
- - Data is inherently discrete (e.g., text)
- - Speed is more important than accuracy
- - Dynamics require discontinuities
- - High-dimensional state spaces (slow solvers)
- - Training stability is critical
Impact and Legacy
Neural ODEs opened a new family of models at the intersection of deep learning and differential equations. They inspired Hamiltonian NNs, Lagrangian NNs, FFJORD, Neural SDEs, and the modern wave of continuous-time models that power score-based diffusion models.
When to Use Neural ODEs (and When Not To)
Use Neural ODEs when your data is continuous or irregularly sampled, when you have strong physical priors (conservation laws, symmetries), when memory is a bottleneck, or when you need exact likelihoods. Do not use them when speed is paramount (discrete networks are faster to train), when your data is inherently discrete (text, graphs), or when your dynamics need discontinuities (use Neural CDEs or Neural Jump ODEs instead).
The Neural ODEs paper did more than introduce a new model — it opened a new research field at the intersection of deep learning and differential equations. Before 2018, these two communities rarely talked to each other. After the paper, a flood of work connected neural networks to dynamical systems, optimal control theory, numerical analysis, and mathematical physics.
Direct Descendants
Broader Influence
The Paper That Built a Bridge
With over 6,000 citations, Neural ODEs is one of the most influential ML papers of the last decade. Its greatest contribution was not any single technique, but the conceptual bridge it built between deep learning and differential equations. This bridge now carries traffic in both directions: ML researchers use ODE theory to understand and improve neural networks, while scientists use neural networks to solve differential equations. The paper proved that centuries of mathematical theory about ODEs — stability, conservation laws, existence theorems, numerical methods — could be directly applied to deep learning. That insight changed how an entire generation of researchers thinks about neural networks.
Neural ODEs Deep-Dive Quiz
Question 1 of 10What is the key insight connecting ResNets to Neural ODEs?
You now understand how Neural ODEs bridge differential equations and deep learning.
From the ResNet-to-ODE insight that connected discrete layers to continuous dynamics, to the adjoint method that made constant-memory training possible, from continuous normalizing flows that enabled free-form generative models to latent ODEs for irregular time series — you have explored the full landscape of a paper that created an entirely new family of models and inspired the probability flow ODE behind modern diffusion models.