Second-Order Complexity of Neural ODE Inference

Yoshihiro MaruyamaNeurIPS 2026

TL;DR

Evaluating a Neural ODE isn't like passing data through a finite stack of standard neural network layers—it means solving a dynamical system across continuous time. This paper proves that even if a Neural ODE’s underlying vector field is cheap and easy to evaluate locally, computing its final output to $n$ bits of precision is computationally intractable ($\mathsf{PSPACE}$-hard) in the worst case. Fortunately, the author also discovers an escape hatch: enforcing strict mathematical smoothness (analytic or Gevrey regularity) with explicit derivative bounds brings inference right back into polynomial time.

What Problem Does This Paper Address?

In a standard deep network, a forward pass is a finite sequence of matrix multiplications and activations. Neural Ordinary Differential Equations (Neural ODEs) replace discrete layers with a continuous vector field $f_\theta$, where inference means starting at an input state $z_0$ and following the flow to find the endpoint $z(T)$.

Here lies a subtle computational trap. Evaluating the vector field $f_\theta(t, z)$ at a single point is a local query, which is usually fast. Computing the endpoint $z(T)$ to $n$ bits of accuracy (tolerance $\varepsilon = 2^{-n}$) is a global computation that accumulates information—and error—along an entire trajectory. Naively taking step sizes proportional to $\varepsilon$ requires $O(2^n)$ steps, which is exponential in the number of precision bits! The author asks a fundamental question: If local access to the dynamics is fast and well-behaved (Lipschitz continuous), is that enough to guarantee fast global inference?

Methods

To measure complexity over continuous real numbers without sweeping precision costs under the rug, the author uses computable analysis and the Kawamura-Cook framework of second-order complexity theory. Instead of treating real numbers as idealized infinite-precision floats, inputs are modeled as oracles ("names") that dispense dyadic rational approximations upon request, while algorithms are judged by how their runtime scales with the requested accuracy bits $n$.

Table 1: Translation between the represented-space terminology used in the complexity results and the corresponding Neural-ODE inference terminology.

Using this lens, the paper constructs mathematical reductions connecting Neural ODE forward passes to classical Initial Value Problems (IVPs):

  • Clock & Scaling Embeddings: Converts nonautonomous (time-dependent) hard scalar ODEs into fixed, 3D autonomous (time-independent) Neural ODEs where the computational problem is encoded purely in the initial input $z_0$.
  • Discretization & ReLU Approximation: Transfers continuous flow hardness to discrete, exponentially deep residual networks ($N = 2^m$ tied-weight Euler steps) and finite rational-ReLU networks via stability bounds.
  • Certified Local Taylor Propagation: For the tractable regime, builds a high-order Taylor-jet solver that steps through certified safe neighborhoods ("state tubes") where derivative growth is strictly bounded.

Datasets

Not discussed in the paper. (This is a purely theoretical complexity analysis with no empirical datasets or benchmarks.)

Key Insights and Ideas

  • Local simplicity hides global monsters: Even when a Neural ODE uses a single, fixed 3D autonomous block—the exact post-training setup where weights are frozen and only the input $z_0$ varies—computing the output map can encode $\mathsf{PSPACE}$-hard problems.
  • Finite smoothness won't save you: You might assume that making your activation functions smoother ($C^2, C^3$, etc.) tames the dynamics. Surprisingly, for any finite smoothness $C^k$ ($k \ge 2$), autonomous blocks can still encode problems hard for the Counting Hierarchy ($\mathsf{CH}$).
  • Training gradients are just as hard: By attaching a simple one-parameter linear readout with squared loss, a single scalar gradient query directly spits out the forward endpoint coordinate. Thus, backpropagating through the ODE solver inherits the exact same worst-case hardness—regardless of whether you use the adjoint method or another trick.
  • Why weight-tying matters for ResNets: A tied-weight ResNet ($z_{j+1} = z_j + hF(z_j)$) is just Euler's method. Because you only store one block and an exponent $m$ to specify $N = 2^m$ layers, a tiny description unleashes an exponentially deep computation—inheriting continuous-depth hardness.

Key Results

  • Worst-Case Equivalence: Scalar Neural-ODE endpoint inference is second-order polynomial-time equivalent to the classical Lipschitz IVP operator ($\mathsf{LipIVP} \equiv_2^p \mathsf{EFlow}_1$), making it $\mathsf{FPSPACE}_2$-complete.
  • Concrete Network Hardness: Endpoint evaluation is $\mathsf{PSPACE}$-hard (for $C^1$) and $\mathsf{CH}$-hard (for $C^k, k \ge 2$) across fixed 3D autonomous flows, compressed tied-weight ResNets of depth $2^m$, and precision-indexed families of finite rational-ReLU networks (built with just 6 clipping ReLUs and one scalar MLP).
  • Tractable Escape Hatches: In fixed dimension $d$, if the vector field is Taylor-certified analytic (such as finite Fourier-feature fields) or Gevrey-certified (smooth $C^\infty$ functions whose derivatives grow at most like $(|\alpha|!)^\sigma$, which strictly includes some non-analytic functions), endpoint inference runs in polynomial time with respect to precision bits $n$ and certificate parameters.

Limitations and Future Work

The paper does not feature a dedicated limitations section, though the exact mathematical boundaries of its tractable theorems naturally point toward open questions:

  • Fixed Dimension & Order: The polynomial-time tractability guarantees hold when state dimension $d$ (and Gevrey order $\sigma$) are fixed; in variable dimensions, complexity scales with the combinatorial number of retained Taylor coefficients $\binom{d+1+p}{p}$.
  • Reliance on Certificates: Fast inference requires a priori certificates—specifically, efficient access to higher-order derivatives (finite jets) and a certified "state tube" margin $\mu_U$ guaranteeing the trajectory stays safely inside its well-behaved region. Designing practical neural architectures that automatically supply these quantitative bounds without sacrificing expressivity is a natural next frontier.

Summary updated

Abstract

Neural ordinary differential equations replace a finite layer stack by the solution map of a learned dynamical system. Thus the machine-learning primitive evaluated at inference time is the flow endpoint generated by the learned vector field, computed to requested accuracy. We study the complexity of this global forward pass when the vector field has standard compactness and Lipschitz certificates. Using second-order complexity theory, we identify the exact operator-level complexity of this local-to-global computation: scalar Neural-ODE endpoint inference is second-order polynomial-time equivalent to the classical Lipschitz IVP solution operator and is thus $\mathsf{FPSPACE}_{2}$-complete in the worst case. A fixed three-dimensional autonomous block with polynomial-time computable $C^1$ dynamics realizes a $\mathsf{PSPACE}$-hard input-output map. At every finite smoothness level $C^k$ with $k\geq2$, such autonomous blocks can define counting-hierarchy-hard maps. One scalar readout-gradient query recovers the forward endpoint, so readout-gradient computation inherits this hardness. Uniformly constructible rational-ReLU families of size polynomial in precision, and compressed-depth tied ResNets, inherit the corresponding endpoint hardness. As a tractable counterpart, we consider fixed-dimensional fields with quantitative certificates of analytic or fixed-order Gevrey regularity. With efficient finite-jet access and certified state tubes, endpoint inference takes time polynomial in the precision parameter and the numerical certificate parameters. These results show, based on the rigorous framework of second-order complexity theory, that the computational reliability of continuous-depth learning systems depends jointly on global flow structure, representation certificates, and the cost of local network evaluations.
BibTeX
@inproceedings{maruyama2026second,
  author = {Yoshihiro Maruyama},
  title = {{Second-Order Complexity of Neural ODE Inference}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=my6jq2Z8kM},
}
Figure