Skip to content

RUC-NLPIR/LawThinker-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨ LawThinker: A Deep Research Legal Agent
in Dynamic Environments

arXiv License: MIT Python
If you find our work useful, please ⭐ star this repository for the latest updates.

🎥 Demo

Legal_Consultation.mp4
Document_Generation.mp4

💡 Overview

Legal reasoning requires not only correct outcomes but also procedurally compliant reasoning processes. However, existing methods lack mechanisms to verify intermediate reasoning steps, allowing errors such as inapplicable statute citations to propagate undetected through the reasoning chain. To address this, we propose LawThinker, an autonomous legal research agent that adopts an Explore-Verify-Memorize strategy for dynamic judicial environments. The core idea is to enforce verification as an atomic operation after every knowledge exploration step. A DeepVerifier module examines each retrieval result along three dimensions of knowledge accuracy, fact-law relevance, and procedural compliance, with a memory module for cross-round knowledge reuse in long-horizon tasks. Experiments on the dynamic benchmark J1-EVAL show that LawThinker achieves a 24% improvement over direct reasoning and an 11% gain over workflow-based methods, with particularly strong improvements on process-oriented metrics. Evaluations on three static benchmarks further confirm its generalization capability.

🧩 Method

We propose LawThinker, an autonomous legal research agent designed for dynamic judicial environments. LawThinker adopts an Explore-Verify-Memorize strategy that integrates iterative knowledge exploration with explicit verification throughout the reasoning process. When encountering knowledge gaps, the agent autonomously retrieves relevant legal provisions, cases, and procedural rules from external knowledge bases. Each retrieval is immediately followed by a DeepVerifier module, which examines the accuracy of the retrieved content, its relevance to the case facts, and whether its use conforms to legal procedures. The structured verification results are fed back into the reasoning chain, allowing the agent to correct errors before they propagate to subsequent steps. To support long-horizon interactive tasks, a memory module persistently stores validated legal knowledge and key case context, enabling the agent to reuse verified information across multiple reasoning turns.

🧩 Tools

We design 15 legal tools spanning exploration, verification, and memorization, enabling the agent to navigate the legal knowledge space, validate intermediate reasoning steps, and reuse verified information across long-horizon tasks.

🔧 Installation

Environment Setup

# Create conda environment
conda create -n j1 python=3.10
conda activate j1

# Install requirements
cd LawThinker
pip install -r requirements.txt

🏃 Quick Start

Data Preparation

Model Inference

bash src/run_J1-ENVS.sh

Evaluation

python src/run_J1-Eval.sh

📄 License

This project is released under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors