NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Role of Conversation Context for Sarcasm Detection in Online Interactions

Debanjan Ghosh, Alexander Richard Fabbri, Smaranda Muresan

Abstract

Sarcasm detection is a complex task in Natural Language Processing (NLP) because it often depends on the relationship between an utterance and its preceding context. This paper explores the effectiveness of incorporating conversational history into deep learning models for sarcasm detection. By evaluating Support Vector Machines (SVMs) and various Long Short-Term Memory (LSTM) architectures on social media datasets, the study finds that context-aware models—particularly those using attention mechanisms—achieve superior performance. These models successfully identify "trigger" sentences in the context that contrast with the sentiment of the response, mirroring human cognitive processes in sarcasm recognition.

Introduction

Detecting sarcasm is a notorious "hard problem" in NLP. Traditional models often analyze utterances in isolation, yet sarcasm is inherently interactional. It frequently relies on "semantic incongruity," where a speaker expresses a positive sentiment in response to a negative situation. Without the situational context, even humans struggle to distinguish sincere remarks from sarcastic ones. For instance, the phrase "One more reason to feel really great" only becomes clearly sarcastic when paired with a context like a report on airline safety failures. This research aims to bridge this gap by modeling the relationship between a reply and its conversational history.

Methodology

The researchers evaluated four primary modeling approaches to determine the most effective way to handle conversational context:

  1. SVM (Baseline): A Support Vector Machine utilizing hand-crafted features such as Bag-of-Words, sentiment lexicons, and specific sarcasm indicators (e.g., punctuation, intensifiers).
  2. LSTM (Response Only): A standard Long Short-Term Memory network analyzing only the sarcastic reply.
  3. Conditional LSTM: A model that processes the context first, using its final hidden state to initialize the LSTM that reads the response. This allows the model to interpret the response through the "lens" of the context.
  4. Attention-based LSTM: This architecture employs an attention mechanism to assign weights to different parts of the context, enabling the model to "attend" to specific triggers that likely prompted the sarcastic response.
Architecture of the Attention-based LSTM model for sarcasm detection.

Datasets

The study utilized two distinct social media datasets to ensure robust findings:

  • Discussion Forums: The Sarcasm Corpus V2 (from the Internet Argument Corpus), featuring "perceived sarcasm" labels crowdsourced from annotators who had access to the full context.
  • Twitter: A larger dataset where sarcasm was self-labeled by users via hashtags (e.g., #sarcasm). Conversation threads were reconstructed using "reply-to" metadata.

Key Results

The deep learning models incorporating context consistently outperformed both the response-only LSTM and the traditional SVM baseline.

Model Forum (Sarcasm F1) Twitter (Sarcasm F1)
LSTM (Response Only) 67.1% 65.19%
Conditional LSTM 73.32% 76.30%
Attention-based LSTM 73.70% 76.36%

Interestingly, the SVM baseline performed worse when context was added, suggesting that simple feature-based approaches struggle to distinguish between relevant context and noise.

Discussion and Insights

The "Trigger" Effect

By analyzing attention weights, the researchers visualized the model's focus. The models frequently attended to sentences in the context that exhibited an opposite sentiment to the reply, effectively capturing the incongruity defining sarcasm.

Attention heatmap highlighting the 'trigger' words in context and response, illustrating semantic incongruity.

Sentence vs. Word Attention

The study found that sentence-level attention outperformed word-level attention. The authors hypothesize that word-level attention may be prone to overfitting on smaller datasets, whereas sentence-level attention provides a clearer signal of the "triggering" event. Furthermore, a crowdsourcing experiment showed that the model's attention weights aligned with human judgment of "trigger" sentences approximately 41% of the time.

Limitations and Future Work

Despite the performance gains, challenges remain. The forum dataset's small size limits the potential of complex attention mechanisms. Additionally, this study focused on the immediate prior turn; however, in long threads, the sarcasm trigger might occur several posts earlier. Future research will explore long-range context and more subtle forms of sarcasm that rely on deep world knowledge rather than simple sentiment shifts.

Summary updated

BibTeX
@inproceedings{ghosh2017role,
  author = {Debanjan Ghosh and Alexander Richard Fabbri and Smaranda Muresan},
  title = {{The Role of Conversation Context for Sarcasm Detection in Online Interactions}},
  booktitle = {SIGDIAL Conference},
  year = {2017},
  doi = {10.18653/v1/w17-5523},
}
Figure