A single-layer RNN can approximate stacked and bidirectional RNNs, and topologies in between

Javier S. Turek, Shailee Jain, Mihai Capota, Alexander G. Huth, Theodore L. Willke

Abstract: Recent work has shown that topological enhancements to recurrent neural networks (RNNs) can increase their expressiveness and representational capacity. Two popular enhancements are stacked RNNs, which increases the capacity for learning non-linear functions, and bidirectional processing, which exploits acausal information in a sequence. In this work, we explore the delayed-RNN, which is a single-layer RNN that has a delay between the input and output. We prove that a weight-constrained version of the delayed-RNN is equivalent to a stacked-RNN. We also show that the delay gives rise to partial acausality, much like bidirectional networks. Synthetic experiments confirm that the delayed-RNN can mimic bidirectional networks, solving some acausal tasks similarly, and outperforming them in others. Moreover, we show similar performance to bidirectional networks in a real-world natural language processing task. These results suggest that delayed-RNNs can approximate topologies including stacked RNNs, bidirectional RNNs, and stacked bidirectional RNNs - but with equivalent or faster runtimes for the delayed-RNNs.

Introduction

Standard Recurrent Neural Networks (RNNs) process information "causally," meaning the output at any given time depends strictly on the current and past inputs. While efficient, this limitation often hinders performance on complex tasks requiring deep non-linear transformations or "acausal" context—information from the future. To address this, researchers typically employ two primary enhancements: stacked RNNs for depth and bidirectional RNNs (Bi-RNNs) for look-ahead capabilities.

However, these enhancements introduce significant computational overhead. Stacked networks increase sequential depth, and Bi-RNNs require two full passes over the data, creating synchronization bottlenecks that prevent real-time processing. This paper, presented at ICML 2020, introduces the delayed-RNN (d-RNN), a deceptively simple modification that achieves the benefits of depth and acausality within a single-layer architecture.

The Delayed-RNN Architecture

In a d-RNN, for an input $x_t$, the network is trained to produce the corresponding output $y_t$ at a later timestep $t+d$, where $d$ represents the "delay." This simple temporal shift allows the network to buffer information and process it more extensively before generating an output.

The delayed-RNN (d-RNN) architecture with a delay $d=2$.

Theoretical Equivalence to Stacked RNNs

The authors provide a rigorous mathematical foundation for this approach in Theorem 1. They prove that a d-RNN with a specific sparse, block-bidiagonal weight matrix is mathematically identical to a $k$-layer stacked RNN, where the delay $d = k-1$. This insight reveals that "depth in layers" can be effectively traded for "depth in time," allowing a single layer to represent the hierarchical processing of a deep network.

Approximating Bidirectionality

Because the output at $t+d$ is computed after the network has observed inputs $x_{t+1}, \dots, x_{t+d}$, the d-RNN effectively possesses a "look-ahead" window. Unlike a Bi-RNN, which requires the entire future sequence, the d-RNN only needs a fixed window of $d$ future steps. This "partial acausality" is often sufficient for many real-world tasks, such as Part-of-Speech (POS) tagging, where local future context is the most critical.

Experimental Evaluation

The researchers evaluated the d-RNN (and its LSTM variant, the d-LSTM) on a variety of synthetic and real-world datasets, including sequence reversal, sine function approximation, the text8 Wikipedia corpus, and Universal Dependencies (UD) treebanks for POS tagging.

Key Results

  • Computational Efficiency: On the text8 language modeling task, a d-LSTM achieved performance within 5% of a Bi-LSTM while running at least 4x faster. This speedup stems from the d-RNN's single-layer, forward-only nature, which avoids the synchronization requirements of bidirectional models and is highly compatible with GPU parallelization.
  • Competitive Accuracy: In POS tagging tasks across German, English, and French, a d-LSTM with a minimal delay ($d=1$) matched or slightly outperformed full Bi-LSTMs.
  • Scaling with Delay: Synthetic experiments demonstrated that as the delay $d$ increases, the d-LSTM's accuracy steadily approaches the performance of a Bi-LSTM, confirming its ability to capture increasing amounts of acausal context.
Accuracy of d-LSTM as a function of delay $d$ compared to standard and bidirectional LSTMs.

Conclusion and Future Work

The d-RNN offers a powerful alternative to traditional deep and bidirectional architectures. By flattening hierarchical processing into a single layer and utilizing temporal delays for look-ahead, it provides a more hardware-friendly path to high-performance sequence modeling.

While the d-RNN is limited by its fixed look-ahead window—making it less suitable for tasks requiring global sequence context—its efficiency makes it ideal for real-time applications. Future research may explore methods to automatically learn the optimal delay $d$ for a given task, further optimizing the balance between latency and accuracy.

Summary updated

BibTeX
@misc{turek2019single,
  author = {Javier S. Turek and Shailee Jain and Mihai Capota and Alexander G. Huth and Theodore L. Willke},
  title = {{A single-layer RNN can approximate stacked and bidirectional RNNs, and topologies in between}},
  year = {2019},
  eprint = {1909.00021},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.00021},
}
Figure