Abstract: Recurrent Neural Network (RNN) has been successfully applied in many sequence learning problems, such as handwriting recognition, image description, natural language processing, and video motion analysis. After years of development, researchers have improved the internal structure of the RNN and introduced many variants. Among others, Gated Recurrent Unit (GRU) is one of the most widely used RNN models. However, GRU lacks the capability of adaptively paying attention to certain regions or locations, which may cause information redundancy or loss during learning. In this paper, we propose an RNN model called Recurrent Attention Unit (RAU), which seamlessly integrates the attention mechanism into the interior of GRU by adding an attention gate. The attention gate can enhance GRU's ability to remember long-term memory and help memory cells quickly discard unimportant content. RAU is capable of extracting information from sequential data by adaptively selecting a sequence of regions or locations and paying more attention to the selected regions during learning. Extensive experiments on image classification, sentiment classification, and language modeling show that RAU consistently outperforms GRU and other baseline methods.
Introduction
Published in 2018 by researchers at the Ocean University of China, the Recurrent Attention Unit (RAU) introduces a structural modification to the popular Gated Recurrent Unit (GRU). By embedding an attention mechanism directly into the cell's architecture, the RAU aims to improve how models handle long-term dependencies and filter noise in sequential data.
Addressing Information Redundancy
While traditional RNNs like LSTMs and GRUs were developed to mitigate the vanishing gradient problem, they often struggle with information redundancy. In long sequences, every element is treated with similar structural priority, which can lead to "information loss" as the model attempts to compress irrelevant noise into a fixed-size hidden state. The authors argue that an internal mechanism is needed to adaptively focus on specific regions of the input sequence, much like human vision focuses on specific parts of a field of view while ignoring the periphery.
The RAU Architecture
The core innovation of the RAU is the addition of an Attention Gate to the standard GRU framework. While the RAU maintains the traditional Update Gate ($z_t$) and Reset Gate ($r_t$), it introduces a new path to calculate an "attentive" candidate state.
The attention gate processes the current input ($x_t$) and the previous hidden state ($h_{t-1}$) to generate a weight matrix ($U_t$). This matrix acts as a resource allocation mechanism, allowing the model to prioritize specific features. The final hidden state ($h_t$) is then derived from a hybrid combination of the previous state, the standard candidate state ($\tilde{h}_t$), and this new attentive candidate ($\hat{h}_t$). By placing the attention mechanism inside the cell rather than as a separate layer, the model becomes more efficient at discarding unimportant content during the learning process.
Performance and Convergence
The RAU was evaluated across three distinct domains: image classification (MNIST, Fashion-MNIST), language modeling (Penn Treebank), and sentiment analysis (IMDB). Across all benchmarks, the RAU consistently outperformed standard GRU and LSTM baselines.
Key results include:
- MNIST: RAU achieved a 98.80% accuracy (1.20% error rate), surpassing the standard GRU (98.54%).
- Fashion-MNIST: RAU reached 89.60% accuracy, a significant improvement over GRU (87.89%) and LSTM (88.45%).
- Language Modeling: In the "Large" Penn Treebank configuration, RAU achieved a test perplexity of 78.32, lower than both GRU (78.50) and LSTM (78.63).
Beyond final accuracy, learning curves (as seen in the Fashion-MNIST results) indicate that the RAU converges faster. This suggests that the attention gate helps the gradient-based learning process identify critical features more efficiently than standard gating mechanisms.
Conclusion and Future Directions
The Recurrent Attention Unit demonstrates that internalizing attention within the recurrent cell provides a robust way to handle sequential data. By filtering noise and focusing on relevant features, the RAU improves both performance and training efficiency with fewer parameters than a full LSTM. Future work may explore the scalability of RAU to extremely long sequences and further investigate the interpretability of the internal attention weights through visualization.
Summary updated