Skip to main content
QUICK REVIEW

[Paper Review] LegalBench-RAG: A Benchmark for Retrieval-Augmented Generation in the Legal Domain

Nicholas Pipitone, Ghita Houir Alami|arXiv (Cornell University)|Aug 19, 2024
Artificial Intelligence in LawSocial Sciences7 citations
TL;DR

LegalBench-RAG is the first benchmark focused on evaluating the retrieval step of RAG systems in the legal domain, using precise, snippet-level retrieval anchored to original sources and a mini version for rapid experimentation.

ABSTRACT

Retrieval-Augmented Generation (RAG) systems are showing promising potential, and are becoming increasingly relevant in AI-powered legal applications. Existing benchmarks, such as LegalBench, assess the generative capabilities of Large Language Models (LLMs) in the legal domain, but there is a critical gap in evaluating the retrieval component of RAG systems. To address this, we introduce LegalBench-RAG, the first benchmark specifically designed to evaluate the retrieval step of RAG pipelines within the legal space. LegalBench-RAG emphasizes precise retrieval by focusing on extracting minimal, highly relevant text segments from legal documents. These highly relevant snippets are preferred over retrieving document IDs, or large sequences of imprecise chunks, both of which can exceed context window limitations. Long context windows cost more to process, induce higher latency, and lead LLMs to forget or hallucinate information. Additionally, precise results allow LLMs to generate citations for the end user. The LegalBench-RAG benchmark is constructed by retracing the context used in LegalBench queries back to their original locations within the legal corpus, resulting in a dataset of 6,858 query-answer pairs over a corpus of over 79M characters, entirely human-annotated by legal experts. We also introduce LegalBench-RAG-mini, a lightweight version for rapid iteration and experimentation. By providing a dedicated benchmark for legal retrieval, LegalBench-RAG serves as a critical tool for companies and researchers focused on enhancing the accuracy and performance of RAG systems in the legal domain. The LegalBench-RAG dataset is publicly available at https://github.com/zeroentropy-cc/legalbenchrag.

Motivation & Objective

  • Assess retrieval accuracy for legal RAG pipelines by locating exact, minimal text snippets within a large legal corpus.
  • Provide a publicly available, expert-annotated dataset to compare retrieval algorithms in legal contexts.
  • Preserve context-window efficiency by avoiding large, imprecise chunks and enabling precise citations.

Proposed method

  • Construct LegalBench-RAG by tracing back to original locations within four legal datasets (PrivacyQA, CUAD, MAUD, ContractNLI).
  • Create queries as combinations of document descriptions and interrogatives to yield ground-truth spans (start/end character indices).
  • Annotate QA pairs with arrays of (filename, index range) spans to answer each query precisely.
  • Evaluate retrieval with chunking strategies (fixed-size 500-char chunks vs Recursive Text Character Splitter) and post-processing (no reranker vs Cohere reranker).
  • Use OpenAI text-embedding-3-large for embeddings, SQLite Vec for storage, and Cohere reranker in selected configurations for experiments.
Figure 1: Benchmarking The Retrieval Step Of RAG Systems
Figure 1: Benchmarking The Retrieval Step Of RAG Systems

Experimental results

Research questions

  • RQ1How well can legal retrieval systems locate exact, minimal text spans that answer legal queries within a large corpus?
  • RQ2What chunking and reranking strategies yield the best retrieval precision and recall in legal text?
  • RQ3How do different datasets within LegalBench-RAG compare in retrieval difficulty and performance?
  • RQ4What are the limitations of general-purpose rerankers on specialized legal text?

Key findings

  • RTCS (Recursive Text Character Splitter) without a reranker achieved the best overall retrieval performance across datasets.
  • Cohere’s reranker underperformed compared to no reranker on this legal retrieval benchmark.
  • PrivacyQA emerged as the easiest dataset, while MAUD was the most challenging for retrieval.
  • On PrivacyQA, Precision@1 reached 14.38% and Recall@64 reached 84.19% under RTCS with no reranker.
  • MAUD showed low performance, with Precision@1 around 2.65% and Recall@64 around 28.28%.
  • LegalBench-RAG-mini provides a lightweight 776-query subset (across 4 datasets) for rapid experimentation.
Figure 2: Recall @ $k$ across all datasets
Figure 2: Recall @ $k$ across all datasets

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.