typed-extraction / README.md
codelion's picture
leaderboard: add UltraBERT-150M clairic-extraction (zero-shot, #1)
cb01efd verified
|
Raw History Blame Contribute Delete
11.9 kB
---
license: cc-by-sa-4.0
language:
- en
task_categories:
- token-classification
- question-answering
pretty_name: typed-extraction
size_categories:
- 10K<n<100K
configs:
- config_name: default
data_files:
- split: train
path: data/train.parquet
- split: test
path: data/test.parquet
---
# typed-extraction
A benchmark for **typed extraction over a document**: one piece of text in, a
named map of typed fields asked at once, and for each field either a typed value
or `null` when the document does not say.
It follows the System One extraction request shape (`state`, `fields`,
`reference_date`; answers with `value`, `span`, `p_null`, `confidence`), so a
case can be replayed against any API that implements it. It is the sibling of
[typed-decisions](https://huggingface.co/datasets/LocalLLaMA/typed-decisions).
It is an **independent** benchmark. It is not affiliated with any vendor of
extraction models.
![Headline against hallucination rate, and the ranked headline, for every scored model](https://huggingface.co/datasets/LocalLLaMA/typed-extraction/resolve/main/assets/leaderboard.png)
## Leaderboard
`test` split: 1,690 cases, 17,733 fields. This table lists models scored
zero-shot: they never saw `train`. Models fitted or trained on `train` are in the
second table below; the two tables are not comparable.
**Headline** is exact match averaged over the 15 families; **fields with a
value** is the same over fields whose gold is not null; **computed** is exact
match on the 1,926 fields whose answer has to be worked out (totals, counts, day
spans). Every model sees the same request: the document and the fields with
their instructions, nothing else.
<!-- LEADERBOARD:BEGIN -->
| # | Model | Kind | Headline ↑ | Fields with a value ↑ | Hallucination ↓ | Miss ↓ | Computed ↑ | `p_null` AUROC ↑ |
|---|---|---|---|---|---|---|---|---|
| 1 | **[ScaleDown Extract](https://openrouter.ai/scaledown/extract)** | extraction API | **0.782** | 0.723 | 0.117 | 0.200 | 0.570 | – |
| 2 | [UltraBERT-150M clairic-extraction](https://huggingface.co/tasksource/UltraBERT-150M-clairic-extraction) | span extractor, open 150M encoder | **0.616** | 0.548 | 0.141 | 0.297 | 0.013 | 0.815 |
| 3 | [Schematron V2 Small](https://openrouter.ai/inference-net/schematron-v2-small) | extraction LLM | **0.562** | 0.529 | 0.445 | 0.303 | 0.134 | – |
| – | Always null (answers nothing) | reference | **0.199** | 0.000 | 0.000 | 1.000 | 0.000 | – |
| – | Regex rules | reference | **0.129** | 0.152 | 0.993 | 0.000 | 0.026 | 0.503 |
### Fitted or fine-tuned on `train`
These models were trained on this benchmark's `train` split, so they are not
zero-shot and their scores are not comparable with the table above. The three
test-only families never appear in `train`, so they still test transfer.
| # | Model | Kind | Headline ↑ | Fields with a value ↑ | Hallucination ↓ | Miss ↓ | Computed ↑ | `p_null` AUROC ↑ |
|---|---|---|---|---|---|---|---|---|
| 1 | **[adaptive-classifier + MiniLM-L6](https://huggingface.co/adaptive-classifier/typed-extraction-minilm-l6)** | candidate classifier, trained on `train` | **0.315** | 0.166 | 0.109 | 0.600 | 0.005 | 0.789 |
| 2 | [adaptive-classifier + bge-small](https://huggingface.co/adaptive-classifier/typed-extraction-bge-small) | candidate classifier, trained on `train` | **0.291** | 0.143 | 0.103 | 0.600 | 0.008 | 0.788 |
| – | Always null (answers nothing) | reference | **0.199** | 0.000 | 0.000 | 1.000 | 0.000 | – |
| – | Regex rules | reference | **0.129** | 0.152 | 0.993 | 0.000 | 0.026 | 0.503 |
<!-- LEADERBOARD:END -->
### Notes on the rows
- **ScaleDown Extract** is the bar. It returns values that are not in the text
(it does the arithmetic), and its weak spots are ExtractBench's long nested
schemas and relative dates.
- **The adaptive-classifier baselines** pick one of 40 candidate spans per field
with a single yes/no classifier, so they rarely hallucinate but cannot
compute, and for fields that have a value the right answer is among their
candidates only 49% of the time. That ceiling, not the classifier, is what holds them back. They are
published as reproducible open baselines, not as competitive extractors.
- **UltraBERT-150M clairic-extraction** (submitted by sileod, [discussion #1](https://huggingface.co/datasets/LocalLLaMA/typed-extraction/discussions/1))
is the first open-weight row. It tags answer spans per field with no LLM and
maps them to types in plain code, so it rarely computes values (0.013). Its
confidence is the raw span probability (ECE 0.42), but it ranks nulls well. We
re-scored the published predictions with the unmodified `score.py` and got the
same numbers. Its training data includes the SQuAD 2.0, DROP and CUAD train
splits; 23 test documents share text with it, and dropping them leaves the
headline at 0.616.
- **Always null** answers nothing; it scores 0.199 because 31% of fields are
absent. A model below it is doing more harm than good.
- Remote models were called once, at temperature 0, with responses cached.
LLMs got a JSON schema with one nullable property per field; documents longer
than their context were cut (5 cases for Schematron), and that is counted.
- Rows for LFM2.5 and Clairic will be added when their runs finish.
### Scoring your model
```bash
pip install numpy pyarrow huggingface_hub
huggingface-cli download LocalLLaMA/typed-extraction --repo-type dataset --local-dir typed-extraction
python typed-extraction/score.py predictions.jsonl --by-family
```
`predictions.jsonl` has one line per test case,
`{"id": ..., "answers": {"<field>": {"value": ..., "p_null": ..., "confidence": ...}}}`,
with `null` (or `[]` for lists) for fields the document does not state.
`p_null` and `confidence` are optional and enable the calibration metrics.
Please report the headline, hallucination and miss together; any one alone can
be gamed. To be added to the leaderboard, open a discussion on this dataset with
the scorer's output and a link to the model, and say whether it was zero-shot or
trained on `train`.
## What is different about it
- **The gold is fact, not a teacher's opinion.** Every answer is a human
annotation from an open dataset, the record a constructed document was
rendered from, or a Wikidata fact verified against the article text. No model
labelled anything, so there is no teacher ceiling and frontier models can be
ranked.
- **Absent fields are first-class.** 31% of test fields have null gold, and the
headline reports the **hallucination rate** (a value given for an absent
field) separately from the **miss rate**.
- **Typed answers.** Fields are `text`, `number`, `date`, `time`,
`datetime`, `duration` or `list`. A value has to be the right type, not a
string that happens to contain it. Numbers may be **computed** (totals,
counts, a deposit stated as "two months' rent"), and dates may be
**relative** ("delivered last Tuesday", resolved against `reference_date`).
- **Held-out families.** Three constructed families (real-estate listings,
meeting notes, medical appointment letters) appear only in the test split, so
a score on them cannot come from memorised templates.
- **Variation.** Constructed cases draw field names and instructions from
synonyms. They shuffle field order, ask for a plausible field the document
does not contain, and pad 30% of documents to 3–12k characters with decoy
values of the same shape.
## Splits
| | test | train |
|---|---|---|
| cases | 1,690 | 9,642 |
| fields | 17,733 | 74,014 |
| null gold | 31.1% | 19.7% |
| held-out family fields | 2,380 | 0 |
Test fields by family:
| family | origin | cases | fields | what it tests |
|---|---|---|---|---|
| squad2 | converted | 200 | 1,908 | spans; unanswerable questions as null |
| drop | converted | 198 | 1,684 | numbers, mostly computed |
| cuad | converted | 102 | 4,182 | 41 clause lists per long contract (median ~26k chars) |
| extractbench | converted | 30 | 2,115 | nested schemas on long PDFs (10-Q, credit agreements, papers…), test only |
| wikipedia | distant | 300 | 964 | real articles, Wikidata values verified in the text |
| claim_email | constructed | 80 | 617 | relative dates, computed totals and day counts |
| invoice | constructed | 80 | 681 | due dates from payment terms, totals, line items |
| lease | constructed | 80 | 770 | end dates, deposits stated as multiples of rent |
| itinerary | constructed | 80 | 608 | datetimes, flight lists, journey minutes |
| shipping_notice | constructed | 80 | 607 | business-day ETAs, unit conversion |
| job_posting | constructed | 80 | 609 | salary ranges ("$85k–$110k"), skill lists |
| bank_statement | constructed | 80 | 608 | closing balances, largest debit, counts |
| real_estate_listing | constructed, **held out** | 100 | 961 | price per square foot, open-house datetimes |
| meeting_notes | constructed, **held out** | 100 | 659 | durations, "same time next week" |
| medical_appointment | constructed, **held out** | 100 | 760 | arrive-by times, absent copays and referrals |
Test fields by type:
| type | fields |
|---|---|
| list | 6,854 |
| text | 5,278 |
| number | 3,480 |
| date | 1,119 |
| duration | 442 |
| datetime | 380 |
| time | 180 |
Present test gold is 8,192 verbatim spans, 2,020 normalised (written in another
form), 1,926 computed and 86 relative.
## Scoring
`typed_extraction.metrics` (numpy only) scores each field exact (0/1) and
partially:
- **text:** SQuAD-normalised exact match; partial credit is token F1.
- **number / duration:** relative tolerance 1e-3, or rounding at the field's
`decimals`.
- **date / time / datetime:** equal ISO values.
- **list:** multiset F1. A text item matches at token Jaccard ≥ 0.5 (CUAD's
convention), and exact means F1 = 1.
- **null:** right only when the prediction is null (an empty list for lists).
**Headline: the mean over families**, since families differ about 10× in field
count. It is reported with hallucination rate, miss rate, `p_null` AUROC, ECE,
and accuracy at 90% coverage (answering only the most confident 90%) for
predictors that report confidence.
## Gold quality
200 test fields were hand-checked against their documents, weighted towards
null and derived gold. **2 were wrong (1.0%, 95% CI 0.3–3.6%)**. Both were
fixed, together with every recurring issue the audit found:
- CUAD exact clause boundaries, by moving to Jaccard list matching;
- honorific-only differences;
- ExtractBench instructions that asked for 'NA' where the gold is null;
- ambiguous slash dates;
- two malformed ExtractBench fields.
Null gold had no errors in the sample.
**Known limitations:**
- The Wikipedia slice is thin: mostly 3 fields per case, and its few nulls are
all death dates.
- ExtractBench text comes from `pdftotext`. 5 of its 35 PDFs (image-only resumes)
are excluded, and its LLM-judged metrics are not reproduced, so its scores are
not comparable to the ExtractBench paper.
- SQuAD 2.0 and DROP are in most models' pretraining data.
- Itinerary durations use local clock times; the instructions say so.
## Sources and licences
| source | licence |
|---|---|
| SQuAD 2.0 | CC BY-SA 4.0 |
| DROP | CC BY-SA 4.0 |
| CUAD v1 | CC BY 4.0 |
| ExtractBench, commit ca81763 | MIT |
| Wikipedia text | CC BY-SA 4.0 |
| Wikidata | CC0 |
| constructed families | generated for this dataset |
The dataset as a whole is released under **CC BY-SA 4.0**, as the share-alike
sources require.
## Format
Each row is one case:
| column | content |
|---|---|
| `id`, `family`, `origin`, `held_out` | identifiers |
| `state` | the document |
| `reference_date` | the date relative expressions resolve against, if any |
| `fields` | JSON: name → `{type, instructions, options}` |
| `gold` | JSON: name → `{value, source, alts, spans}` |
`spans` are `[start, end)` character offsets into `state`.