A Fine Line Between Irony and Sincerity: Identifying Bias in Transformer Models for Irony Detection (2023)

Abstract: In this paper we investigate potential bias in fine-tuned transformer models for irony detection. Bias is defined in this research as spurious associations between word n-grams and class labels, that can cause the system to rely too much on superficial cues and miss the essence of the irony. For this purpose, we looked for correlations between class labels and words that are prone to trigger irony, such as positive adjectives, intensifiers and topical nouns. Additionally, we investigate our irony model’s predictions before and after manipulating the data set through irony trigger replacements. We further support these insights with state-of-the-art explainability techniques (Layer Integrated Gradients, Discretized Integrated Gradients and Layer-wise Relevance Propagation). Both approaches confirm the hypothesis that transformer models generally encode correlations between positive sentiments and ironic texts, with even higher correlations between vividly expressed sentiment and irony. Based on these insights, we implemented a number of modification strategies to enhance the robustness of our irony classifier.

## introduction irony is a complex form of figurative language with which people convey the opposite meaning of what they say. a typical example of verbal irony is the explicit expression of positive sentiment towards a negative situation or event. in some ironic statements, both the positive sentiment and the negative sentiment are expressed explicitly, like in the following example: "so nice of my stupid neighbor to start mowing the lawn in the morning". however, more subtle ironic statements make this paradox less obvious, if the speaker leaves out the explicit negative sentiment ("stupid"). when doing so, they assume the receiver of their message already knows the connotative sentiment linked to this situation. this assumption of connotative common-sense knowledge, along with the contradicting nature of the expression, makes automatic irony detection a notoriously hard task. since detecting irony can also be difficult for humans, we often use rhetorical devices such as exaggerations, metaphors and intonation (in spoken language) or tone to hint at the underlying irony. whereas traditional feature-based approaches have long been the go-to methodology, most stateof-the-art systems have switched to bi-directional transformers @xcite . these transformer systems have taken the lead for most benchmarks in natural language processing (nlp), thanks to their word and sentence representations. this leap did, however, come at the cost of model explainability and insights into feature importance, which are more easily accessible for traditional machine learning algorithms, such as logistic regression and decision tree. in this paper, we explore several explainability techniques and identify patterns in computational modeling of a fine-tuned transformer model for irony detection. in addition to existing metrics, we first search for potential biases in the data based on correlations between the irony label and lemmas in the train data. after investigating the impact of these bias words on the performance of our system (by replacing and removing them and checking the performance before and after), we combine this methodology with existing sota attribution techniques to verify whether they reveal similar patterns. ## related research as of late, transformer models have become an integral part of most state-of-the-art systems for irony detection. this can be done either through direct fine-tuning @xcite or by using the contextual embeddings from a transformer model as input for a different neural classifier, like a convolutional neural network (cnn) @xcite . in some cases, this transformer representation input was enriched with additional features, as cignarella et al. (2020) did by adding syntactic n-gram features. for dutch specifically, transformers have already been fine-tuned and (quite favorably) compared to feature-based models with a focus on modeling the implicit sentiments in ironic statements @xcite . the primary downside of these neural representation-based systems is that they are notoriously hard to interpret in a reliable way @xcite . nevertheless, plenty of attempts were made to explain such models. popular techniques to gain insights into transformer models can be classified in two groups: (1) feature perturbation and (2) attention-based approaches. most perturbation approaches, such as shap (lundberg and lee, 2017) and lime @xcite , are model-agnostic techniques that compare how changes in the input (feature representation) affect the output (prediction). while the aforementioned systems ignore the underlying model architecture, integrated gradients (ig) @xcite keeps track of the gradient changes caused by gradually lowering the feature values so as to find the features that arouse important gradient changes. as this makes it a neural-specific perturbation approach, it is positioned closer to the system architecture. one variation, called discretized integrated gradients (dig), grounds the perturbations in representations of sub-words that exist in the vocabulary of a transformer's tokenizer @xcite . by using real anchor-words with (mostly) lower feature values as interpolation points, this technique creates a non-linear path towards the padding-token (where all feature values are 0). the model-specific alternative (2) to perturbation approaches instead relies on the attention weights and estimates the feature importance by tracking the activations in the neural network for a single input. though popular, the use of attention weights as an explanation has been the topic of heavy discussion, with researchers opposing @xcite and supporting @xcite their reliability. the most popular explanation only accounts for the attention values in a single (usually the final) layer @xcite . more refined versions of this approach estimate the feature importances by combining the attention weights of different layers, either through av-eraging or with more sophisticated methods such as attention roll-out @xcite and layer-wise relevance propagation (lrp) @xcite . while the use of attention is especially popular in computer vision, the more advanced methods have been successfully implemented and validated for transformer models for nlp by @xcite , who showed that their improved implementation of lrp gives better classspecific explanations compared to roll-out because the latter tends to attach too much importance to irrelevant tokens. further mentions of lrp in this paper follow the implementation of @xcite . to our knowledge, model explainability has not been researched thoroughly for irony detection. for dutch, a manual analysis of wrong predictions already reveals some limitations of sota systems, including transformers @xcite . one of these limitations is a strong reliance on formulaic expressions and the hypothesis that (intense) positive sentiment is prone to function as an irony trigger. still, this remains largely based on intuition and does not include an extensive investigation with existing attribution techniques for explainability. ## explainability metrics to further solidify our understanding of how our system models irony, we also employ explainability metrics that account for the system architecture and the mechanisms that drive its decision-making. ## training with modified data as argued in section 4, the modified tweets can keep the same irony label as the original tweets. this means that they could also prove helpful as additional train data, as they introduce (1) more lexical variety to the data set by using less frequent synonyms and (2) are also examples of irony with a system prec. in while the augmented system may be more robust in practice, fine-tuning robbert on (2) the data set with modified examples shows no direct improvement over the original train set when evaluating on the held-out test set. we hypothesize this may be related to the fact that the same biases that are part of the train data are also present in the test data, as it is part of the same data set. ## conclusion in this paper we investigated the origin and effect of bias on automatic irony detection in dutch. by looking into the potential biases that could emerge from the data, we found that these can be classified into three categories: (1) positive sentiment words (mostly adjectives), (2) intensifiers, interjections and exclamations and (3) topical nouns. to investigate whether our fine-tuned transformer model uses these biases as trigger words, we evaluated the system performance on subsets that specifically contain those bias words (i.e. positive sentiment words and intensifiers) and compared the results to modified samples where the adjectives were replaced by synonyms and the intensifiers were removed. in addition, we also investigated how our system models irony using three state-of-the-art explainability techniques that assign feature attributions to each of the sub-tokens in a text: discretized integrated gradients (dig), layer integrated gradients (lig) and layer-wise relevance propagation(lrp). after generating lrp attributions for every text in our train set, we ranked the different sub-tokens according to their average impact on the prediction. both of these methods support the hypothesis that our fine-tuned system for irony detection strongly relies on positive sentiment and is particularly triggered by intense positive sentiment. although some of the common topics of ironic tweets are partially recognized as important and become slightly more important when the intensifiers are removed, the system generally does not pay too much attention to them. while intense positive sentiments are most commonly used in hyperboles or exaggerations, which is a rhetorical device used to support the expression of irony, they are not the sole solution for irony detection. as shown in our analysis, more subtle irony can go undetected and genuinely positive texts are often wrongly classified as ironic. therefore, we attempted to use modified samples with less intense sentiments to augment our train data. although there was no noticeable increase in performance in the held-out test set, further testing on new external data sets is needed to make reliable conclusions. for future research, we suggest further investigating how these biases could be mitigated to make sure genuine sentiment is not mistaken for irony. this could either be done by further augmenting the data or by adapting the model. a data-driven approach we propose is to create counterfactual samples, where an ironic tweet is made non-ironic and the other way around. this is, however, no simple feat due to the creativity in ironic expressions. likewise, our approach for creating modified samples can still be improved to result in a fully-automatic framework for data augmentation. as model adaptation, we propose improving the system with additional features that, for example, represent relevant common-sense knowledge. finally, it would also be interesting to use human annotations of trigger words for irony detection and compare the perspectives of annotators to the model explanation. in a different way, where the data set may rely on different patterns and biases. finally, despite the good agreement scores (a cohen's kappa of 0.84) for binary irony classification, this remains a complex task where annotators can be uncertain about the label. in the end, the annotators for any irony or sarcasm detection task can only make assumptions about what the author of a text intended to convey. for our setup, both the annotators and the automated system predict whether a text is ironic without considering the corresponding context. in a realistic setting, most social media texts are reactions to previous comments or external events that can be essential in order to recognize the irony. this means that the model predictions can differ from the annotated label but still be a plausible interpretation.