# Legalbench RAG Eval

> Evaluates the retrieval fidelity of RAG systems in the legal domain by measuring how precisely and completely a model retrieves minimal, highly relevant text snippets from legal documents to answer specific queries. Use when the user wants to benchmark on LegalBench-RAG, or asks about evaluating this task. Reports Precision.

- Skill: `qhjqhj00/legalbench-rag-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/legalbench-rag-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/legalbench-rag-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/legalbench-rag-eval

---


# legalbench-rag-eval

> LegalBench-RAG: A Benchmark for Retrieval-Augmented Generation in the Legal Domain — Pipitone et al. (2024) (arXiv:2408.10343, 2024)

## What this evaluates

Evaluates the retrieval fidelity of RAG systems in the legal domain by measuring how precisely and completely a model retrieves minimal, highly relevant text snippets from legal documents to answer specific queries.

## Datasets

- **LegalBench-RAG** — total 6858; splits: test (-1); repo https://github.com/zeroentropy-cc/legalbenchrag

## Metrics

- `Precision` **(primary)** — range: percent
  - Fraction of retrieved chunks in the top-k that are relevant to the query. Calculated as |relevant ∩ top_k| / k.
- `Recall` — range: percent
  - Fraction of all relevant chunks in the document that are successfully retrieved within the top-k results. Calculated as |relevant ∩ top_k| / |relevant|.

## Input / output format

**Input**: A legal query paired with a legal document (or corpus) from which the system must retrieve relevant text chunks.

**Output**: A ranked list of top-k retrieved text chunks/snippets.

## Scoring recipe

```python
def score(retrieved, gold, k):
    top_k = retrieved[:k]
    hits = len(set(top_k) & set(gold))
    prec = (hits / k) * 100
    rec = (hits / len(gold)) * 100
    return prec, rec
# Average per dataset, then equally weight datasets
```

## Common pitfalls

- Averaging scores globally across datasets instead of weighting each dataset equally regardless of size, as explicitly required.
- Failing to account for chunking strategy (fixed-size vs. recursive splitter) and reranker presence, which drastically shift Precision/Recall.
- Choosing k without balancing context richness against noise/hallucination risks, as noted in post-processing design decisions.

## Evidence (verbatim from paper)

> Performance comparison on different datasets for Precision and Recall at various k values for the Naive Method.

## Citation

```bibtex
@misc{pipitone2024legalbenchrag,
  title={LegalBench-RAG: A Benchmark for Retrieval-Augmented Generation in the Legal Domain},
  author={Pipitone et al. (2024)},
  year={2024},
  note={arXiv:2408.10343}
}
```

- arXiv: 2408.10343

