# Doc2doc Ir Eval

> Evaluates document-to-document information retrieval systems for regulatory compliance, testing their ability to match long, noisy legislative texts to related legal documents. It probes how well models handle extended query lengths, domain-specific vocabulary, and temporal constraints in legal transposition tasks. Use when the user wants to benchmark on EU2UK, UK2EU, or asks about evaluating this task. Reports R@100.

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

---


# doc2doc-ir-eval

> Regulatory Compliance through Doc2Doc Information Retrieval: A case study in EU/UK legislation where text similarity has limitations — Chalkidis et al. (2021) (arXiv:2101.10726, 2021)

## What this evaluates

Evaluates document-to-document information retrieval systems for regulatory compliance, testing their ability to match long, noisy legislative texts to related legal documents. It probes how well models handle extended query lengths, domain-specific vocabulary, and temporal constraints in legal transposition tasks.

## Datasets

- **EU2UK** — total ?; splits: train (-1), val (-1), test (-1)
- **UK2EU** — total ?; splits: train (-1), val (-1), test (-1)

## Metrics

- `R@100` **(primary)** — range: [0, 1]
  - Recall@k measures the fraction of relevant documents retrieved within the top-k ranked results. For pre-fetching, k is fixed at 100.
- `R@20` — range: [0, 1]
  - Recall@20 measures the fraction of relevant documents retrieved within the top-20 ranked results, used for re-ranking evaluation.
- `nDCG@20` — range: [0, 1]
  - Normalized Discounted Cumulative Gain at rank 20, which evaluates the quality of the ranked list by discounting the relevance score of each document by its position.
- `R-Precision` — range: [0, 1]
  - Recall at rank R, where R equals the total number of relevant documents for the query. It measures how many relevant documents appear in the top-R positions.

## Input / output format

**Input**: Full-text of legislative acts (queries and candidate documents), pre-processed by removing stop-words, punctuation, digits, and low-IDF terms, reducing average length by ~55%.

**Output**: A ranked list of candidate documents for each query.

## Scoring recipe

```python
def compute_recall_at_k(predictions, gold_set, k):
    retrieved = set(predictions[:k])
    relevant = len(retrieved & gold_set)
    return relevant / len(gold_set) if gold_set else 0.0

# For nDCG@k and R-Precision, apply standard IR formulas over the top-k ranked predictions against the gold set.
```

## Common pitfalls

- Using traditional BM25 hyperparameters (k1=1.2, b=0.75) instead of tuning for long queries, which significantly degrades performance.
- Using only the legislative title as a query instead of the full text, which drops R@100 by 5–20%.
- Ignoring temporal context, which is critical for correctly matching transposed legislation.

## Evidence (verbatim from paper)

> Pre-fetching aims to bring all the relevant documents in the top-k, thus we report R@k. We observe that for k > 100 the best pre fetchers have not significant gains in performance in development data, thus we select k = 100 , as a reasonable threshold. For re-ranking we report R@20, nDCG@20 and R-Precision (RP) following the literature (Manning et al., 2009). We report the average and standard deviation across three runs considering the best set of hyper-parameters on development data for neural re-rankers.

## Citation

```bibtex
@misc{chalkidis2021regulatory,
  title={Regulatory Compliance through Doc2Doc Information Retrieval: A case study in EU/UK legislation where text similarity has limitations},
  author={Chalkidis et al. (2021)},
  year={2021},
  note={arXiv:2101.10726}
}
```

- arXiv: 2101.10726

