Legendre Memory Units: Continuous-Time Representation in Recurrent Neural Networks

Aaron Voelker, Ivana Kajic, Chris EliasmithNeurIPS 2019

Introduction

The Legendre Memory Unit (LMU) is a novel Recurrent Neural Network (RNN) cell derived from first principles to represent continuous-time history using orthogonal Legendre polynomials. It dramatically outperforms traditional Long Short-Term Memory (LSTM) networks in memory capacity—handling dependencies up to 100,000 time-steps—while using significantly fewer parameters. Furthermore, its mathematical foundation offers a clear path to ultra-low-power neuromorphic hardware implementations.

The Problem with Current RNNs

RNNs, particularly LSTMs, have long been the workhorse for sequential data processing. However, they suffer from a fundamental "memory" problem: as sequences get longer (typically $T > 1000$), gradients tend to vanish or explode, and the units saturate. To make them work in practice, researchers must rely on a suite of heuristics and tricks, such as gradient clipping and exhaustive hyperparameter searches.

Furthermore, most RNNs are designed strictly for discrete time-steps. This makes it difficult for them to naturally handle the continuous-time signals found in the real world. The authors of this paper argue that the field needs a memory mechanism that isn't just a heuristic gate, but a mathematically sound representation of a sliding window of time.

The LMU Architecture

The core innovation of this work is the Legendre Memory Unit. Unlike the LSTM, which uses learned gating mechanisms to "decide" what to remember and what to forget, the LMU is derived directly from the linear transfer function of a continuous-time delay.

The LMU architecture decouples the linear memory component from the nonlinear hidden state.

There are several key components that make this architecture unique:

  • ODE-Based Memory: The LMU maintains memory by solving $d$ coupled ordinary differential equations (ODEs). The state vector ($m$) in these equations represents a sliding window of the input signal projected onto the first $d$ Legendre polynomials.
  • Orthogonal Representation: Because Legendre polynomials are orthogonal, the LMU effectively "orthogonalizes" its history. This means it stores information in a way that minimizes redundancy and maximizes the fidelity of the reconstructed past.
  • Linear-Nonlinear Decoupling: As shown in the architecture diagram, the network separates the linear memory component (the ODE solver) from the nonlinear hidden state. This allows the network to learn complex functions across time without the memory itself becoming unstable.
  • Discretization: To function on standard digital computers, the authors map these continuous ODEs onto discrete time-steps using techniques like Euler’s method or Zero-Order Hold (ZOH).

Key Results and Memory Capacity

The authors evaluated the LMU against several benchmarks designed to stress-test long-term memory, yielding impressive results.

Memory capacity comparison showing the LMU maintaining low error across 100,000 time-steps, vastly outperforming LSTMs.
  • Massive Memory Span: In a synthetic "copy memory" Capacity Task, the network had to recall values from a white-noise signal. The LMU successfully persisted information across 100,000 time-steps. For comparison, standard LSTMs typically fail after just 1,000 steps.
  • State-of-the-Art on psMNIST: On the Permuted Sequential MNIST (psMNIST) benchmark—where image pixels are fed one-by-one in a permuted order to force long-range spatial-temporal learning—the LMU achieved 97.15% accuracy. This surpassed previous leaders like the NRU (95.38%) and IndRNN (96.0%), and it did so using only ~102k parameters compared to the NRU's ~165k.
  • Chaotic Prediction: On the Mackey-Glass task, a chaotic time-series prediction challenge, the LMU achieved a significantly lower error (NRMSE of 0.054) than an equivalently sized LSTM (0.079) while training nearly twice as fast.

Insights and Future Directions

The LMU's success is driven by the fact that its memory weights are derived, not just designed. The weights are mathematically derived from Padé approximants, meaning that in some tasks, the LMU can perform perfectly with zero training on its memory weights. Additionally, because it is based on continuous-time ODEs, the LMU learns features that are largely scale-invariant and independent of the specific time-step ($\Delta t$) used during training.

Crucially, the LMU's structure maps naturally to spiking neurons (specifically Poisson neurons). This opens the door for running these high-performance models on analog or digital neuromorphic chips, like Intel’s Loihi, potentially yielding massive energy savings.

While the LMU is highly capable, the authors note a few areas for future expansion. The current iteration is a "simplest design"; adding explicit input or forget gates might improve performance on tasks requiring selective memory resets, such as language modeling. Furthermore, future architectures could utilize multiple LMU cells per layer, each tuned to different time-scales, to process temporal information in parallel.

Summary updated

BibTeX
@inproceedings{voelker2019legendre,
  author = {Aaron Voelker and Ivana Kajic and Chris Eliasmith},
  title = {{Legendre Memory Units: Continuous-Time Representation in Recurrent Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=vM0EFbu4gm},
}
Figure