Interpretable Multi-Head Self-Attention Architecture for Sarcasm Detection in Social Media

Ramya Akula, Ivan Garibay

TL;DR

This paper introduces an interpretable deep learning model for sarcasm detection in social media using a multi-head self-attention mechanism combined with Gated Recurrent Units (GRUs). The model achieves state-of-the-art performance across multiple datasets while providing insights into why it makes certain predictions, addressing the "black box" problem of many deep learning models.

What Problem Does This Paper Address?

Sarcasm is a pervasive and challenging phenomenon in online communication. While humans can often detect sarcasm through tone, facial expressions, and context, it's significantly harder for machines. Sarcasm often involves saying the opposite of what is meant, using exaggerated language, and can be subtle, making it a major hurdle for sentiment analysis and opinion mining. Existing automated sarcasm detection methods often rely on hand-crafted features, which struggle with the informal language and slang common on social media, or use deep learning models that achieve high accuracy but lack transparency, making it difficult to understand their decision-making process. This paper aims to bridge this gap by developing a high-performing, yet interpretable, deep learning model for sarcasm detection.

Methods

The proposed model integrates several key components:

  • Data Pre-Processing: Input text is tokenized and converted into pre-trained word embeddings (e.g., BERT, ELMO, GloVe, FastText). The paper emphasizes using embeddings that capture global context.
  • Multi-Head Self-Attention: This is the core of the model's interpretability. It allows the model to weigh the importance of different words in a sentence for sarcasm detection. By using multiple "heads," the model can capture diverse relationships between words. The attention mechanism helps identify crucial "cue-words" that signal sarcasm.
  • Gated Recurrent Units (GRUs): After the self-attention module highlights important words, GRUs are used to learn long-range dependencies between these cue-words. This helps in understanding how these highlighted words interact within the sentence's context. A bi-directional GRU is employed to capture context from both directions.
  • Classification: A fully-connected layer with a sigmoid activation function takes the output from the GRU and produces a probability score indicating the likelihood of sarcasm.
  • Model Interpretability: The authors leverage the inherent interpretability of the self-attention mechanism. By visualizing the attention weights, they can identify which words the model focused on when making a prediction, thus explaining its reasoning.

Datasets

The paper evaluates its model on several publicly available datasets:

  • Twitter, 2013: Tweets labeled by human annotators based on content, without conversational context.
  • Dialogues, 2016 (Sarcasm Corpus V2): Annotated quote-response pairs from online arguments, where the quoted text serves as context.
  • Twitter, 2017: Tweets collected via a bot, including user mood and reply context.
  • Reddit, 2018 (SARC 2.0): Self-annotated comments from Reddit forums, using an "\s" token to indicate sarcasm.
  • Headlines, 2019: News headlines from "The Onion" (sarcastic) and real news sites, with the article serving as context.

Key Insights and Ideas

  • Interpretability is Key: The paper strongly advocates for interpretable AI, especially in sensitive areas like social media analysis, where understanding why a prediction is made is as important as the prediction itself.
  • Self-Attention as an Explainer: The multi-head self-attention mechanism is not just for performance but is explicitly chosen for its ability to highlight important words, providing a direct window into the model's decision-making process.
  • Contextual Embeddings Matter: The authors found that using word embeddings that capture global context (like BERT) is crucial for effective sarcasm detection.
  • Sarcasm Cues Vary: The attention analysis reveals that different heads within the self-attention layers focus on different types of sarcastic cues, demonstrating the model's ability to capture nuanced linguistic patterns.
  • Interrogative Sentences are Tricky: The model, like human annotators, struggles with interrogative sentences (questions) for sarcasm detection, especially without explicit conversational context.

Key Results

The proposed model achieved state-of-the-art results across all tested datasets, outperforming previous methods by a considerable margin. For example, on the Twitter 2013 dataset, the model achieved an F1 score of 98.7%, a significant improvement over existing methods. The ablation studies confirmed the effectiveness of the multi-head self-attention layers and the GRU component. Visualizations of attention weights demonstrated that the model successfully identifies words that are indicative of sarcasm, assigning them higher attention scores.

Limitations and Future Work

  • Interrogative Sentences: The paper acknowledges that the model has difficulty correctly classifying interrogative sentences, particularly when they end with a question mark, and suggests this is a challenging area even for human annotators.
  • Context Dependency: While the model performs well, the paper notes that for certain "hard samples," especially those ending with an exclamation mark, classifying them correctly without prior knowledge or context remains difficult.
  • Future Work: The authors suggest further exploration into improving the model's ability to handle context-dependent sarcasm and potentially extending the interpretability analysis to more complex scenarios.

Summary updated

BibTeX
@inproceedings{akula2021interpretable,
  author = {Ramya Akula and Ivan Garibay},
  title = {{Interpretable Multi-Head Self-Attention Architecture for Sarcasm Detection in Social Media}},
  booktitle = {Entropy},
  year = {2021},
  url = {https://openreview.net/forum?id=ft5ry3jyrq},
}
Figure