Attention-based LSTM for Aspect-level Sentiment Classification

Yequan Wang, Minlie Huang, Xiaoyan Zhu, Li Zhao

Introduction

Traditional sentiment analysis typically assigns a single polarity to an entire sentence. However, real-world reviews often contain mixed sentiments directed at different "aspects" of a product or service. For instance, in the sentence, "The appetizers are ok, but the service is slow," the sentiment is neutral/positive regarding food but negative regarding service. Standard models struggle with such nuances because they lack aspect-dependency. This paper, presented at EMNLP 2016, addresses this by proposing an attention-based Long Short-Term Memory (LSTM) network that incorporates aspect information to focus on relevant parts of a sentence.

Methodology

The authors explore three variations of an LSTM-based architecture designed to capture aspect-level sentiment. The most sophisticated version is the Attention-based LSTM with Aspect Embedding (ATAE-LSTM).

  1. AE-LSTM (LSTM with Aspect Embedding): Learns a unique embedding for each aspect (e.g., Price, Food). This vector, combined with hidden states, calculates attention weights to determine word importance.
  2. AT-LSTM (Attention-based LSTM): Uses aspect information primarily to create a weighted representation of the sentence via an attention mechanism.
  3. ATAE-LSTM: The comprehensive model appends the aspect embedding to every input word vector. This ensures the LSTM is "aware" of the target aspect from the initial input. An attention mechanism is then applied to the hidden states to produce a final representation for classification.
The ATAE-LSTM architecture incorporates aspect embeddings directly into the input and uses an attention mechanism to weight hidden states.

The core innovation is the attention mechanism, which allows the model to dynamically shift its focus. When querying the "service" aspect, the model assigns higher weights to descriptors like "slow" or "friendly," whereas for "food," it prioritizes terms like "appetizers" or "tasty."

Experimental Setup

The models were evaluated on the SemEval 2014 Task 4 dataset, covering restaurant and laptop reviews. The restaurant dataset includes five aspects: Food, Price, Service, Ambience, and Anecdotes/Miscellaneous. The task required a three-way classification into Positive, Negative, or Neutral polarities.

Results and Discussion

The ATAE-LSTM model demonstrated superior performance over standard LSTMs and previous target-dependent models (TD-LSTM). On the restaurant dataset, it achieved 84.0% accuracy in 3-way classification and 89.9% in binary classification (excluding neutral cases).

Qualitative Analysis

A key strength of the model is its contextual flexibility. Visualization of attention weights confirms that the model successfully "attends" to relevant phrases based on the input aspect. For example, when the aspect is service, the model focuses on "fastest delivery times."

Attention weight visualizations showing how the model shifts focus between different words depending on the target aspect.

Furthermore, the "soft" attention mechanism makes the model robust to complex sentence structures that often cause rule-based or dependency-parsing models to fail. By treating aspects as learnable embeddings, the model bridges the gap between explicit mentions and abstract categories.

Conclusion

The proposed attention-based LSTM provides a powerful framework for granular sentiment analysis. While highly effective, the model currently processes one aspect at a time, suggesting that simultaneous multi-aspect modeling could improve efficiency. Future work may also address challenges related to complex long-distance negations and data sparsity in less frequent aspect categories.

Summary updated

BibTeX
@inproceedings{wang2016attention,
  author = {Yequan Wang and Minlie Huang and Xiaoyan Zhu and Li Zhao},
  title = {{Attention-based LSTM for Aspect-level Sentiment Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2016},
  doi = {10.18653/v1/d16-1058},
}
Figure