Neural Ordinary Differential Equations
Instead of a fixed stack of discrete layers, a Neural ODE describes a network's transformation as a continuous flow, and lets a numerical differential-equation solver decide how many internal steps to take.
Prerequisites: ResNet and Identity Mappings, The Multilayer Perceptron
A residual network updates a value layer by layer: , each layer nudging the previous state a little. What happens if you shrink the size of each nudge and add proportionally more layers to compensate, pushing the step size toward zero? The discrete staircase of layers starts to look like a smooth, continuous path — and that continuous limit is exactly what a differential equation describes.
The analogy: from footsteps to a flowing river
A ResNet's layer-by-layer updates are like a series of discrete footsteps across a landscape, each one a fixed-size hop. A Neural ODE instead describes the rate of change at every point — like describing a river's current rather than a series of hops — and leaves it to a numerical solver to figure out how finely to step through that flow to get from a starting point to an ending point.
The mechanics
Where a ResNet layer computes (one discrete Euler step), a Neural ODE instead defines the derivative:
In words: instead of specifying what the state becomes after one fixed step, you specify how fast and in what direction it is currently changing, and an ODE solver integrates that rate from a start time to an end time to produce the output . "Depth" is no longer a fixed integer number of layers — it's continuous time, and the solver adaptively decides internally how many small steps it needs.
Worked example 1: integrating a toy ODE by hand
Take , , integrated from to using simple Euler steps of size : step 1, . Step 2, . The true analytic solution is — the two-step Euler approximation () is close but not exact; a finer step size (more, smaller steps) would converge toward , which is exactly the "adaptive" part a real ODE solver automates.
Worked example 2: a 3-layer ResNet as a coarse solver
A 3-layer ResNet computing , , with the same at every layer is, by construction, exactly a 3-step Euler integration of with step size . A Neural ODE with the same integrated more finely (say, 20 adaptive steps) approximates the same underlying continuous trajectory more accurately — the ResNet is a specific, coarse, fixed-step-count special case of the continuous model.
A Neural ODE replaces a fixed stack of discrete layers with a continuous rate-of-change function integrated by a numerical solver, making a ResNet's layer-by-layer update a specific coarse, fixed-step-size special case of the same underlying continuous idea.
What this means in practice
Because the output is defined by integrating to any target time, Neural ODEs naturally handle irregularly-sampled time series — like tick data with uneven gaps — by integrating directly to each observation's actual timestamp instead of forcing evenly-spaced discrete steps. Training also typically uses the adjoint method, which integrates the gradient backward through time without storing every intermediate solver step, saving memory versus backpropagating through a very deep unrolled network.
"Continuous depth" does not mean free or infinitely fast. The solver still performs many small internal steps under the hood — just chosen adaptively rather than fixed by architecture — and the actual training cost scales with how complex or "stiff" the underlying dynamics are, not with zero. A poorly-behaved can force the solver to take a huge number of tiny steps, making training far slower than an equivalent fixed-depth ResNet, not faster.
Related concepts
Practice in interviews
Further reading
- Chen et al., Neural Ordinary Differential Equations (2018)