Introduction
Stance detection—identifying whether a social media post is "in favor of," "against," or "neutral" toward a specific target—is a complex task. Individual tweets are often short, sarcastic, or lack explicit context. While standard Large Language Models (LLMs) like BERT are excellent at understanding word-level context within a single sentence, they struggle to capture the "social context" of the author. Previous research shows that knowing a user's history helps, but most models either treat user history as a separate, static component or lack a general way to pre-train a model to understand how messages relate to one another over time. MeLT (Message-Level Transformer) addresses this gap by creating a hierarchical transformer that learns to represent messages within the flow of a user's timeline.
Methods
The authors introduce a hierarchical architecture and a specific pre-training routine designed to capture long-term user context:
- The Architecture:
- Word-Level Layer: The model begins with a pre-trained word-level model (such as DistilBERT) to process individual messages and produce word embeddings.
- Aggregation: The word embeddings for a single message are averaged into a single "message vector."
- Message-Level Transformer: A second transformer sits on top, taking a sequence of these message vectors (up to 40 messages from a user's history) as input to capture long-term context.
- Masked Document Modeling (MDM): This is the paper's core innovation. Similar to how BERT masks words, MDM hides an entire message in a user's timeline. The model must reconstruct the missing message's aggregated vector using Mean Squared Error (MSE) loss. This forces the message-level transformer to learn how a user's thoughts and topics evolve over time.
- Fine-Tuning: For the final task of stance detection, a simple 2-layer feed-forward neural network is added on top of the pre-trained MeLT architecture. During this phase, "unfreezing" the underlying word-level model to allow it to update alongside the transformer proved crucial for adapting to the nuances of stance detection.
Experimental Setup
- Pre-training: A custom dataset of approximately 10 million tweets sampled from 6,000 users (~1.3 GB of data).
- Evaluation: The SemEval 2016 Task 6 stance detection dataset, extended with historical tweets for each author. The dataset covers five targets: Abortion, Atheism, Climate Change, Hillary Clinton, and Feminism.
Results and Discussion
MeLT achieved a state-of-the-art 67% F1 score on the stance detection task, outperforming the previous best-reported result of 66%. It significantly outperformed a standard DistilBERT model (60% F1) and versions that used history but lacked hierarchical pre-training (63% F1).
Key Insights
- Hierarchy is Essential: Moving from word-level to message-level modeling allows the model to capture the author's persona. Pre-training specifically for message sequences outperforms models that treat history as a static feature.
- Model Depth vs. History: A 6-layer message transformer showed better scaling as more historical messages were provided compared to a 2-layer version.
- Efficiency over Scale: By using a smaller base model (DistilBERT) and a modest pre-training set, the authors demonstrated that smart architectural choices can be more effective than simply increasing data scale.
- Target-Specific Gains: The model showed particularly strong performance on "Climate Change" (71% F1) and "Hillary Clinton" (67% F1), where historical context is a strong indicator of current stance.
Conclusion
MeLT demonstrates that hierarchical pre-training on message sequences effectively captures the social context necessary for high-accuracy stance detection. While the study was capped at 40 messages of history, the results suggest that Masked Document Modeling could be applied to other user-level tasks, such as personality prediction or mental health screening, in future research.
Summary updated