Abstract
Large Language Models (LLMs) frequently succumb to "shortcut learning," where they rely on superficial word associations rather than genuine causal relationships. This paper introduces ACWG (Automatic Counterfactual enhanced multi-instance contrastive learning based on Word-Group), a framework designed to identify influential word groups and utilize them for counterfactual data augmentation. By shifting focus from single tokens to word groups, ACWG enhances model robustness, adversarial resistance, and fairness across a variety of text classification domains.
Introduction: The Challenge of Shortcut Learning
Despite the high performance of modern text classification models, they often rely on spurious correlations. For instance, a sentiment classifier might associate a specific director's name with a positive label regardless of the review's actual content. This reliance on "shortcuts" leads to poor generalization on out-of-distribution (OOD) data.
Counterfactual augmentation—creating new training samples by flipping causal words—is a promising solution. However, existing methods are either non-scalable (human-in-the-loop) or limited to single-token interventions. Single-word changes often fail to shift the model's semantic understanding effectively.
Methodology: The ACWG Framework
The proposed ACWG framework automates the generation of high-quality counterfactuals through a three-stage process:
- Candidate Causal Word Mining: The system uses Integrated Gradients to identify the top 20% of words that most significantly influence the model's current predictions.
- Word-Group Search: Moving beyond single tokens, the framework employs a modified Beam Search combined with Jensen-Shannon Divergence (JSD). This identifies groups of words that, when modified together, produce the most substantial shift in output probability.
- Counterfactual Augmentation & Contrastive Learning:
- Negative Samples: Causal word groups are replaced with antonyms or masks to flip labels.
- Positive Samples: Non-causal words are masked to preserve the original label.
- Adaptive Voting: An attention-based mechanism weighs augmented samples during training, ensuring the model focuses on the most robust causal features.
Experimental Evaluation
The researchers evaluated ACWG on 12 diverse datasets across two domains:
- Sentiment Analysis: Amazon reviews (Books, DVD, Electronics, Kitchen), Movie Reviews (MR), FineFood, SST-2, and Kindle.
- Toxic Language Detection: Davidson, OffEval, ToxicTweets, and Abusive.
The evaluation focused on cross-domain generalization, adversarial robustness against attacks like TextFooler and PWWS, and gender fairness.
Key Results and Insights
- Superior Generalization: ACWG consistently outperformed BERT and RoBERTa baselines, as well as state-of-the-art methods like MASKER and C2L, in cross-domain tasks.
- Adversarial Defense: The framework showed significantly higher resistance to text attacks, maintaining accuracy even as the number of attacked words increased.
- Improved Fairness: By focusing on causal word groups rather than demographic shortcuts, the model reduced gender bias, achieving lower scores in False Positive/Negative Equality Difference (FPED/FNED).
- Label Flipping Rate (LFR): Targeting word groups proved more effective than single-word methods, resulting in a higher rate of successful label flips for counterfactual data.
Conclusion and Future Work
While ACWG demonstrates significant improvements in robustness, applying it to hyperscale models remains computationally intensive. Future research will explore the use of large-scale generative models for more nuanced counterfactual creation and prompt-based learning to enhance robustness without full model fine-tuning.
Summary updated