Abstract
Multi-label emotion classification remains a challenging task in Natural Language Processing due to the complex dependencies between emotional states and the difficulty of mapping specific textual features to multiple labels. We present SpanEmo, a novel framework that reimagines emotion classification as a span-prediction task. By incorporating emotion labels directly into the model's input and utilizing a label-correlation aware loss function, SpanEmo effectively captures overlapping emotional relationships. Our approach achieves state-of-the-art performance across English, Arabic, and Spanish datasets from SemEval-2018 Task 1.
Introduction
In real-world scenarios, human expression is rarely limited to a single emotion. A single sentence or tweet often conveys a mixture of feelings—for instance, a user expressing frustration over a service failure might simultaneously exhibit "anger" and "sadness." Traditional NLP models often struggle with this multi-label reality due to two primary limitations: the assumption of label independence and the failure to explicitly map textual triggers to specific labels when multiple emotions coexist. SpanEmo addresses these gaps by treating labels as part of the context and modeling their correlations explicitly.
Methodology
The core of SpanEmo is its shift from a standard classification head to a span-prediction framework, drawing inspiration from Question Answering (QA) architectures.
Span-Prediction Framing
Unlike traditional models that append a classification layer to a sentence representation, SpanEmo concatenates the set of possible emotion labels directly to the input sequence. The input is structured as [CLS] + [Emotion Labels] + [SEP] + [Sentence]. This configuration allows the self-attention mechanism of the underlying transformer (e.g., BERT) to learn direct, bidirectional associations between specific words in the sentence and the corresponding labels in the "label segment."
Joint Loss Function
To optimize the model for multi-label dependencies, SpanEmo employs a dual-loss strategy:
- Binary Cross-Entropy (BCE): Used to predict the presence or absence of each individual label.
- Label-Correlation Aware (LCA) Loss: A specialized ranking loss designed to maximize the distance between positive labels (present in the text) and negative labels. This forces the model to learn the underlying psychological co-occurrence patterns of emotions, such as the proximity of "joy" and "optimism" versus the distance between "joy" and "anger."
Experiments and Results
The model was evaluated on the SemEval-2018 Task 1 (Affect in Tweets) dataset, covering English, Arabic, and Spanish.
Quantitative Performance
SpanEmo established new state-of-the-art benchmarks across all tested languages. In English, it achieved a Micro F1 of 0.713 and a Jaccard Score of 0.601. The gains were even more pronounced in Arabic and Spanish, with Macro F1 improvements of up to 3.6% and 9.2%, respectively. Ablation studies confirmed that the inclusion of the "Label Segment" in the input was the most critical factor, contributing more to performance gains than the specialized loss function alone.
Qualitative Analysis
Visualization of attention weights demonstrates the model's ability to discern linguistic nuances. As shown in the heatmap below, the model correctly associates specific tokens with their corresponding emotional labels, even in complex sentences where the overall sentiment might be ambiguous.
Discussion and Conclusion
SpanEmo demonstrates that treating labels as context significantly enhances a model's ability to handle multi-label emotion classification. By acknowledging the inherent correlations between emotions through the LCA loss and the span-prediction architecture, the model moves closer to a human-like understanding of affect.
While the model shows superior performance, challenges remain in distinguishing between highly similar negative emotions like "anger" and "disgust." Additionally, the increased sequence length due to label concatenation introduces a minor computational overhead. Future work will explore the generalizability of the span-prediction approach to other multi-label tasks such as topic classification and intent detection.
Summary updated