For years, a fundamental "truth" in deep learning has been that sequential models like Recurrent Neural Networks (RNNs) and Neural Ordinary Differential Equations (NeuralODEs) are inherently slow. Because each state depends on the previous one, you have to compute them one by one—a nightmare for the massively parallel architecture of modern GPUs. This bottleneck is a primary reason why the field shifted so heavily toward Transformers for sequence tasks.
A new paper from ICLR 2024, "Parallelizing Non-Linear Sequential Models Over the Sequence Length," challenges this status quo. The authors introduce the DEER framework, which can accelerate the evaluation of these models by up to 1,000x and speed up training by over 10x, all without changing the model's architecture or sacrificing accuracy.
TL;DR
The DEER framework parallelizes non-linear sequential models (like GRUs and NeuralODEs) across the sequence length by reframing them as fixed-point iteration problems. By using a parallelizable Newton-style method, it achieves up to 3 orders of magnitude speedup on GPUs, effectively "unlocking" these models for extremely long sequence tasks.
What Problem Does This Paper Address?
The core issue is sequential dependency. In a standard RNN, to get the hidden state at time $t$ ($h_t$), you must first compute $h_{t-1}$. This serial chain means that if your sequence is 10,000 steps long, your GPU—which is designed to execute thousands of operations simultaneously—is stuck waiting for 10,000 consecutive operations to finish.
While researchers have tried to bypass this by using linear layers (which can be parallelized via "prefix scans"), these often lack the expressive power of non-linear models like the Gated Recurrent Unit (GRU). The DEER framework aims to bring that same parallel efficiency to the non-linear models we already know and use.
Methods: The DEER Framework
The acronym DEER stands for non-linear Differential Equation as fixed point itERation.
Instead of solving the sequence step-by-step, the authors treat the entire sequence as a single system of non-linear equations. They solve this system using an iterative approach:
- Linearization: They take an initial "guess" at the entire sequence of hidden states. They then linearize the non-linear transition function around this guess using a Taylor expansion (essentially Newton’s method).
- Parallel Solving: The resulting linear system can be solved across the entire sequence length simultaneously using a parallel prefix scan (an algorithm that computes cumulative operations in $O(\log L)$ time instead of $O(L)$).
- Iteration: Because they use a Newton-style method, the convergence is quadratic. This means the "guess" gets very accurate very quickly—often converging in just a few iterations.
Crucially, this method doesn't require changing the underlying model. You can take a standard, off-the-shelf GRU and wrap it in the DEER framework to make it parallel.
Key Insights and Ideas
- Newton's Method in Banach Space: The breakthrough is realizing that sequential evaluation is just one way to solve a differential equation. By viewing it as a root-finding problem in a high-dimensional space, we can apply powerful iterative solvers that are naturally parallel.
- Quadratic Convergence is King: Because the error squares at every iteration, the number of iterations needed is small and stays small even as sequences get longer.
- The "Multi-Head" Trick: To handle the computational cost of large hidden states, the authors suggest splitting a large state (e.g., 256 dimensions) into multiple smaller "heads" (e.g., 32 heads of 8 dimensions). This keeps the matrix math efficient while maintaining model capacity.
Key Results
The authors evaluated DEER on several challenging benchmarks, including EigenWorms (a physical movement dataset with ~17k time samples), Sequential CIFAR-10, and Two-body Physics simulations.
- Massive Speedups: For a sequence length of 1 million, DEER evaluated a GRU over 500x faster than the sequential method. When including gradient calculations for training, the speedup exceeded 1,000x.
- Faster Training: On the EigenWorms task, training was 22x faster than the sequential baseline. What would have taken over a day to train sequentially took only one hour with DEER.
- Competitive Accuracy: On EigenWorms, the GRU trained with DEER achieved 88.0% accuracy, outperforming many specialized long-sequence models like NRDE and NCDE.
- Numerical Precision: The difference between the DEER output and the sequential output is negligible (around $10^{-7}$), essentially at the limit of single-precision floating point math.
Limitations and Future Work
The primary limitation is scaling with the hidden dimension ($n$). The algorithm requires computing and storing Jacobian matrices, leading to a memory complexity of $O(n^2)$ and a time complexity of $O(n^3)$ per step. This makes it highly efficient for models with smaller hidden states (like physics simulations or multi-head RNNs) but potentially expensive for massive "monolithic" hidden states.
The authors suggest that future work could explore globally-converged Newton methods to ensure the algorithm converges even when the initial guess is poor, further broadening the types of models and initializations that can benefit from this parallelization.
Summary updated