Introduction
Temporal reasoning (TR)—the capacity to understand the chronological order of events, their durations, and the complex relationships between them—is a cornerstone of human cognition. While Large Language Models (LLMs) have demonstrated remarkable capabilities in general logic and text generation, they frequently struggle with temporal tasks. This difficulty arises because temporal information in natural language is often implicit, non-linear, or fragmented across a narrative. Current approaches, such as simple prompting or fine-tuning on raw text, often fail to capture the underlying logical structure of a timeline.
This paper introduces TG-LLM, a novel framework designed to bridge this gap. TG-LLM moves beyond raw text processing by introducing a structured intermediate representation: the Temporal Graph (TG). By translating messy natural language into a latent graph and then reasoning over that graph, the framework enables models to achieve state-of-the-art performance in temporal reasoning tasks.
The TG-LLM Framework
The core of the TG-LLM approach is a two-step pipeline that transforms a linguistic problem into a structural one. This scaffold allows the model to offload the complexity of narrative tracking into a clear, mathematical representation.
- Text-to-TG Translation: In the first stage, the model extracts entities, relations, and timestamps from the source text to construct a chronological timeline. To enhance accuracy, the authors utilize a pipeline that identifies valid time expressions and incorporates "External Knowledge" (EK). This knowledge includes explicit calculations, such as determining the exact number of years between two dates, which prevents the model from relying on error-prone estimations.
- Temporal Graph Reasoning: Once the graph is constructed, the model performs Chain-of-Thought (CoT) reasoning directly on the structured data rather than the original story. This ensures that the reasoning process is grounded in the extracted facts.
Training Strategies
To optimize the performance of smaller models like Llama2-13B, the authors employed two sophisticated training strategies:
- CoT Bootstrapping: The researchers used high-capacity models (GPT-3.5 and GPT-4) to generate a variety of reasoning paths. They then applied a contrastive learning score to filter these paths, selecting only the most diverse and logically sound examples to fine-tune the target model.
- Graph Data Augmentation: To ensure the model learns the fundamental logic of timelines rather than memorizing specific facts, the training data was systematically perturbed. These augmentations included replacing relations with synonyms (e.g., changing "married to" to "became life partner"), removing irrelevant edges to simplify the graph, and globally shifting entity names and dates.
Experimental Results
The TG-LLM framework was evaluated across three primary datasets: TGQA (a new synthetic dataset based on the YAGO11k knowledge graph), TimeQA (Wikipedia-style biographies), and TempReason (focused on multi-level temporal relations).
The results demonstrate the clear superiority of the graph-based approach:
- Performance vs. GPT-4: On the TGQA dataset, a Llama2-13B model using the TG-LLM framework achieved an Exact Match (EM) score of 0.797, outperforming GPT-4’s score of 0.772.
- Generalization: The model showed strong transferability. When trained on synthetic data and tested on TempReason, it achieved an EM of 0.356, nearly tripling the performance of a vanilla Llama2-70B model (0.128).
- Logical Consistency: Human evaluations indicated that the combination of bootstrapping and augmentation reduced logical errors and factual hallucinations by over 50% compared to standard few-shot prompting methods.
Conclusion and Future Work
TG-LLM proves that structured intermediate representations can significantly enhance the reasoning capabilities of LLMs. By converting narratives into temporal graphs, the framework allows models to treat temporal reasoning as a calculation rather than an estimation.
Despite these gains, challenges remain in the realm of "temporal commonsense"—such as understanding that a human cannot live for 200 years. Future research will focus on integrating these commonsense constraints into the graph construction phase and exploring abductive reasoning to infer causes from temporal effects.
Summary updated