Abstract
Supervised NLP models for emotion and hate-speech detection often suffer significant performance degradation when encountering "distribution shift"—real-world data that differs from their training sets. This research investigates the robustness of Natural Language Inference (NLI)-based models in these scenarios. We demonstrate that zero-shot NLI models frequently outperform traditional supervised models on out-of-distribution (OOD) data. Furthermore, we show that fine-tuning NLI models on a limited number of task-specific samples (approximately 3,200) creates a highly robust classifier that excels in both in-distribution (ID) and OOD environments.
The Challenge of Distribution Shift
In controlled environments, Transformer-based models achieve high accuracy on specific emotion detection datasets. However, performance often plummets when these models are deployed on different platforms (e.g., transitioning from Reddit to Twitter) or applied to new topics. This phenomenon, known as distribution shift, occurs because supervised models tend to overfit to the specific linguistic quirks and annotation biases of their training data rather than learning the underlying semantics of labels like "joy" or "anger." In subjective and evolving domains like emotion and hate-speech detection, this lack of robustness is a critical barrier to reliable real-world deployment.
Methodology: NLI as a Robust Alternative
The researchers compared standard supervised learning against NLI-based classification across ten diverse datasets.
NLI-based Zero-Shot Classification
Unlike standard classifiers that treat labels as arbitrary indices, NLI-based models leverage pre-existing semantic knowledge. By framing classification as an entailment problem—where the input text is the "premise" and the hypothesis is "This sentence expresses [label]"—the model can predict labels based on their inherent meaning.
Fine-tuned NLI
The study's primary contribution is the "Fine-tuned NLI" approach. By taking a large NLI-ready model (such as MNLI-RoBERTa-large) and fine-tuning it on a small amount of task-specific data, the model retains its broad semantic understanding while adapting to the nuances of the target task.
Experimental Setup and Datasets
The study utilized a wide range of benchmarks to test cross-dataset generalization:
- Emotion Detection: GoEmotions (mapped to Parrott and Ekman taxonomies), EmoEvent (Twitter), XED (movie subtitles), and M-Emotion.
- Hate-Speech Detection: Din-Gen (dynamically generated), YouTube HS, and WSF-HS (forum posts).
These datasets vary significantly in source, text length, and emotional definitions, providing a rigorous test for OOD performance.
Key Insights: Semantics and Sample Efficiency
The research yielded several critical findings regarding model robustness:
- Supervised Fragility: Traditional models often experience a 30% to 50% performance drop on OOD data, indicating they learn specific datasets rather than generalizable tasks.
- Zero-Shot Superiority: In many OOD scenarios, zero-shot NLI models—which have never seen the specific training distribution—outperform supervised models trained on thousands of samples from a different distribution.
- The 3,200-Sample Sweet Spot: Fine-tuning an NLI model with roughly 3,200 samples provides a substantial boost to ID performance without sacrificing OOD robustness.
Results and Conclusion
The results underscore the dominance of NLI architectures. For instance, the MNLI-DeBERTa-large model achieved an F1-score of 0.74 on the GoE-Parrott dataset in an OOD setting, significantly higher than supervised models like E-T5 (0.51). Similarly, the proposed fine-tuned NLI approach reached an F1 of 0.84 on the WSF-HS dataset, compared to 0.67 for the best native supervised model.
While future work is needed to explore these advantages in more objective tasks like legal analysis, the current findings suggest that NLI-based architectures are a significantly safer choice for developers deploying text classification models in unpredictable, real-world environments.
Summary updated