Time-Adaptive Recurrent Neural Networks

Mantas Lukosevicius, Arnas UselisarXiv 2022

Abstract: Data are often sampled irregularly in time. Dealing with this using Recurrent Neural Networks (RNNs) traditionally involved ignoring the fact, feeding the time differences as additional inputs, or resampling the data. All these methods have their shortcomings. We propose an elegant straightforward alternative approach where instead the RNN is in effect resampled in time to match the time of the data or the task at hand. We use Echo State Network (ESN) and Gated Recurrent Unit (GRU) as the basis for our solution. Such RNNs can be seen as discretizations of continuous-time dynamical systems, which gives a solid theoretical ground to our approach. Our Task-Synchronized ESN (TSESN) and GRU (TSGRU) models allow for a direct model time setting and require no additional training, parameter tuning, or computation (solving differential equations or interpolating data) compared to their regular counterparts, thus retaining their original efficiency. We confirm empirically that our models can effectively compensate for the time-non-uniformity of the data and demonstrate that they compare favorably to data resampling, classical RNN methods, and alternative RNN models proposed to deal with time irregularities on several real-world nonuniform-time datasets.

Introduction

Most Recurrent Neural Networks (RNNs) operate under a rigid assumption: data arrives at perfectly uniform intervals. In the real world, this is rarely true. Medical records are updated only during patient visits, sensors might only trigger on specific events, and archaeological data is often scattered across centuries. Traditionally, researchers handle this by ignoring time, feeding the time difference ($\Delta t$) as an extra input, resampling the data to a regular grid, or using computationally expensive Neural ODEs. These methods are often inefficient, inaccurate, or overly complex.

Methodology: Task-Synchronized RNNs

The core innovation of this work is a shift in perspective: don't resample the data; resample the RNN. Many RNN architectures can be viewed as discrete-time approximations of continuous-time dynamical systems. By re-discretizing these systems using the actual time intervals of the data, we create Task-Synchronized (TS) models.

  • Task-Synchronized ESN (TSESN): Echo State Networks are efficient because only the output layer is trained. We take the differential equation governing an ESN and apply a linear Euler discretization. Instead of a constant $\Delta t$, we plug the actual time difference between data points directly into the update equation.
  • Task-Synchronized GRU (TSGRU): A similar logic is applied to the GRU, where the "update gate" is modified by the elapsed time $\Delta t$.

To handle very large time gaps that might destabilize linear approximations, we introduce a nonlinear time scaling option: $f(\Delta t) = 1 - e^{-\Delta t}$.

Experimental Results

The models were evaluated across synthetic chaotic systems (Lorenz and Mackey-Glass), real-world gesture classification (UWave), and generative tasks on noisy natural data (Speleothem).

Test MSE for Lorenz and Mackey-Glass systems as a function of time irregularity. TSESN maintains significantly lower error than standard ESN and ESN+delta_t.

Key Insights

  1. Zero-Cost Adaptation: These models require no additional parameters or extra training compared to standard counterparts. The update rule simply incorporates the timestamp.
  2. Efficiency vs. Complexity: While Neural ODEs are the "gold standard" for continuous time, they are slow. TS-RNNs provide a "good enough" approximation that is orders of magnitude faster. On the UWave task, TSESN and TSGRU were 1,000 to 7,000 times faster to train than Gaussian Process-based GRUs while maintaining comparable accuracy (~90-92%).
  3. Stability: As shown in Figure 1, standard ESNs become unstable quickly as time irregularity increases. TSESN shows a remarkably graceful degradation in performance, maintaining MSE several orders of magnitude lower than baselines.

Conclusion

Task-Synchronized RNNs offer a computationally efficient and theoretically sound method for handling irregularly sampled time series. While extremely large gaps remain a challenge, the "task-synchronization" logic is broadly applicable to various architectures. Future work may explore higher-order differential equation solvers to further improve accuracy at a manageable computational cost.

Summary updated

BibTeX
@misc{lukosevicius2022time,
  author = {Mantas Lukosevicius and Arnas Uselis},
  title = {{Time-Adaptive Recurrent Neural Networks}},
  year = {2022},
  eprint = {2204.05192},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.05192},
}
Figure