The Dataset Viewer has been disabled on this dataset.

LEGEX β€” Reproduction Bundle (release/icml2026)

LEGEX is an expert-coded benchmark for civil-judgment review-table extraction: judgments from the highest civil courts of 19 jurisdictions, annotated by legal experts on a shared schema (monetary outcomes, cost allocation, party structure, industry classification), against which we evaluate two commercial review-table systems (Harvey, Legora) and two schema-constrained LLM pipelines (Gemini, ChatGPT). This bundle is the versioned code + data payload behind the paper LEGEX: An Eight-Jurisdiction Benchmark for Legal Review-Table Extraction (ICML 2026 Workshop on AI for Law); it contains an eight-jurisdiction core benchmark (β‰₯100 judgments each, double-annotated on a 28–30-case overlap) and eleven preview jurisdictions.

The release consists of three Hugging Face repositories, pinned to the release/icml2026 branch:

Artifact Contents URL
goldensets Expert gold labels, data/<cc>/goldenset_<cc>.jsonl https://huggingface.co/datasets/legexbenchmark/goldensets/tree/release/icml2026
inference-results System predictions, data/<cc>/inference_{harvey,harvey_2,gemini,gpt,legora_1,legora_2}.jsonl, plus the as-run per-column prompts of the commercial runs in prompts/ https://huggingface.co/datasets/legexbenchmark/inference-results/tree/release/icml2026
code This bundle (package, scripts, shipped analysis outputs) https://huggingface.co/datasets/legexbenchmark/code/tree/release/icml2026

Layout of this bundle

submission/
β”œβ”€β”€ README.md                       this file
β”œβ”€β”€ pyproject.toml Β· LICENSE Β· .env.template
β”œβ”€β”€ legex/                          the LEGEX package, pruned to what the release uses:
β”‚   β”œβ”€β”€ scrapers/                   one scraper per jurisdiction
β”‚   β”œβ”€β”€ fulltext/                   full-text acquisition for the goldenset workbooks
β”‚   β”œβ”€β”€ prompts/                    versioned system prompts (paper runs use v3)
β”‚   β”œβ”€β”€ inference.py                legex-classify (LLM pipelines)
β”‚   β”œβ”€β”€ harvey.py                   legex-harvey-ingest (review-table export ingest)
β”‚   β”œβ”€β”€ evaluation/                 tolerant cell comparator + scoring engine
β”‚   └── analysis/                   aggregates, IAA, AAT rendering, report, plots
β”œβ”€β”€ scripts/                        paper-facing scripts (tables, figures, AAT adapter)
β”œβ”€β”€ tests/                          unit tests (uv run pytest -q)
β”œβ”€β”€ data/analysis/                  SHIPPED analysis outputs (see "Recompute" below)
β”‚   β”œβ”€β”€ per_country_per_column.csv Β· per_country.csv Β· per_column.csv
β”‚   β”œβ”€β”€ per_tradition.csv Β· per_language.csv
β”‚   β”œβ”€β”€ quant_results.tex           paper Table tab:overall
β”‚   β”œβ”€β”€ paper_tables.tex            tab:metrics-by-jurisdiction / tab:metrics-by-field
β”‚   β”œβ”€β”€ tables/                     diversity.tex, currency_frequencies.tex, ...
β”‚   β”œβ”€β”€ figures/                    isic_frequencies.pdf, legal_subject_wordcloud.png
β”‚   β”œβ”€β”€ iaa/                        ANALYSIS.md, pairwise_agreement.csv, kappa_audit.csv,
β”‚   β”‚                               alt_test_pooled.csv, alt_test_reference_*.csv
β”‚   β”œβ”€β”€ hallucinations/             hallucination_review_ch.csv (hand-classified error case study)
β”‚   └── quality/                    by_country.csv, by_variable.csv
β”œβ”€β”€ goldensets/                     1:1 copy of legexbenchmark/goldensets (dataset card + data)
β”œβ”€β”€ inference-results/              1:1 copy of legexbenchmark/inference-results
β”œβ”€β”€ convert_goldenset_to_jsonl.py   XLSX gold workbooks -> goldenset_<cc>.jsonl
β”œβ”€β”€ build_inference_jsonl.py        cleaned working JSONL -> inference_<model>.jsonl
β”œβ”€β”€ docs/Jurisdictions.md           per-jurisdiction research catalogue
└── HUGGINGFACE_UPLOAD.md           how this bundle maps onto the three HF repos

Reproduce the paper tables and figures

All commands are run from this directory (the bundle root). Requires uv and Python β‰₯ 3.11.

uv sync

Table tab:overall (headline metrics). Re-render from the shipped per-cell aggregate and check it is byte-identical to the shipped table:

uv run legex-quant-results --input data/analysis/per_country_per_column.csv --out /tmp/quant_results.tex
diff /tmp/quant_results.tex data/analysis/quant_results.tex

Tables tab:metrics-by-jurisdiction and tab:metrics-by-field.

uv run python scripts/paper_tables.py > /tmp/paper_tables.tex
diff /tmp/paper_tables.tex data/analysis/paper_tables.tex

IAA / kappa / Alternative Annotator Test report (ANALYSIS.md, the source of the paper's tab:iaa and AAT numbers). The report is rendered purely from the shipped CSVs:

uv run legex-analysis-report --iaa-dir data/analysis/iaa --analysis-dir data/analysis --out /tmp/ANALYSIS.md
diff /tmp/ANALYSIS.md data/analysis/iaa/ANALYSIS.md

One-shot reproduction. scripts/reproduce_paper.sh regenerates every artifact under data/analysis/ β€” IAA CSVs, scoring aggregates, all tables, the diversity/frequency figures, the hallucination shares, and ANALYSIS.md β€” from the published bundles in goldensets/data/ and inference-results/data/. The run is byte-stable, so a clean git status data/analysis afterwards is the verification that the shipped numbers reproduce:

bash scripts/reproduce_paper.sh
git status data/analysis

There are minimal known deviations from the submitted PDF. The gold labels are normalised during export to JSONL (controlled-token case, thousands separators, Excel dates β†’ ISO), and the paper's tables were computed from the raw annotator workbooks before that normalisation, where, for example, a gold cell coded Nonpecuniary counted against a system answering the schema literal nonpecuniary. Re-scoring on the published gold therefore yields slightly higher values in a few places than the PDF: Philippines recall (+7–9 pp for every system), Spain (β‰ˆ +1 pp), tab:overall within Β±0.2 pp, and the money/ratio agreement rows of tab:iaa (+1–2 pp). The ΞΊ values, pair counts, denominators, the hallucination case study, and all remaining numbers match the PDF. The shipped outputs under data/analysis/ are the published-data regeneration. The deviations could not be resolved due to time constraints and are made transparent here.

Unpublished raw data β€” scope

The expert-annotated XLSX workbooks (data/<cc>/Goldenset_*_final*.xlsx) behind the goldensets are not published: Microsoft Office embeds author metadata, and the re-annotation assignment structure could identify individual annotators. The gold labels are published in full as goldensets/data/<cc>/goldenset_<cc>.jsonl (primary + anonymized secondary annotator rows), and every analysis in this bundle runs from those published files β€” the workbooks are not needed for reproduction.

Alternative Annotator Test (AAT). The AAT (Calderon, Reichart & Dror, ACL 2025, arXiv:2501.10970) is run with the authors' original implementation via the adapter scripts/alt_test_reference.py, which extracts alt_test() from the upstream notebook at runtime and feeds it LEGEX data from the published bundles:

git clone https://github.com/nitaytech/AltTest /tmp/AltTest
ALTTEST_DIR=/tmp/AltTest bash scripts/reproduce_paper.sh   # or:
uv run python scripts/alt_test_reference.py --alttest /tmp/AltTest \
    --gold-dir goldensets/data --inference-dir inference-results/data \
    [--countries ge,sg,tw] [--epsilon 0.2] [--out data/analysis/iaa] [--per-field]

Its outputs (alt_test_pooled.csv, alt_test_reference_*.csv) are shipped under data/analysis/iaa/ and rendered into ANALYSIS.md by legex-analysis-report.

Scraping

The scrapers that built the corpus are included (legex/scrapers/, one file per jurisdiction; see docs/Jurisdictions.md for the per-country catalogue).

cp .env.template .env   # then fill in what you need
uv run legex-run

legex-run executes the idempotent pipeline (scrape β†’ filter/sample β†’ fill goldenset β†’ dist) for every registered jurisdiction and skips countries whose access is not set up or whose output already exists. Some sources need manual prerequisites (all keys go into .env, see .env.template):

  • Hugging Face (au, ch, de, us): a read token as HF_TOKEN; de and us additionally require accepting the gated-dataset terms of openlegaldata/court-decisions-germany and free-law/Caselaw_Access_Project.
  • France: register at https://piste.gouv.fr, subscribe to the Judilibre API, set JUDILIBRE_CLIENT_ID / JUDILIBRE_CLIENT_SECRET.
  • New Zealand: copy the WAF cookie from a justice.govt.nz session into NZ_WAF_COOKIE.
  • India: legex-india-extract pulls selected PDFs from the AWS Open Data TAR archives (see legex/scrapers/in_.py).

Model inference over the scraped full texts (the paper runs use prompt v3):

uv run legex-classify --model <model> --full_text --prompt_version v3

Tests: uv run pytest -q.

Citation

@inproceedings{legex2026,
  title     = {{LEGEX}: An Eight-Jurisdiction Benchmark for Legal Review-Table Extraction},
  author    = {K{\"o}nig, Adrian and others},
  booktitle = {ICML 2026 Workshop on AI for Law (AI4Law)},
  year      = {2026},
  url       = {https://huggingface.co/legexbenchmark}
}

License

MIT. See LICENSE.

Downloads last month
311

Paper for legexbenchmark/code