TIMER: Temporal Instruction Modeling and Evaluation for Longitudinal Clinical Records

Hejie Cui, Alyssa Unell, Bowen Chen, Jason Alan Fries, Emily Alsentzer, Sanmi Koyejo, Nigam Shah

Abstract

Large language models (LLMs) have emerged as promising tools for assisting in medical tasks, yet processing Electronic Health Records (EHRs) presents unique challenges due to their longitudinal nature. While LLMs' capabilities to perform medical tasks continue to improve, their ability to reason over temporal dependencies across multiple patient visits and time frames remains unexplored. We introduce TIMER (Temporal Instruction Modeling and Evaluation for Longitudinal Clinical Records), a framework that incorporates instruction-response pairs grounding to different parts of a patient's record as a critical dimension in both instruction evaluation and tuning for longitudinal clinical records. We develop TIMER-Bench, the first time-aware benchmark that evaluates temporal reasoning capabilities over longitudinal EHRs, as well as TIMER-Instruct, an instruction-tuning methodology for LLMs to learn reasoning over time. We demonstrate that models fine-tuned with TIMER-Instruct improve performance by 7.3% on human-generated benchmarks and 9.2% on TIMER-Bench, indicating that temporal instruction-tuning improves model performance for reasoning over EHR.

Introduction

Modern Large Language Models (LLMs) have demonstrated significant potential in clinical applications, yet they often struggle with the longitudinal nature of Electronic Health Records (EHRs). A primary issue is "recency bias," where models prioritize the most recent clinical notes at the expense of historical data. In practice, physicians must synthesize information across years of patient history to manage chronic conditions and track treatment efficacy.

Current benchmarks often focus on single-visit tasks, failing to evaluate a model's ability to "connect the dots" over time. This leads to "chronological confusion" and a "lost-in-the-middle" phenomenon, where intermediate clinical events are overlooked. To address these gaps, we present the TIMER framework, which introduces temporal grounding as a core requirement for clinical reasoning.

Overview of the TIMER framework, contrasting current limitations in clinical LLMs with the proposed benchmarking and instruction-tuning solutions.

Methodology: TIMER-Bench and TIMER-Instruct

The TIMER framework introduces two key innovations to enhance temporal reasoning in LLMs:

TIMER-Bench: A Time-Aware Evaluation

TIMER-Bench is the first benchmark designed to evaluate temporal reasoning over longitudinal EHRs. Unlike standard medical benchmarks, every instruction-response pair in TIMER-Bench is grounded in "time evidence" ($T_i$). Models are required to cite specific dates and visits to justify their answers, ensuring that reasoning is chronologically accurate. The benchmark includes both "edge-focused" samples (beginning and end of records) and "uniform" samples (events spread across the timeline).

TIMER-Instruct: Temporal Instruction Tuning

To improve model performance, we developed TIMER-Instruct, a methodology for instruction-tuning. We generated 15,000 synthetic instruction-response pairs using Gemini 1.5 Pro from a dataset of 3.67 million unique patients (1990–2024). We explored three temporal distributions for training: recency-focused, edge-focused, and uniformly-distributed. The training process forces the model to include specific timestamps in its responses, effectively acting as a regularizer against hallucinations regarding the sequence of clinical events.

Results and Discussion

Our experiments using Llama-3.1-8B demonstrate that temporal instruction-tuning significantly enhances clinical reasoning.

Performance Gains

Models fine-tuned with TIMER-Instruct showed a 7.3% improvement on the human-curated MedAlign benchmark and a 9.2% improvement on TIMER-Bench. These results indicate that explicitly training models to recognize and cite temporal evidence improves their ability to handle complex longitudinal records.

The "Lost-in-the-Middle" Phenomenon

A significant finding was that LLMs naturally exhibit a bias toward the start and end of long records when generating training data. We found that training on a uniform distribution of instructions was the most effective strategy for mitigating this bias, leading to robust performance across all types of temporal queries.

Clinical Validation

The clinical relevance of TIMER-Bench was validated by human clinicians, who gave it a score of 95/100 for relevance and 98/100 for factual accuracy. Qualitative case studies further showed that tuned models achieved higher "temporal precision," correctly identifying relevant time windows for trend analysis rather than including irrelevant historical data.

Conclusion

The TIMER framework addresses a critical blind spot in medical AI by enabling LLMs to reason effectively over longitudinal clinical records. By incorporating time evidence into both evaluation and training, TIMER-Instruct reduces recency bias and improves the accuracy of long-term clinical trend analysis. While context window limitations remain a challenge, this work provides a foundation for developing more sophisticated, time-aware assistive tools for clinicians.

Summary updated

BibTeX
@article{cui2025timer,
  author = {Hejie Cui and Alyssa Unell and Bowen Chen and Jason Alan Fries and Emily Alsentzer and Sanmi Koyejo and Nigam Shah},
  title = {{TIMER: Temporal Instruction Modeling and Evaluation for Longitudinal Clinical Records}},
  journal = {Npj Digit. Medicine},
  year = {2025},
  doi = {10.1038/s41746-025-01965-9},
}
Figure