Abstract
The abundance of social media data has presented opportunities for accurately determining public and group-specific stances around policy proposals or controversial topics. In contrast with sentiment analysis which focuses on identifying prevailing emotions, stance detection identifies precise positions (i.e., supportive, opposing, neutral) relative to a well-defined topic, such as perceptions toward specific global health interventions during the COVID-19 pandemic. Traditional stance detection models, while effective within their specific domain, often lag in performance when applied to new domains and topics due to changes in data distribution. This limitation is compounded by the scarcity of domain-specific, labeled datasets. A solution we present in this paper combines counterfactual data augmentation with contrastive learning to enhance the robustness of stance detection across domains and topics of interest. We evaluate the performance of current state-of-the-art stance detection models relative to our proposed framework, STANCE-C3 (domain-adaptive Cross-target STANCE detection via Contrastive learning and Counterfactual generation). Empirical evaluations demonstrate STANCE-C3's consistent improvements over baseline models with respect to accuracy across domains and varying focal topics.
Introduction: Beyond Sentiment Analysis
Stance detection is the specialized task of determining whether a piece of text is In Favor of, Against, or Neutral toward a specific target. While often confused with sentiment analysis, stance detection is fundamentally target-specific. For instance, a social media post might express negative sentiment ("I hate the inconvenience of these rules") while maintaining a supportive stance toward the target policy ("but I will wear a mask to protect others").
The Challenge of Domain and Target Shift
A significant hurdle in deploying stance detection for real-world policy-making is the problem of domain and target shift. A model trained to detect stances on COVID-19 vaccines often fails when applied to mask-wearing or school closures. This occurs because models frequently develop "attention bias," latching onto specific keywords (e.g., "needle," "vax") that are absent in the new topic. Since creating labeled datasets for every emerging controversy is prohibitively expensive and slow, there is a critical need for models that can generalize across domains.
Methodology: The STANCE-C3 Framework
To address these challenges, we introduce STANCE-C3 (domain-adaptive Cross-target STANCE detection via Contrastive learning and Counterfactual generation). The framework rests on two primary pillars:
- Counterfactual Data Augmentation (CDA): Utilizing a T5 language model, the system identifies terms related to a source domain (e.g., vaccines) and replaces them with terms from a target domain (e.g., masks) while preserving the original sentence structure and stance. This creates synthetic training data that teaches the model the linguistic structure of support or opposition, independent of the specific topic.
- Modified Supervised Contrastive Learning (SCL): The model employs a specialized loss function that clusters representations of text with the same stance while pushing apart those with different stances in the embedding space. By incorporating a cosine similarity term, the model is forced to ignore domain-specific noise and focus on domain-invariant features of a stance.
Experimental Evaluation and Key Insights
The study utilized two primary Twitter-based datasets: CoVaxNet (COVID-19 vaccination tweets split into pre- and post-FDA approval periods) and COVID-19-Stance (covering targets like masking, school closures, and stay-at-home orders).
Our empirical results yielded several key insights:
- Cross-Target Superiority: In experiments training on vaccine data and testing on mask-wearing or school closures, STANCE-C3 achieved an average accuracy of 0.816. This outperformed the best baseline (Llama-2-7B at 0.797) and significantly exceeded standard BERT (0.709).
- Temporal Robustness: When testing on the same topic across different time periods (domain shift), STANCE-C3 showed the least performance degradation among all tested models.
- Structure over Keywords: The success of the counterfactual approach suggests that the way opposition or support is expressed is often consistent across topics, even when the vocabulary changes.
- Efficiency of Specialized Models: Interestingly, the BERT-based STANCE-C3 model often outperformed a fine-tuned Llama-2-7B. This indicates that for specialized, safety-critical tasks like public policy analysis, a smaller, task-specific model can be more precise and robust than a general-purpose Large Language Model (LLM).
Conclusion
STANCE-C3 provides a robust framework for understanding public opinion in dynamic social media environments. By focusing on domain-invariant linguistic features through counterfactual generation and contrastive learning, the model overcomes the limitations of traditional keyword-heavy approaches. While the model currently requires a small "seed" of labeled data from the target domain (approximately 30%), it represents a significant step toward more agile and precise public policy analysis tools.
Summary updated