Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding, yet they consistently struggle with temporal reasoning—the ability to track and calculate time across extended interactions. In multi-session dialogues, where a user might reference events across weeks or months, LLMs often fail to resolve relative time expressions (e.g., "last Friday") or maintain a coherent sequence of events. This paper introduces TReMu (Temporal Reasoning for LLM-Agents with Memory), a framework designed to bridge this gap by combining time-aware memory structures with neuro-symbolic reasoning.
The Challenge of Temporal Reasoning in Dialogue
Existing temporal benchmarks often rely on static, short-form texts like Wikipedia snippets. However, real-world AI agents operate in dynamic, multi-session environments that introduce two primary complexities:
- Relative Time Expressions: Phrases like "yesterday" or "next week" are context-dependent. Without knowing the exact date a statement was made, the model cannot anchor the event in time.
- Cross-Session Dependency: Information is often fragmented across dozens of sessions. Historical noise and the sheer volume of tokens in long-term conversations make it difficult for models to retrieve and synthesize temporal data accurately.
The TReMu Framework
TReMu addresses these challenges through a two-pronged strategy that separates memory management from mathematical reasoning.
1. Time-Aware Memorization
Traditional memory systems typically summarize dialogue content without rigorous temporal metadata. TReMu, conversely, extracts specific events and infers their exact dates relative to the session timestamp. These events are organized into a structured timeline format. This distinction is critical: it allows the agent to differentiate between the mention time (when the speaker spoke) and the occurrence time (when the event actually happened).
2. Neuro-Symbolic Temporal Reasoning
While Chain-of-Thought (CoT) prompting can improve reasoning, LLMs remain prone to arithmetic hallucinations when calculating dates and durations. TReMu employs a neuro-symbolic approach by instructing the LLM to generate Python code instead of natural language reasoning. By utilizing libraries such as datetime and dateutil, the system offloads complex temporal math to a symbolic executor. This ensures that if the logic is correct, the mathematical output is guaranteed to be precise.
Experimental Setup and Benchmarking
To evaluate TReMu, the researchers developed a new benchmark by augmenting LoCoMo, a dataset of long-term conversations averaging 600 turns and 16,000 tokens. The benchmark consists of 600 multiple-choice questions across four categories:
- Temporal Anchoring: Identifying the specific date of an event.
- Temporal Precedence: Determining the chronological order of two events.
- Temporal Interval: Calculating the duration between events.
- Unanswerable Questions: Testing the model's ability to recognize when the provided history is insufficient to answer the query.
Key Results
The implementation of TReMu resulted in significant performance gains across various LLM architectures. Most notably, GPT-4o's accuracy surged from a baseline of 29.8% to 77.7%.
| Method | GPT-4o Accuracy | GPT-4o-mini Accuracy | GPT-3.5-Turbo Accuracy |
|---|---|---|---|
| Standard Prompting | 29.83% | 29.00% | 23.83% |
| Chain-of-Thought (CoT) | 61.67% | 45.67% | 25.83% |
| TReMu (Ours) | 77.67% | 51.17% | 33.67% |
Beyond raw accuracy, TReMu significantly improved the model's reliability. The F1-score for "Unanswerable" questions for GPT-4o rose from 20.84 to 64.42, indicating a much higher level of self-awareness regarding information gaps in the dialogue history.
Discussion and Future Work
The success of TReMu highlights that for complex tasks like temporal reasoning, symbolic execution is superior to pure linguistic "thought." However, the study also identified several limitations:
- Model Sensitivity: While high-tier models like GPT-4o excelled, open-source models (e.g., Llama-3-70B) struggled with the complex instruction-following required for the TReMu pipeline.
- Evaluation Format: The current benchmark is limited to multiple-choice questions. Future research is needed to evaluate temporal reasoning in open-ended, generative dialogue.
- Robustness: Although rare, execution failures (roughly 1.8% for GPT-4o) occur when the model generates syntactically incorrect Python code. Improving the robustness of the code-generation module remains a priority.
In conclusion, TReMu provides a scalable architecture for long-term AI agents, ensuring they can navigate the complexities of time as effectively as they navigate the nuances of language.
Summary updated