Can LLMs Time Travel? Enhancing Temporal Consistency in Legal Agentic Search through Reinforcement Learning

Wei Fan, Yining Zhou, Mufan Zhang, Yanbing Weng, Yiran HU +6 more
5/25/2026
cs.CLcs.AI

Official code: AlexFanw/LegalSearch-R1 (6 stars, Apache-2.0, last commit 2025-12-09).

Abstract

While large language models (LLMs) augmented with agentic search capabilities show promise for legal reasoning, they overlook a fundamental constraint that applicable law must match the temporal context of each case, as retroactive application of statutes violates core legal principles and leads to erroneous conclusions. Our observations reveal that current legal LLMs suffer from temporal bias anchored to their training cutoff, while search agents rarely incorporate temporal constraints into queries, and that web search alone cannot provide the precise statute and precedent citations that legal reasoning demands. To address these challenges, we propose LegalSearch-R1, an end-to-end reinforcement learning framework that pairs local statute RAG for precise article matching with online web search for broader legal knowledge, trained on temporally-indexed data spanning multiple amendment periods to enforce temporal consistency. Extensive experiments on our benchmark covering 13 legal tasks demonstrate that our 7B-parameter agent outperforms state-of-the-art deep research frameworks and specialized legal LLMs by 12.9% to 29.8%, surpasses baselines by 57.7% to 80.3% on temporal consistency, and exhibits robust out-of-domain generalization. The code and data are available at https://github.com/AlexFanw/LegalSearch-R1.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
61Shell, PythonDec 9, 202510 months agoApache-2.0

Similar Papers

Cite this paper

@article{fan2026llms,
  title  = {Can LLMs Time Travel? Enhancing Temporal Consistency in Legal Agentic Search through Reinforcement Learning},
  author = {Wei Fan and Yining Zhou and Mufan Zhang and Yanbing Weng and Yiran HU and Tianshi Zheng and Baixuan Xu and Chunyang Li and Jianhui Yang and Haoran Li and Yangqiu Song},
  year   = {2026},
  eprint = {2605.25920},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.25920v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.25920.svg)](https://codeofpaper.com/paper/2605.25920)

Discussion