NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Prompt-Based Effective Input Reformulation for Legal Case Retrieval

Yanran Tang, Ruihong Qiu, Xue Li

TL;DR

PromptCase is a novel framework that improves legal case retrieval by moving away from "whole-text" matching, which is often noisy and exceeds the input limits of modern language models. By extracting specific legal facts and legal issues and using a prompt-based encoding scheme, it achieves state-of-the-art results in zero-shot settings across both common law and civil law datasets.

What Problem Does This Paper Address?

Legal Case Retrieval (LCR) is the backbone of legal research, helping practitioners find "precedents"—historical cases with similar facts and issues. However, modern neural models face two major hurdles:

  1. Legal Feature Alignment: Most models try to encode the entire text of a case. From a legal perspective, this is inefficient because much of the text is "noise." Relevance is determined by the alignment of specific legal features (like the specific dispute or the sequence of events), not just general word overlap.
  2. Legal Context Preservation: Legal documents are notoriously long, often ranging from 5,000 to 50,000 words. Standard models like BERT have a 512-token limit. Passively truncating these documents to fit the model leads to a massive loss of global context and often cuts out the most decisive legal information.

Methods

The authors propose PromptCase, which reformulates the input into a more digestible and semantically rich format.

1. Feature Extraction

Instead of using the whole text, the framework extracts two key features:

  • Legal Facts: The "who, when, what, where, and why." For English cases (COLIEE), the authors use ChatGPT to generate a 50-word summary of the "Background" section. For Chinese cases (LeCaRD), they extract the specific fact section directly from the text.
  • Legal Issues: The core points of dispute. In common law, these are often found in the "Analysis" section where judges reference precedents. In civil law, these often correspond to specific criminal charges (e.g., "murder" or "theft").

2. Prompt-based Encoding

The extracted features are fed into a Language Model (LM) using a specific prompt template (e.g., "Legal facts: [text]"). The framework uses a hybrid encoding approach:

  • Dual Encoding: Facts and issues are encoded separately to avoid "cross-noise" between them.
  • Cross Encoding: Facts and issues are encoded together to capture how they interact.

The final case representation is a concatenation of these embeddings, as illustrated in the framework overview:

The PromptCase framework: (a) extraction of facts/issues and (b) the dual/cross encoding architecture.

Datasets

The authors evaluated PromptCase on two major benchmarks representing different legal systems:

  • LeCaRD: A Chinese dataset (civil law) containing cases from the Supreme People's Court of China.
  • COLIEE2023: An English dataset (common law) featuring cases from the Federal Court of Canada.

The statistics in the table below highlight the "length challenge" PromptCase aims to solve, with cases reaching nearly 100,000 tokens.

Statistics of the LeCaRD and COLIEE2023 datasets.

Key Insights and Ideas

  • Structure is a Feature: Legal documents aren't just bags of words; they have a formal structure (Background, Analysis, Judgement). Exploiting this structure allows models to bypass the "noise" of a 50,000-word document.
  • Prompts as Semantic Anchors: Even in a zero-shot setting (no training), simply adding the prefix "Legal facts:" helps the language model focus its attention on the relevant semantic space.
  • System-Specific Focus: The importance of features varies by legal system. In common law, "issues" (precedents) are critical. In civil law, "facts" are often the primary driver for finding similar cases. PromptCase handles both by extracting them explicitly.
  • Discriminative Power: Visualizing the embeddings using t-SNE shows that PromptCase creates much tighter, more distinct clusters for different legal charges compared to standard models, which often struggle to distinguish between similar crimes like robbery and vandalism.

Key Results

PromptCase consistently improved the performance of various baseline models (BM25, BERT, Lawformer, SAILER) across both datasets.

  • Significant Boosts: On the LeCaRD dataset, adding PromptCase to the state-of-the-art SAILER model improved the NDCG@5 from 70.1% to 74.2%.
  • Common Law Success: On COLIEE2023, the improvement was even more pronounced, with SAILER's NDCG@5 jumping from 29.3% to 36.2%.
  • Semantic Understanding: The results indicate that while statistical models like BM25 are strong, they cannot fully capture the nuances of legal semantics. PromptCase allows neural models to finally leverage their semantic understanding without being overwhelmed by document length.

Limitations and Future Work

  • Extraction Heuristics: The current method relies on specific document structures or charge lists. While common in legal docs, highly unstructured legal texts might pose a challenge.
  • Zero-Shot Focus: The study focused on zero-shot performance. The authors suggest that fine-tuning the model on these reformulated inputs could yield even higher accuracy.
  • LLM Dependency: The use of ChatGPT for summarization in the extraction phase introduces a dependency on external APIs, which might be a concern for privacy-sensitive legal applications.

Summary updated

BibTeX
@inproceedings{tang2023prompt,
  author = {Yanran Tang and Ruihong Qiu and Xue Li},
  title = {{Prompt-Based Effective Input Reformulation for Legal Case Retrieval}},
  booktitle = {ADC},
  year = {2023},
  doi = {10.1007/978-3-031-47843-7\_7},
}

Loading related content...

Figure