Abstract
Attention is an important cognition process of humans, which helps humans concentrate on critical information during their perception and learning. However, although many machine learning models can remember information of data, they have no the attention mechanism. For example, the long short-term memory (LSTM) network is able to remember sequential information, but it cannot pay special attention to part of the sequences. In this paper, we present a novel model called long short-term attention (LSTA), which seamlessly integrates the attention mechanism into the inner cell of LSTM. More than processing long short term dependencies, LSTA can focus on important information of the sequences with the attention mechanism. Extensive experiments demonstrate that LSTA outperforms LSTM and related models on the sequence learning tasks.
Introduction
Long Short-Term Memory (LSTM) networks have become a cornerstone of sequence modeling due to their ability to capture long-range dependencies. However, a significant drawback of the standard LSTM is its lack of an inherent attention mechanism. While external attention layers are often added on top of LSTMs, these "wrappers" typically process information only after the LSTM has already encoded the entire sequence. This means the internal state updates of the LSTM remain "blind" to the relative importance of different sequence elements during the actual memory-building process.
To address this, we propose Long Short-Term Attention (LSTA), a novel architecture that embeds an attention gate directly within the LSTM cell. This allows the model to dynamically prioritize critical information as it processes each step of a sequence.
The LSTA Architecture
The core innovation of LSTA is the integration of an Attention Gate ($A_t$) into the standard LSTM cell structure. Unlike traditional attention mechanisms that operate globally over a sequence, the LSTA attention gate works locally and intrinsically.
As shown in the architecture, the attention gate interacts with signals from the input gate ($i_t$) and forget gate ($f_t$). This synergy allows the cell to decide what to focus on based on current learning and historical context. The resulting attention signal is directly incorporated into the cell state update, creating an "attentive" memory that emphasizes high-value features during the recurrent update cycle.
Experimental Evaluation
We evaluated LSTA across several challenging sequence learning tasks to demonstrate its versatility:
- Sequential Image Classification: MNIST and Fashion-MNIST datasets were processed row-by-row as sequences (28 steps of 28 pixels).
- Sentiment Analysis: We used the IMDB movie review dataset and a Twitter sentiment dataset.
- Aspect-Based Sentiment Analysis: Evaluated on the SemEval-2014 Task 4 (Restaurant and Laptop domains).
Results and Discussion
LSTA consistently outperformed standard LSTMs and other variants across all benchmarks. A key observation was the improvement in both final performance and convergence speed.
As illustrated in the training curves, LSTA (red) achieves higher accuracy and lower loss significantly faster than the baseline LSTM (blue). On the Fashion-MNIST task, LSTA reached an accuracy of 88.60%, compared to 87.46% for the standard LSTM. In sentiment analysis on the IMDB dataset, LSTA achieved a lower error rate (approx. 12.96%) than both LSTM and Hybrid Deep Belief Networks (HDBN).
The results suggest that by incorporating attention into the gating logic, the model can more effectively filter noise and focus on the most discriminative parts of the input sequence from the very beginning of training. Furthermore, despite the added gate, LSTA showed efficient running times, suggesting that focused learning may lead to more effective gradient updates.
Conclusion
Long Short-Term Attention (LSTA) represents a significant step forward in recurrent neural network design. By moving the attention mechanism from an external layer to an internal gate, LSTA gains the ability to focus on important information during the state update process. This leads to better representational power, faster convergence, and superior performance across a variety of sequence learning tasks.
Summary updated