Time-aware Prompting for Text Generation

Shuyang Cao, Lu Wang

Abstract

Large language models (LLMs) often struggle with temporal grounding, as they are typically trained on static snapshots of data without an explicit sense of when a document was authored. This paper introduces time-aware prompting techniques—specifically textual and linear prompts—to inject temporal context into models like BART and T5. We evaluate these methods on a novel dataset, TEMPWIKIBIO, which tracks over 4 million Wikipedia biography revisions. Our results demonstrate that time-aware prompting significantly enhances the factuality and informativeness of generated text, particularly for information that evolves over time.

Introduction

Most state-of-the-art language models are "frozen in time," lacking an inherent understanding of the chronological context of their training data. This leads to a performance gap where models conflate facts from different eras or fail to adapt to information that changes after their training cutoff. For instance, a model might struggle to distinguish between a news report from 2010 and one from 2023. This paper addresses the challenge of temporal grounding: informing a model of a document's creation date to ensure chronologically accurate and factually consistent text generation.

Methods: Injecting Temporal Context

The authors propose two primary methods for integrating time into the generation process:

  1. Textual Prompts: A natural language string (e.g., "Today is 18 January 2015") is prepended to the input. This approach leverages the model's pre-existing linguistic capabilities to interpret dates.
  2. Linear Prompts: A more architectural intervention where temporal components (Year, Month, Day) are treated as normalized scalars. These are projected through a linear layer into continuous vectors and prepended to the model's hidden states in the encoder or decoder. This allows the model to represent time as a continuous axis.
Architecture of the Linear Prompting method, showing how normalized date components are transformed into prompt vectors for the Encoder and Decoder.

Datasets and the TEMPWIKIBIO Benchmark

To evaluate these methods, the study utilizes three datasets, including a major new contribution:

  • TEMPWIKIBIO: A dataset of over 4 million chronologically ordered revisions of English Wikipedia biographies from 2004 to 2021. Each revision is paired with a structured infobox, enabling the tracking of biographical changes (e.g., occupation, death date) over decades.
  • Content Transfer: Focuses on generating Wikipedia passage continuations based on cited news articles.
  • XSum: A standard summarization dataset where the publication date serves as the temporal anchor.
Overview of the TEMPWIKIBIO dataset, illustrating the chronological timeline of revisions and examples of how biographical facts change over time.

Key Insights

  • Modal Compatibility: Linear prompts excel with structured data (like infoboxes) by providing a mathematical representation of time. Textual prompts are more effective for natural language inputs, blending seamlessly with existing text.
  • Sensitivity vs. Robustness: Date perturbation experiments revealed that textual prompts are highly sensitive to date changes, while linear prompts are more robust, helping the model process non-temporal content without being overly distracted by specific dates.
  • The World Knowledge Gap: While prompts improve temporal factuality, they do not fully compensate for a lack of underlying world knowledge (e.g., understanding that financial reports for a quarter are released after the quarter ends).

Results and Discussion

Time-aware prompts outperformed no-prompt baselines in 87.5% of comparisons across BLEU, ROUGE, and METEOR metrics. Human evaluations confirmed significant boosts in factuality, particularly for temporal events like death dates. Furthermore, linear prompts showed superior extrapolation capabilities on "future" data splits, exhibiting less performance degradation than standard models.

Despite these gains, limitations remain. Current models still struggle with complex relative temporal reasoning. Additionally, the lack of automated metrics for temporal factuality necessitates expensive human evaluation. Future work should focus on integrating external world knowledge to help models understand the broader implications of specific dates.

Summary updated

BibTeX
@inproceedings{cao2022time,
  author = {Shuyang Cao and Lu Wang},
  title = {{Time-aware Prompting for Text Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.535},
}
Figure