Navigating the Shortcut Maze: A Comprehensive Analysis of Shortcut Learning in Text Classification by Language Models (2024)

Abstract: Language models (LMs), despite their advances, often depend on spurious correlations, undermining their accuracy and generalizability. This study addresses the overlooked impact of subtler, more complex shortcuts that compromise model reliability beyond oversimplified shortcuts. We introduce a comprehensive benchmark that categorizes shortcuts into occurrence, style, and concept, aiming to explore the nuanced ways in which these shortcuts influence the performance of LMs. Through extensive experiments across traditional LMs, large language models, and state-of-the-art robust models, our research systematically investigates models’ resilience and susceptibilities to sophisticated shortcuts. Our benchmark and code can be found at: https://github.com/yuqing-zhou/shortcut-learning-in-text-classification.

## introduction language models (lms), from traditional ones like bert @xcite to recent large language models (llms) like llama @xcite , achieve advanced performance across a range of linguistic tasks. nonetheless, recent researches @xcite @xcite @xcite @xcite @xcite have highlighted a critical issue: these lms often rely on spurious correlations -features coincidentally associated with certain labels -rather than on causally relevant features. these misleading "shortcuts" can undermine the models' out-of-distribution (ood) generalizability. for instance, consider a beer review sentiment analysis task in figure 1 , where the training data unintentionally links casual language with high ratings and formal language with low ratings (due to the critical nature of professional reviewers). during testing, a model trained on such test dataset: data may erroneously base its predictions on these shortcuts, leading to misclassifications of positive reviews as negative if they are in a formal style. many studies have explored shortcuts in text classification @xcite @xcite @xcite . however, the shortcuts examined in these studies usually involve straightforward manipulations, such as appending specific letters, punctuation marks, or words to the beginning or end of a sample. these unrealistically explicit and overly simple shortcuts are easy to detect and unlikely to affect sophisticated llms. consequently, the effect of subtler, more complex, and realistic shortcuts on lms remains largely unexplored. critically, despite the advanced linguistic capabilities of llms and the efforts of robust models @xcite designed to neutralize explicit shortcuts, their resilience to subtler and intricate shortcuts presents an important unresolved challenge. addressing this gap necessitates the development of a comprehensive benchmark of subtler and more complex shortcuts, alongside thorough analysis of both llms and state-of-the-art (sota) robust models' ability to counteract these sophisticated shortcuts. hence, by extensively analyzing spurious correlations in text classification in existing research @xcite @xcite @xcite @xcite @xcite , we propose the first systematic shortcut framework with three main classes: occurrence, style, and concept. as illustrated in figure 2 , this framework categorizes shortcuts into seven types. under "occurrence", we consider the occurrence of a single term (a word, phrase, or sentence), synonyms, and category words as three different types of shortcuts. "style" encompasses language register (like formal vs. casual) and author style (like shakespeare vs. hemingway) as two different types. for "concept", we examine the occurrence of specific concepts and the sentiment correlation across concepts. this new framework effectively categorizes existing research findings. for instance, @xcite demonstrates that texts containing sensitive terms related to gender or race often spuriously correlate with the label "toxic", fitting into the "category" shortcut within the "occurrence" class. additionally, some types, like "synonym occurrence" and "concept occurrence", have not been investigated in prior research. furthermore, to facilitate empirical analyses, we construct a benchmark to exemplify this framework based on three public text classification datasets. then, we conduct extensive empirical analyses using the proposed shortcut benchmark to systematically investigate how these shortcuts influence three representative types of lms -a traditional small lm like bert @xcite , llm like llama2-7b, llama2-13b @xcite , and llama3-8b (ai@meta, 2024), and sota robust models designed to resist spurious correlations, such as a2r @xcite , cr @xcite , and afr @xcite . we find that bert is vulnerable to all types of shortcuts; increasing model size does not ensure better robustness; and robust models sometimes outperform llms in terms of robustness. however, none of them are universally robust against all these types of shortcuts, revealing the urgent need for more sophisticated methods to counteract these subtle and intricate shortcuts. our benchmark and code can be found at: https://github.com/yuqing-zhou/shortcut -learning-in-text-classification . ## shortcut framework and benchmark in this section, we introduce our shortcut framework and the process of constructing the shortcut benchmark based on three public text classification datasets. it is noteworthy that the key contribution of this work is the development of a shortcut framework that includes these three classes and seven specific types of shortcuts. we establish the benchmark with these three datasets to exemplify our framework and support empirical analysis. this methodology allows for creating additional benchmarks using other datasets and classification tasks, and different approaches to constructing shortcuts. ## empirical analyses in this section, we explore three research questions with the proposed benchmark. rq1: do small lms base their predictions on these sophisticated spurious correlations as shortcuts? rq2: are larger models, equipped with improved pretraining datasets, better at resisting these shortcuts, particularly in terms of the robustness of llms? rq3: can existing state-of-the-art (sota) robust learning methods counter proposed shortcuts? datasets shortcut types accuracy macro f1 test anti ∆ test anti ∆ yelp occur st .634 .364 .270 .625 .314 .310 syn .635 .448 .187 .634 .431 .203 catg .650 .381 .269 .652 .318 .334 style reg .608 .415 .193 .612 .397 .215 auth .604 .333 .271 .605 .271 .334 emotions occur st .914 .203 .712 .834 .353 .481 syn .910 .502 .408 .826 .489 .337 catg .915 .337 .578 .845 .418 .427 style reg .891 .302 .588 .805 .313 .491 auth .737 .187 .550 .642 .192 .451 beer concept occur .788 .664 .124 .786 .658 .128 corr .912 .695 .217 .905 .694 .211 ## related work with the tremendous progress of deep neural networks (dnns) in various language and vision tasks, there is a growing interest within the community regarding the mechanisms of learning within these models and the features they have captured for prediction. some recent studies have uncovered a shortcut learning phenomenon of dnns with the utilization of adversarial test sets @xcite and dnn explainability techniques @xcite @xcite . these works reveal that dnns tend to exploit spurious correlations, rather than focusing on higherlevel, task-relevant features in the training data. this tendency can result in poor performance when generalizing to out-of-distribution samples. this phenomenon of shortcut learning is observed across various language and vision tasks, including nli @xcite , question answering @xcite , reading comprehension @xcite , and vqa @xcite @xcite . for instance, @xcite found that bert uses lexical bias as a shortcut in nlu tasks. they explained this shortcut learning behavior as a consequence of a long-tailed distribution. tang et al. (2023) also focuses on nlu tasks, aiming to determine whether llms resort to shortcut strategies in nlu tasks even without parameter updates. in their experiments, they designed several spurious correlations or shortcut patterns, embedding them into multiple input-label pairs as prompts. however, these studies only consider simple and limited features as shortcuts and mechanically insert spurious correlations without considering the semantics of the original text. in contrast, we formally and systematically define various types of shortcut triggers and integrate them into a dataset as seamlessly as possible, without altering the original meaning of the text. ## conclusion in this paper, we aim to establish a benchmark for detecting shortcut learning behaviors in text classification tasks. we propose a series of definitions of text shortcuts, introduce a benchmark for lm robustness assessment against the defined shortcuts, and empirically demonstrate the susceptibility of bert, llama, and three sota robust models to occurrence, style, and concept-based shortcuts.