Continuous Depth Recurrent Neural Differential Equations

Srinivas Anumasa, Geetakrishnasai Gunapati, P. K. Srijith

TL;DR

Existing continuous-time recurrent models (like ODE-RNNs) handle irregularly sampled time series by evolving hidden states continuously across time, but they still rely on fixed, discrete layers across network depth. This paper introduces Continuous Depth Recurrent Neural Differential Equations (CDR-NDE) and a physics-inspired CDR-NDE-heat model that continuously evolve representations along both time and depth, yielding state-of-the-art results on irregular sequence labeling tasks.

What Problem Does This Paper Address?

Standard recurrent neural networks (RNNs) struggle with irregularly sampled sequential data where observations arrive at non-uniform intervals. While continuous-time variants (such as Neural ODEs, ODE-RNN, and GRU-ODE) address this by modeling hidden state evolution across time intervals using ordinary differential equations, their depth-wise transformations remain rigid:

  1. When a new input arrives, they still pass it through standard neural network layers with a fixed, discrete depth.
  2. Real-world sequences often vary in complexity across time steps (e.g., a text-only post vs. a post containing both text and images). A fixed depth cannot adaptively spend more or fewer computational steps depending on input difficulty.

The authors tackle this limitation by formalizing hidden state updates as continuous transformations across both the temporal dimension ($t$) and the network depth dimension ($t'$).

Methods

The paper proposes two continuous-depth architectures built on top of gated recurrent unit (GRU) dynamics:

  • CDR-NDE (Two-Stage ODE): Models hidden state evolution $h(t, t')$ along two orthogonal axes using two separate ODEs. Temporal flow evolves continuously at the base depth ($t'=0$) via continuous GRU dynamics. Then, depth evolution proceeds vertically along $t'$ using representations from earlier time steps to preserve temporal dependencies.
  • CDR-NDE-heat (PDE Formulation): Re-imagines hidden state propagation as heat diffusing through a 1D rod over depth $t'$, governed by a non-homogeneous heat equation: $$\frac{\partial h(t, t')}{\partial t'} - \frac{\partial^2 h(t, t')}{\partial t^2} = f(h)$$ where $f(\cdot)$ represents a continuous GRU cell.

  • The second-order derivative with respect to time ($\frac{\partial^2 h}{\partial t^2}$) acts as a spatial diffusion operator across time, naturally pulling contextual information from both the past ($t - \Delta t$) and the future ($t + \Delta t$), similar to a bidirectional RNN.

  • To make PDE computation GPU-friendly, the authors apply the Method of Lines (MoL): spatial (temporal) differences are discretized first, converting the PDE into a coupled system of ODEs along the depth axis that can be solved simultaneously across all sequence positions using solvers like Euler or adaptive Dormand-Prince (Dopri5).

Datasets

The models were evaluated on two standard irregularly sampled benchmarks:

  1. Person Activity Recognition: Accelerometer data from four body sensors across five subjects, reduced to seven activity classification categories. Sequences are split into overlapping windows, resulting in 7,769 training and 1,942 test sequences.
  2. Walker2d Kinematic Simulation: An autoregressive kinematic regression benchmark derived from the MuJoCo/OpenAI Gym Walker2d-v2 environment. The data is made irregularly sampled by randomly omitting 10% of timesteps.

Key Insights and Ideas

  • Adaptive Depth for Sequence Complexity: Using an adaptive numerical solver (Dopri5) over depth allowed the network to dynamically adjust function evaluations (between 26 and 32 steps per sequence on the activity dataset), adjusting compute to the difficulty of individual samples.
  • Physics-Driven Bidirectional Context: In CDR-NDE-heat, borrowing the 1D diffusion operator allows representations to smooth out across neighboring timestamps. This provides bidirectional smoothing across time while hidden representations deepen across $t'$.
  • Speed via Method of Lines: While basic finite-difference PDE methods are sequential and slow on GPUs, the Method of Lines allows all time-steps at a particular depth to update in parallel, making CDR-NDE-heat more than 2× to 3× faster per epoch than the sequential two-stage CDR-NDE.

Key Results

The proposed models consistently outperformed previous continuous-time recurrent baselines:

Model Person Activity (Test Accuracy %) Walker2d Kinematics (Test MSE)
Augmented-LSTM $83.78 \pm 0.41$ $1.09 \pm 0.01$
ODE-LSTM $83.77 \pm 0.58$ $0.91 \pm 0.02$
CT-GRU $83.93 \pm 0.86$ $1.22 \pm 0.01$
CDR-NDE $87.54 \pm 0.34$ $0.97 \pm 0.04$
CDR-NDE-heat (Euler) $88.24 \pm 0.31$ $0.54 \pm 0.01$
CDR-NDE-heat (Dopri5) $88.60 \pm 0.26$ $0.49 \pm 0.01$
  • On Walker2d, CDR-NDE-heat (Dopri5) nearly halved the test MSE compared to the best continuous baseline (0.49 vs. 0.91 for ODE-LSTM).
  • Training Time: On Walker2d, CDR-NDE-heat (Euler) required only 28 seconds/epoch compared to 140 seconds/epoch for the standard CDR-NDE.

Limitations and Future Work

  • Cell Architecture Constraints: The current framework is specifically derived from GRU gating equations; extending the continuous time-and-depth formulation to other recurrent blocks (like LSTMs or attention mechanisms) remains future work.
  • Interpolation Overhead: In the two-stage CDR-NDE, combining adaptive solvers across both axes requires interpolating intermediate states at historical steps ($t-1$), introducing extra computation and complexity.
  • Task Scope: Evaluations were limited to standard kinematic regression and sensor classification; validation on broader multimodal settings (e.g., text and vision streams) has not yet been demonstrated.

Summary updated

BibTeX
@inproceedings{anumasa2023continuous,
  author = {Srinivas Anumasa and Geetakrishnasai Gunapati and P. K. Srijith},
  title = {{Continuous Depth Recurrent Neural Differential Equations}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=-p5ZEVGtojQ},
}

Loading related content...

Figure