Long Short-Term Attention

Guoqiang Zhong, Xin Lin, Kang Chen, Qingyang Li, Kaizhu Huang

TL;DR

While standard LSTMs excel at tracking sequential data, they lack an inherent mechanism to prioritize the most important information within a sequence. This paper introduces Long Short-Term Attention (LSTA), a novel architecture that seamlessly integrates an attention gate inside the LSTM cell itself. By doing so, LSTA simultaneously captures long-term dependencies and focuses on crucial details, consistently outperforming standard LSTMs and external attention variants on image classification and sentiment analysis tasks.

What Problem Does This Paper Address?

Recurrent neural networks, particularly Long Short-Term Memory (LSTM) networks, are the workhorses of sequence learning due to their ability to remember long-term dependencies using specialized gating mechanisms. However, standard LSTMs treat sequential information uniformly within their hidden states—they lack a native "attention" mechanism to focus on pivotal elements while ignoring irrelevant noise.

While many researchers have combined attention mechanisms with LSTMs to solve this, they almost always append the attention layer outside the LSTM cells (i.e., after the entire sequence has been processed by the recurrent layers). The authors argue that this approach fails to address the fundamental limitation of the LSTM cell itself. LSTA addresses this gap by embedding an attention gate directly into the inner cell structure.

Methods

The core innovation of this paper is the Attention Gate, which is integrated directly inside the standard LSTM cell.

Unlike traditional attention mechanisms that compute weights across different hidden states over time, LSTA's internal attention gate operates at each individual timestep. It takes its inputs directly from the current step's forget gate ($f_t$) and input gate ($i_t$).

The process works as follows:

  1. Ratio Computation: A sigmoid function determines the ratios of the attention elements ($\hat{A}_t$).
  2. Candidate Value Generation: A $\tanh$ function generates candidate attention values ($\tilde{A}_t$), which can be positive or negative.
  3. Gate Output: These two vectors are multiplied element-wise to produce the final attention gate output ($A_t$).
  4. Cell State Update: This attention vector is directly added to the standard LSTM cell state update equation: $$\hat{C}_t = C_t + A_t = f_t * C_{t-1} + i_t * \tilde{C}_t + A_t$$

Finally, the hidden state output ($h_t$) is modulated using this attention-enhanced cell state ($\hat{C}_t$). This allows the model to dynamically adjust its internal memory allocation at every single step of the sequence.

Datasets

The authors evaluated LSTA across two distinct sequence learning paradigms using five well-known benchmarks:

  • Sequential Image Classification:
  • MNIST and Fashion-MNIST: Standard image datasets processed row-by-row as a sequence of 28 timesteps to test the model's sequence learning capacity.
  • Classical Sentiment Analysis:
  • IMDB: A movie review dataset categorized into positive and negative sentiments.
  • Aspect-Based Sentiment Analysis:
  • SemEval-2014 Task 4: Comprising distinct "Restaurant" and "Laptop" domains with reviews labeled by sentiment polarities (positive, neutral, negative) relative to specific aspect terms.
  • Twitter Dataset: A sentiment dataset collected by Dong et al. with similar aspect-level annotations.

Key Insights and Ideas

  • Inner-Cell vs. Outer-Cell Attention: Moving the attention mechanism inside the cell allows the network to filter and emphasize information during the state transition process. This prevents the model from losing critical details before the sequence finishes processing.
  • Leveraging Existing Gates: Instead of introducing heavy external dependencies, the attention gate cleverly reuses the activations of the input and forget gates. This means the attention mechanism is inherently aware of what the cell is already choosing to remember or discard.
  • Efficiency Boost: Surprisingly, integrating attention internally did not just improve accuracy; it also improved computational efficiency. In the IMDB sentiment analysis task, LSTA demonstrated a lower running time per epoch compared to both standard LSTMs and Hybrid Deep Belief Networks (HDBN).

Key Results

LSTA consistently outperformed standard LSTMs, GRUs, and existing attention-based variants across all evaluated tasks:

  • Image Classification: On the challenging Fashion-MNIST dataset, LSTA achieved an accuracy of 88.60%, outperforming standard LSTM (87.46%), GRU (88.16%), Bi-LSTM (88.18%), and Nested LSTM (88.32%). It also demonstrated noticeably faster convergence during training.
  • Classical Sentiment Analysis: On the IMDB dataset, LSTA achieved the lowest error rate (~12.95%) while requiring the least running time (~700 seconds/epoch) compared to its competitors.
  • Aspect-Based Sentiment Analysis: LSTA outperformed specialized attention models like "Cabasc" and "ATAE-LSTM". For example, on the SemEval14 Laptop domain, LSTA reached 71.16% accuracy, compared to standard LSTM's 69.74% and ATAE-LSTM's 69.75%.

Limitations and Future Work

While the paper demonstrates strong empirical success, the authors focus primarily on standard classification benchmarks and do not deeply explore the theoretical boundaries or scaling properties of LSTA on massive generative tasks (like language modeling or machine translation).

Additionally, the authors note that external attention mechanisms can still be stacked on top of LSTA cells, but they do not experimentally evaluate this hybrid configuration. Future work could investigate how well LSTA scales when paired with traditional transformer-style outer attention layers.

Summary updated

BibTeX
@inproceedings{zhong2019long,
  author = {Guoqiang Zhong and Xin Lin and Kang Chen and Qingyang Li and Kaizhu Huang},
  title = {{Long Short-Term Attention}},
  booktitle = {BICS},
  year = {2019},
  doi = {10.1007/978-3-030-39431-8\_5},
}
Figure