cde-evals / README.md
hadro's picture
Add 18-volume NYC gold panel (1786-1933); refresh synth_dev; document provenance + harness usage
6b6b126 verified
|
Raw History Blame Contribute Delete
6.31 kB
---
license: other
license_name: mixed-see-provenance
language:
- en
- fr
tags:
- glam
- city-directory
- historical-documents
- structured-extraction
- evaluation
pretty_name: City Directory Extraction — Gold Evaluation Panel
size_categories:
- 1K<n<10K
viewer: false
---
# City Directory Extraction — Gold Evaluation Sets
**Evaluation only. Never train on these.** This is the regression harness for
[`hadro/city-directory-extraction`](https://github.com/hadro/city-directory-extraction) —
the gold sets used to score every fine-tune of the Qwen3.5 city-directory extractor.
> **Why this repo is private.** Two reasons, and the second is the stronger one:
> 1. `nyu_eval.jsonl` is **CC-BY-SA-NC 4.0** (non-commercial + share-alike).
> 2. Public gold sets get scraped into training corpora. If this panel leaks into a
> pretraining crawl, it stops measuring anything. Keep it out of public mirrors,
> public HF Spaces, and pasted-into-a-chat contexts.
## Schema
Every file is JSONL, one directory entry per line:
```json
{
"raw_line": "Brower N. merchant, 95, Water-street",
"context": {"publisher": "franks", "alphabetical_range": "", "directory_year": "1786", "image": "..."},
"record": {
"name": "Brower N.", "is_business": false, "spouse_name": "", "race_designation": "",
"occupation_role": "merchant", "employer": "", "address": "95 Water-street", "home_address": ""
}
}
```
- `raw_line` — the entry as printed (model input).
- `context` — page-level metadata fed in the prompt, **not** predicted.
- `record` — the 8-field target. `context.image` is present on the panel volumes only.
## The 18-volume NYC panel — the regression harness
Hand-labeled by this project from library page scans (NYPL / Internet Archive / LoC),
one gold set per volume, all validator-clean. NYC 1786–1933 across boroughs and publishers.
**1169 lines total.** This is the panel, not a sample — score all 18.
| File | Rows |
|---|---|
| `franks1786_eval.jsonl` | 56 |
| `duncan1794_eval.jsonl` | 58 |
| `mercein1820_eval.jsonl` | 60 |
| `ogden1839_eval.jsonl` | 66 |
| `doggett1846_eval.jsonl` | 37 |
| `rode1851_eval.jsonl` | 53 |
| `hearne1852_eval.jsonl` | 52 |
| `hopehenderson1856_eval.jsonl` | 60 |
| `lain1876_eval.jsonl` | 103 |
| `boyd1890_eval.jsonl` | 75 |
| `trow1907_eval.jsonl` | 68 |
| `trow1913_eval.jsonl` | 93 |
| `polk1917_eval.jsonl` | 72 |
| `polk1925_eval.jsonl` | 40 |
| `mb1931_eval.jsonl` | 109 |
| `polk1933bk_eval.jsonl` | 49 |
| `polk1933si_eval.jsonl` | 56 |
| `queens1933_eval.jsonl` | 62 |
## Externals + controls
| File | Rows | Source | License | Notes |
|---|---|---|---|---|
| `synth_dev.jsonl` | 1,000 | generated by `synth_persons.py` | ours (CC-BY-4.0) | In-distribution control. Near-ceiling scores are expected; it detects breakage, not quality. |
| `nyu_eval.jsonl` | 3,000 | [NYU NYC directories 1850–1890](https://archive.nyu.edu/handle/2451/61521) | **CC-BY-SA-NC 4.0** ⚠ | **Score at `--limit 500`** — every published baseline is on the first 500 rows. |
| `ftd_eval.jsonl` | 2,000 | [French Trade Directories (SODUCO)](https://zenodo.org/records/8167628) | open (CC) | Cross-lingual transfer eval. |
| `tulsa_eval.jsonl` | 1,500 | own `directory-pipeline` output (Tulsa 1921) | ours | Real OCR + Gemini-extracted (**silver**) labels, not hand-verified. |
| `lain_eval.jsonl` | 800 | own pipeline output (Lain Brooklyn 1897) | ours | Silver labels. Held out of the sampling/harvest set. |
| `minneapolis_eval.jsonl` | 230 | [DirCity](https://github.com/adamrangwala/DirCity_Directory_Crop-out-with-Key-Lines) | MIT | Out-of-city US eval (silver). |
Note `lain_eval.jsonl` (silver, 800 rows, full volume) and `lain1876_eval.jsonl`
(gold, 103 rows, panel volume) are **different sets** — don't merge them.
## How to run it
The harness lives in the public repo; only the data is here.
```bash
git clone https://github.com/hadro/city-directory-extraction
cd city-directory-extraction
hf download hadro/cde-evals --repo-type dataset --local-dir data/
```
Then, on the cluster:
```bash
source hpc/env.sh
sbatch $(slurm_gpu_args) --export=ALL,RUN_NAME=<run> hpc/30_eval.sbatch
```
`hpc/30_eval.sbatch` runs the 18 panel volumes, then the externals, then
`eval/evaluate.py` and the `eval/results_table.py` pivot. It sets `HF_HUB_OFFLINE=1`,
so **download this dataset on the login node first** — compute nodes have no network.
Two gotchas that have each cost a full eval cycle:
- **Pass `--base-model`.** `train/sft_qwen.py` trains LoRA, so the run directory is an
adapter, not a full checkpoint.
- **Watch the log for `missing adapter keys`.** That warning means the adapter silently
did not apply and you scored the bare base model. `qwen_predict.py` must load
`AutoModelForImageTextToText` (not `AutoModelForCausalLM`) — Qwen3.5 is multimodal and
`all-linear` adapts the vision tower too. This bug produced a 0.358 macro-F1 that was
really 0.760.
Scoring: `macro-F1` averages over the fields the gold actually has; `micro-F1` is
frequency-weighted. They disagree, and both are reported. See `eval/evaluate.py`.
## Provenance and redistribution
Mixed licensing — there is no single license covering this repo:
- **The 18-volume panel** is this project's own hand labeling of public-domain page scans.
- **`nyu_eval.jsonl` is CC-BY-SA-NC 4.0.** Non-commercial and share-alike. It is used for
*evaluation only* and is never mixed into training, which is what keeps the released
synthetic-trained model permissively reusable.
- **`ftd_eval.jsonl`** is open CC from the SODUCO project.
- **`minneapolis_eval.jsonl`** derives from an MIT-licensed repo.
- **`tulsa`/`lain`** are this project's own pipeline output.
Check the terms before redistributing any of it. The silver-labeled sets
(`tulsa`, `lain`, `minneapolis`) are machine-extracted and not hand-verified — treat their
absolute numbers as approximate and use them for relative comparison across runs.
## Related
- [`hadro/city-directory-extraction`](https://github.com/hadro/city-directory-extraction) — code, harness, docs
- [`hadro/city-directory-synth`](https://huggingface.co/datasets/hadro/city-directory-synth) — synthetic **training** data (public)
- `hadro/city-dir-08b-yaml-v5` — current best adapter