Abstract
Most natural language processing (NLP) models treat documents as isolated units, ignoring the rich context provided by a user's communication history. This paper introduces the Message-Level Transformer (MeLT), a hierarchical architecture designed to capture user-level context through a novel "Masked Document Modeling" pre-training routine. By learning to reconstruct missing messages within a user's timeline, MeLT develops a latent understanding of long-term semantic patterns. Our evaluation on a Twitter stance detection benchmark demonstrates that MeLT achieves state-of-the-art performance, significantly outperforming standard word-level models and simple history-concatenation baselines.
Introduction
Transfer learning in NLP, exemplified by models like BERT, typically operates at the token level within individual documents. However, social media communication is inherently hierarchical: words form messages, and sequences of messages form a user's broader narrative. For tasks like stance detection—identifying a user's position on a topic—the isolated text of a single tweet is often insufficient. A user's historical posts offer vital clues about their underlying beliefs and linguistic style. Despite previous attempts to incorporate user history via vector concatenation, there remains a need for generic, pre-trained hierarchical models that can capture message-level context in a latent space before task-specific fine-tuning.
Methodology: The Message-Level Transformer
The MeLT architecture builds upon a standard word-level language model (e.g., DistilBERT) to process document sequences. The primary innovation is the Masked-Document Reconstruction pre-training task.
The process involves three main stages:
- Aggregation: A user's chronological tweets are passed through a frozen word-level model. The resulting word tokens are averaged to produce a single "message vector."
- Masking: Following the BERT paradigm, 15% of messages in a sequence are masked or randomized.
- Reconstruction: A message-level transformer processes the sequence. Instead of predicting discrete tokens, it uses Mean Squared Error (MSE) loss to reconstruct the latent representation of the masked message based on surrounding context.
During fine-tuning for stance detection, the model processes up to 40 historical messages alongside the target message, feeding the final representations into a 2-layer feed-forward network.
Experimental Setup
Datasets
Pre-training was conducted on a dataset of 10 million tweets from 6,000 users (1.3 GB), focusing on method efficacy rather than massive scale. For evaluation, the authors utilized the SemEval 2016 Task 6 stance detection dataset, augmented with user timelines as per Lynn et al. (2019). Due to data decay, the final evaluation set comprised 3,021 instances across five targets: Abortion, Atheism, Climate Change, Hillary Clinton, and Feminism.
Results and Discussion
MeLT demonstrated superior performance across all metrics compared to established baselines.
Key Findings
- Contextual Predictability: The success of Masked Document Modeling confirms that surrounding tweets can effectively predict the semantic content of a missing message, forcing the model to learn global user knowledge.
- Joint Fine-Tuning: While the base model is frozen during pre-training, unfreezing both word and message layers during fine-tuning is essential for adapting to specific domain nuances (e.g., Twitter discourse).
- Model Efficiency: A 2-layer message-level transformer performs competitively with a 6-layer version for histories up to 40 messages, suggesting high efficiency for moderate context windows.
- Modular Gains: MeLT consistently improves performance regardless of the underlying word-level model (DistilBERT or DistilRoBERTa), highlighting its versatility.
Conclusion
MeLT establishes a robust framework for hierarchical language modeling that natively integrates personal context. While limited by the ephemeral nature of social media data and the relatively small pre-training scale, the results indicate that message-level pre-training is a powerful tool for user-centric NLP tasks. Future work may extend this approach to demographic prediction, emotion forecasting, and personalized recommendation systems.
Summary updated