A Lightweight Recurrent Network for Sequence Modeling

Biao Zhang, Rico SennrichACL 2019

Introduction

Recurrent Neural Networks (RNNs) are foundational to sequence modeling but suffer from high computational latency. The sequential dependency of hidden states $h_t$ on $h_{t-1}$ prevents parallelization of the heavy matrix-vector multiplications found in standard units like LSTMs and GRUs. While architectures like Transformers offer parallelization, RNNs remain relevant for their inductive biases and memory efficiency. Zhang and Sennrich (2019) propose the Lightweight Recurrent Network (LRN) to address this bottleneck by decoupling parameter-heavy operations from the recurrent loop.

The LRN Architecture

The core innovation of LRN is moving all affine transformations outside the sequential recurrence.

  1. Parallel Pre-calculation: Before entering the loop, the input sequence $X$ is projected into Query ($Q$), Key ($K$), and Value ($V$) representations using a single matrix multiplication across all time steps. This operation is highly parallelizable on GPUs.
  2. Element-wise Recurrence: The recurrent loop only involves element-wise operations. Gates are computed using pre-calculated $Q$ and $K$ values and the previous hidden state $h_{t-1}$:
  3. Input gate: $i_t = \sigma(k_t + h_{t-1})$
  4. Forget gate: $f_t = \sigma(q_t - h_{t-1})$
  5. State Update: The hidden state is updated as a weighted sum of the current value $v_t$ and $h_{t-1}$, stabilized by a $tanh$ activation to prevent value explosion.

By reducing the per-step complexity from $O(d^2)$ to $O(d)$, where $d$ is the hidden dimension, LRN significantly boosts hardware utilization.

Experimental Results

The authors evaluated LRN across a wide range of tasks, including Natural Language Inference (SNLI), Document Classification, Machine Translation (WMT14), and Reading Comprehension (SQuAD).

Efficiency and Accuracy

LRN consistently demonstrates superior speed compared to both standard RNNs and existing fast variants like the Simple Recurrent Unit (SRU). In Natural Language Inference (SNLI), LRN achieves the lowest inference times across various configurations, including those integrated with BERT.

Accuracy and inference time on the SNLI dataset.

In Machine Translation, the LRN variant with an output gate (oLRN) achieved a state-of-the-art BLEU score of 26.73 on WMT14 En-De, while maintaining a training speed significantly faster than GRU and SRU. Specifically, LRN is approximately 10–20% faster than SRU and up to 48% faster than LSTMs in certain configurations.

Performance and efficiency on WMT14 English-German translation.

Theoretical Connection

The paper highlights a mathematical link between LRN and self-attention. LRN can be viewed as a form of unnormalized, unidirectional attention where the "query" is effectively a chain of forget gates. This provides a theoretical bridge between the sequential nature of RNNs and the global context of attention mechanisms. Additionally, LRN's input-dependent recurrent weights help mitigate vanishing gradient issues by allowing the model to dynamically decide when to remember or forget information.

Conclusion

The Lightweight Recurrent Network offers a compelling solution to the efficiency problems of traditional RNNs. By stripping the recurrent loop of heavy matrix operations, LRN achieves significant speedups while maintaining or exceeding competitive performance across diverse NLP benchmarks. Its simplicity and theoretical ties to attention make it a robust choice for modern sequence modeling tasks.

Reference: Zhang, B., & Sennrich, R. (2019). A Lightweight Recurrent Network for Sequence Modeling. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), pages 1538–1548.

Summary updated

BibTeX
@inproceedings{zhang2019lightweight,
  author = {Biao Zhang and Rico Sennrich},
  title = {{A Lightweight Recurrent Network for Sequence Modeling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1149},
}
Figure