codelion commited on
Commit
91495f8
·
verified ·
1 Parent(s): a2bf9d4

typed-extraction v1

Browse files
Files changed (4) hide show
  1. README.md +169 -0
  2. data/test.parquet +3 -0
  3. data/train.parquet +3 -0
  4. stats.json +114 -0
README.md ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - token-classification
7
+ - question-answering
8
+ pretty_name: typed-extraction
9
+ size_categories:
10
+ - 10K<n<100K
11
+ configs:
12
+ - config_name: default
13
+ data_files:
14
+ - split: train
15
+ path: data/train.parquet
16
+ - split: test
17
+ path: data/test.parquet
18
+ ---
19
+
20
+ # typed-extraction
21
+
22
+ A benchmark for **typed extraction over a document**: one piece of text in, a
23
+ named map of typed fields asked at once, and for each field either a typed value
24
+ or `null` when the document does not say.
25
+
26
+ It follows the System One extraction request shape (`state`, `fields`,
27
+ `reference_date`; answers with `value`, `span`, `p_null`, `confidence`), so a
28
+ case can be replayed against any API that implements it. It is the sibling of
29
+ [typed-decisions](https://huggingface.co/datasets/LocalLLaMA/typed-decisions).
30
+ It is an **independent** benchmark. It is not affiliated with any vendor of
31
+ extraction models.
32
+
33
+ ## What is different about it
34
+
35
+ - **The gold is fact, not a teacher's opinion.** Every answer is a human
36
+ annotation from an open dataset, the record a constructed document was
37
+ rendered from, or a Wikidata fact verified against the article text. No model
38
+ labelled anything, so there is no teacher ceiling and frontier models can be
39
+ ranked.
40
+ - **Absent fields are first-class.** 31% of test fields have null gold, and the
41
+ headline reports the **hallucination rate** (a value given for an absent
42
+ field) separately from the **miss rate**.
43
+ - **Typed answers.** Fields are `text`, `number`, `date`, `time`,
44
+ `datetime`, `duration` or `list`. A value has to be the right type, not a
45
+ string that happens to contain it. Numbers may be **computed** (totals,
46
+ counts, a deposit stated as "two months' rent"), and dates may be
47
+ **relative** ("delivered last Tuesday", resolved against `reference_date`).
48
+ - **Held-out families.** Three constructed families (real-estate listings,
49
+ meeting notes, medical appointment letters) appear only in the test split, so
50
+ a score on them cannot come from memorised templates.
51
+ - **Variation.** Constructed cases draw field names and instructions from
52
+ synonyms. They shuffle field order, ask for a plausible field the document
53
+ does not contain, and pad 30% of documents to 3–12k characters with decoy
54
+ values of the same shape.
55
+
56
+ ## Splits
57
+
58
+ | | test | train |
59
+ |---|---|---|
60
+ | cases | 1,690 | 9,642 |
61
+ | fields | 17,733 | 74,014 |
62
+ | null gold | 31.1% | 19.7% |
63
+ | held-out family fields | 2,380 | 0 |
64
+
65
+ Test fields by family:
66
+
67
+ | family | origin | cases | fields | what it tests |
68
+ |---|---|---|---|---|
69
+ | squad2 | converted | 200 | 1,908 | spans; unanswerable questions as null |
70
+ | drop | converted | 198 | 1,684 | numbers, mostly computed |
71
+ | cuad | converted | 102 | 4,182 | 41 clause lists per long contract (median ~26k chars) |
72
+ | extractbench | converted | 30 | 2,115 | nested schemas on long PDFs (10-Q, credit agreements, papers…), test only |
73
+ | wikipedia | distant | 300 | 964 | real articles, Wikidata values verified in the text |
74
+ | claim_email | constructed | 80 | 617 | relative dates, computed totals and day counts |
75
+ | invoice | constructed | 80 | 681 | due dates from payment terms, totals, line items |
76
+ | lease | constructed | 80 | 770 | end dates, deposits stated as multiples of rent |
77
+ | itinerary | constructed | 80 | 608 | datetimes, flight lists, journey minutes |
78
+ | shipping_notice | constructed | 80 | 607 | business-day ETAs, unit conversion |
79
+ | job_posting | constructed | 80 | 609 | salary ranges ("$85k–$110k"), skill lists |
80
+ | bank_statement | constructed | 80 | 608 | closing balances, largest debit, counts |
81
+ | real_estate_listing | constructed, **held out** | 100 | 961 | price per square foot, open-house datetimes |
82
+ | meeting_notes | constructed, **held out** | 100 | 659 | durations, "same time next week" |
83
+ | medical_appointment | constructed, **held out** | 100 | 760 | arrive-by times, absent copays and referrals |
84
+
85
+ Test fields by type:
86
+
87
+ | type | fields |
88
+ |---|---|
89
+ | list | 6,854 |
90
+ | text | 5,278 |
91
+ | number | 3,480 |
92
+ | date | 1,119 |
93
+ | duration | 442 |
94
+ | datetime | 380 |
95
+ | time | 180 |
96
+
97
+ Present test gold is 8,192 verbatim spans, 2,020 normalised (written in another
98
+ form), 1,926 computed and 86 relative.
99
+
100
+ ## Scoring
101
+
102
+ `typed_extraction.metrics` (numpy only) scores each field exact (0/1) and
103
+ partially:
104
+
105
+ - **text:** SQuAD-normalised exact match; partial credit is token F1.
106
+ - **number / duration:** relative tolerance 1e-3, or rounding at the field's
107
+ `decimals`.
108
+ - **date / time / datetime:** equal ISO values.
109
+ - **list:** multiset F1. A text item matches at token Jaccard ≥ 0.5 (CUAD's
110
+ convention), and exact means F1 = 1.
111
+ - **null:** right only when the prediction is null (an empty list for lists).
112
+
113
+ **Headline: the mean over families**, since families differ about 10× in field
114
+ count. It is reported with hallucination rate, miss rate, `p_null` AUROC, ECE,
115
+ and accuracy at 90% coverage (answering only the most confident 90%) for
116
+ predictors that report confidence.
117
+
118
+ ## Gold quality
119
+
120
+ 200 test fields were hand-checked against their documents, weighted towards
121
+ null and derived gold. **2 were wrong (1.0%, 95% CI 0.3–3.6%)**. Both were
122
+ fixed, together with every recurring issue the audit found:
123
+
124
+ - CUAD exact clause boundaries, by moving to Jaccard list matching;
125
+ - honorific-only differences;
126
+ - ExtractBench instructions that asked for 'NA' where the gold is null;
127
+ - ambiguous slash dates;
128
+ - two malformed ExtractBench fields.
129
+
130
+ Null gold had no errors in the sample.
131
+
132
+ **Known limitations:**
133
+
134
+ - The Wikipedia slice is thin: mostly 3 fields per case, and its few nulls are
135
+ all death dates.
136
+ - ExtractBench text comes from `pdftotext`. 5 of its 35 PDFs (image-only resumes)
137
+ are excluded, and its LLM-judged metrics are not reproduced, so its scores are
138
+ not comparable to the ExtractBench paper.
139
+ - SQuAD 2.0 and DROP are in most models' pretraining data.
140
+ - Itinerary durations use local clock times; the instructions say so.
141
+
142
+ ## Sources and licences
143
+
144
+ | source | licence |
145
+ |---|---|
146
+ | SQuAD 2.0 | CC BY-SA 4.0 |
147
+ | DROP | CC BY-SA 4.0 |
148
+ | CUAD v1 | CC BY 4.0 |
149
+ | ExtractBench, commit ca81763 | MIT |
150
+ | Wikipedia text | CC BY-SA 4.0 |
151
+ | Wikidata | CC0 |
152
+ | constructed families | generated for this dataset |
153
+
154
+ The dataset as a whole is released under **CC BY-SA 4.0**, as the share-alike
155
+ sources require.
156
+
157
+ ## Format
158
+
159
+ Each row is one case:
160
+
161
+ | column | content |
162
+ |---|---|
163
+ | `id`, `family`, `origin`, `held_out` | identifiers |
164
+ | `state` | the document |
165
+ | `reference_date` | the date relative expressions resolve against, if any |
166
+ | `fields` | JSON: name → `{type, instructions, options}` |
167
+ | `gold` | JSON: name → `{value, source, alts, spans}` |
168
+
169
+ `spans` are `[start, end)` character offsets into `state`.
data/test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:852bb4251a91ae3f9f9a274949b27bf85b13ccd2302bcd1305150adff5ccc3c3
3
+ size 5082283
data/train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6af3acb378248151352084bf9fc716c86f0938cdf2cf376f02bdda4ab563989f
3
+ size 11248679
stats.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "test": {
3
+ "cases": 1690,
4
+ "fields": 17733,
5
+ "null_share": 0.311,
6
+ "by_family": {
7
+ "squad2": 200,
8
+ "drop": 198,
9
+ "cuad": 102,
10
+ "claim_email": 80,
11
+ "invoice": 80,
12
+ "lease": 80,
13
+ "itinerary": 80,
14
+ "shipping_notice": 80,
15
+ "job_posting": 80,
16
+ "bank_statement": 80,
17
+ "medical_appointment": 100,
18
+ "meeting_notes": 100,
19
+ "real_estate_listing": 100,
20
+ "wikipedia": 300,
21
+ "extractbench": 30
22
+ },
23
+ "fields_by_family": {
24
+ "squad2": 1908,
25
+ "drop": 1684,
26
+ "cuad": 4182,
27
+ "claim_email": 617,
28
+ "invoice": 681,
29
+ "lease": 770,
30
+ "itinerary": 608,
31
+ "shipping_notice": 607,
32
+ "job_posting": 609,
33
+ "bank_statement": 608,
34
+ "medical_appointment": 760,
35
+ "meeting_notes": 659,
36
+ "real_estate_listing": 961,
37
+ "wikipedia": 964,
38
+ "extractbench": 2115
39
+ },
40
+ "fields_by_origin": {
41
+ "converted": 9889,
42
+ "constructed": 6880,
43
+ "distant": 964
44
+ },
45
+ "fields_by_type": {
46
+ "text": 5278,
47
+ "number": 3480,
48
+ "list": 6854,
49
+ "date": 1119,
50
+ "duration": 442,
51
+ "datetime": 380,
52
+ "time": 180
53
+ },
54
+ "present_by_source": {
55
+ "span": 8192,
56
+ "computed": 1926,
57
+ "relative": 86,
58
+ "normalised": 2020
59
+ },
60
+ "held_out_fields": 2380
61
+ },
62
+ "train": {
63
+ "cases": 9642,
64
+ "fields": 74014,
65
+ "null_share": 0.197,
66
+ "by_family": {
67
+ "squad2": 3000,
68
+ "drop": 1492,
69
+ "cuad": 150,
70
+ "claim_email": 500,
71
+ "invoice": 500,
72
+ "lease": 500,
73
+ "itinerary": 500,
74
+ "shipping_notice": 500,
75
+ "job_posting": 500,
76
+ "bank_statement": 500,
77
+ "wikipedia": 1500
78
+ },
79
+ "fields_by_family": {
80
+ "squad2": 20054,
81
+ "drop": 12971,
82
+ "cuad": 8101,
83
+ "claim_email": 3800,
84
+ "invoice": 4297,
85
+ "lease": 4801,
86
+ "itinerary": 3801,
87
+ "shipping_notice": 3807,
88
+ "job_posting": 3803,
89
+ "bank_statement": 3815,
90
+ "wikipedia": 4764
91
+ },
92
+ "fields_by_origin": {
93
+ "converted": 41126,
94
+ "constructed": 28124,
95
+ "distant": 4764
96
+ },
97
+ "fields_by_type": {
98
+ "text": 37474,
99
+ "number": 17130,
100
+ "list": 11334,
101
+ "duration": 1513,
102
+ "date": 5563,
103
+ "datetime": 500,
104
+ "time": 500
105
+ },
106
+ "present_by_source": {
107
+ "span": 44482,
108
+ "computed": 9387,
109
+ "relative": 516,
110
+ "normalised": 5046
111
+ },
112
+ "held_out_fields": 0
113
+ }
114
+ }