temporal reasoning
**Temporal reasoning** is the cognitive process of **understanding, representing, and reasoning about time, sequences, durations, and temporal relationships** — determining when events occur, how long they last, what order they happen in, and how temporal constraints affect conclusions.
**Why Temporal Reasoning Is Important**
- Many real-world problems involve **time** — scheduling, planning, understanding narratives, predicting sequences, and verifying temporal constraints.
- Correct temporal reasoning requires tracking **multiple timelines**, understanding **relative ordering**, and managing **duration and overlap** — capabilities that are surprisingly challenging for LLMs.
**Temporal Reasoning Types**
- **Ordering**: "Did event A happen before or after event B?" — establishing the sequence of events.
- **Duration**: "How long did event X take?" — understanding and computing time spans.
- **Overlap**: "Were events A and B happening at the same time?" — detecting temporal concurrency.
- **Frequency**: "How often does X occur?" — understanding recurring events and periodicity.
- **Relative Time**: "What happened 3 days before event Y?" — computing temporal offsets.
- **Temporal Logic**: "Is it always the case that A happens before B?" — formal temporal relationships.
**Temporal Reasoning Challenges for LLMs**
- **Implicit Time**: Many texts don't explicitly state timestamps — temporal relationships must be inferred from context ("after lunch," "the next morning," "meanwhile").
- **Multiple Timelines**: Narratives with flashbacks, parallel storylines, or hypothetical futures require tracking multiple temporal sequences simultaneously.
- **Calendar Arithmetic**: "What day is 45 days after March 15?" — requires knowledge of month lengths, leap years, etc.
- **Duration Estimation**: "How long would it take to drive 200 miles at 60 mph?" — requires computation, not just language.
- **Temporal Commonsense**: "Can you eat breakfast after dinner on the same day?" — requires understanding of typical daily schedules.
**Temporal Reasoning Examples**
```
Problem: "Alice started college in 2018.
She graduated 4 years later.
Bob graduated college in 2021.
Who graduated first?"
Temporal reasoning:
- Alice graduated: 2018 + 4 = 2022
- Bob graduated: 2021
- 2021 < 2022 → Bob graduated first.
```
**Temporal Relations (Allen's Interval Algebra)**
Formal framework for reasoning about time intervals:
- **Before/After**: A ends before B starts.
- **Meets**: A ends exactly when B starts.
- **Overlaps**: A starts before B but they overlap.
- **During**: B occurs entirely within A.
- **Equals**: A and B occupy the same time interval.
- **Starts/Finishes**: A and B share a start or end point.
**Temporal Reasoning in Applications**
- **Question Answering**: "When did X happen?" "What happened before Y?" — temporal QA requires understanding event ordering.
- **Planning**: "Schedule these tasks respecting dependencies and deadlines" — temporal constraint satisfaction.
- **Narrative Understanding**: Comprehending stories, histories, and news requires tracking temporal flow.
- **Medical Records**: Understanding patient timelines — when symptoms appeared, when treatments were administered, temporal gaps.
**Improving Temporal Reasoning in LLMs**
- **Explicit Timeline Construction**: Instruct the model to create a timeline before answering temporal questions.
- **Code-Based Reasoning**: Use datetime computation in code for calendar arithmetic.
- **Step-by-Step Temporal Analysis**: "First, identify all events and their times. Then, order them chronologically. Then, answer the question."
Temporal reasoning is a **fundamental cognitive capability** that underpins understanding of narratives, planning, scheduling, and any task involving the passage of time — and remains one of the more challenging reasoning types for language models.