Introduction
Language is inherently dynamic. The semantic meaning of words shifts over time due to cultural, social, and technological changes. For instance, the word "mask" evolved from a niche medical or theatrical item to a ubiquitous daily essential during the COVID-19 pandemic. Standard Masked Language Models (MLMs) like BERT are typically trained on static snapshots of text, leaving them unable to account for these temporal shifts without costly retraining. This paper introduces a novel approach to update MLMs using "temporal prompts"—sentences that describe shifting word associations—to achieve state-of-the-art performance in capturing dynamic word meanings across different eras.
Methodology: Template-based Temporal Adaptation
The authors propose Dynamic Contextualised Word Embeddings (DCWEs) generated through a process called Template-based Temporal Adaptation. Instead of retraining on massive new corpora, the model is "taught" about linguistic evolution using structured prompts. The pipeline consists of four primary stages:
- Pivot Selection: Identifying "pivot" words that appear in two distinct time periods ($T_1$ and $T_2$) but exhibit potential semantic shifts.
- Anchor Extraction: For each pivot word, "anchor" words are identified that are strongly associated with it in $T_1$ versus $T_2$. For example, for the pivot "mask," an anchor in 2010 might be "hide," while in 2020, it might be "vaccine."
- Template Filling: Triplets of (pivot, anchor1, anchor2) are inserted into templates.
- Manual Templates: Human-crafted sentences like: "⟨mask⟩ is associated with ⟨hide⟩ in 2010, whereas it is associated with ⟨vaccine⟩ in 2020."
- Automatic Templates: A T5 model is used to learn shorter, more diverse templates from unlabeled data, enhancing generalizability.
- Fine-tuning: The pretrained MLM is fine-tuned on these generated prompts using a standard masked language modeling objective.
The study compares three selection strategies for word triplets: Frequency-based, Diversity-based (using Jaccard similarity), and Context-based (using cosine similarity of existing embeddings).
Experimental Setup
The methodology was evaluated across four diverse datasets representing different domains and time spans:
- Yelp: Business reviews (2010 vs. 2020).
- Reddit: Social media comments (2019 vs. 2020, capturing the pre/post-COVID shift).
- ArXiv: Scientific abstracts (2001 vs. 2020).
- Ciao: Product reviews (2000 vs. 2011).
Results and Discussion
The proposed method consistently outperformed existing state-of-the-art models, such as TempoBERT, across all datasets. A key metric for evaluation was perplexity, which measures how well the model predicts new text.
As shown in the figure above, the model's performance varies based on the number of prompts ($k$) and the selection method used. On the ArXiv dataset, fine-tuning reduced perplexity to 3.499, a dramatic improvement over the original BERT's 11.142. Notably, the Context-based selection method (blue and red lines) often yielded the most stable or superior results, as it effectively filters noise to identify genuine linguistic evolution.
Furthermore, Automatic Templates (generated by T5) generally proved more effective than manual ones. These templates were typically shorter and better at covering a wide variety of word pairs, leading to improved model "worldviews" with minimal data. The efficiency of this approach is significant: substantial gains are achieved with as few as 500 to 5,000 prompts, representing a tiny fraction of the data required for full retraining.
Conclusion and Future Work
This research demonstrates that language models can be effectively updated to reflect temporal changes through targeted prompt-based fine-tuning rather than exhaustive retraining. However, several avenues for future work remain. The current study is limited to English; more morphologically complex languages may present different challenges. Additionally, while the model accounts for time, word meanings are also influenced by geography and social demographics. Incorporating these multi-dimensional factors into temporal adaptation is a vital next step for creating truly robust and context-aware AI.
Summary updated