drawers (Auditable Fossil Measurement Extraction)

Role: Solo: pipeline design, implementation, review rulings, and the go or no-go on every paid run
Tech Stack: Python, SQLite, PyMuPDF, Docling, RapidOCR, Anthropic and OpenAI APIs (including the Message Batches API), pytest
Repository: Private. Demo available on request

Overview

The measurements of East and Southeast Asian hominin fossils are scattered across decades of papers, many of them in Chinese, in tables that were typeset, scanned, and given text layers of varying quality. drawers is a registry built from that literature: an LLM reads each paper and writes one record per fact (a measurement, a date, a site, a specimen, a claim), and every record carries the page it came from and a verbatim quote from that page.

I am not a paleoanthropologist, and this page does not report a scientific result. The project is about the engineering question underneath: if a model extracts 50,000 facts from papers I can’t fully read myself, what would it take for someone else to check any one of them? My answer was to never store a number without its quote and page, to keep the raw records unedited, and to make “trusted” a derived label with a written rule behind it.

As of 2026-10-01 the run called sol61_v8 holds 50,175 records from 85 papers, and 48,585 of them are trusted. The repo is 631 commits from 2026-09-27 to 2026-10-18, when I stopped: the concept was proven and I moved on to other things. At the last commit (7657e07) it has about 29,000 non-blank lines of pipeline code, 12,600 of command-line tools, and 59,500 of tests in 279 test files (about 7,080 test functions by a text count, not a collector run).

System Architecture

graph TD
    A[Catalog: seeds, journal archives, OpenAlex] --> B[Acquire open PDFs, policy check on every request]
    B --> C[Text layer with PyMuPDF]

    subgraph "Page reads"
    C --> D[OCR for pages with no usable text]
    C --> E[Table ladder: Docling vs text layer]
    E --> F[Vision read of queued table pages]
    end

    D & F --> G[Merged page text]
    C --> G
    G --> H[Provenance pre-pass: where the paper's data come from]
    H --> I[Windowed extraction, format v8]
    I --> J[Free checks: quote found, value in quote]
    J --> K[Judge: second model, verdict per record]
    K --> L[(candidate_record: raw, never edited)]
    L --> M[Derive rules: units, sites, specimens, trusted]
    M --> N[Measure naming]
    N --> O[Cross-reference report across papers]

Components

  • Acquisition. Sources come from seed lists, two journal archives and OpenAlex discovery. Only copies anyone could fetch anonymously are used. A policy module checks every request and every redirect hop against a list of excluded hosts.
  • Page reads. PyMuPDF takes the text layer. Pages without usable text go to OCR. A “table ladder” compares Docling’s table cells against the text layer and queues the pages that disagree for a paid vision read.
  • Extraction. The paper is read in overlapping page windows, and each window is checkpointed to its own file, so a stopped run resumes without paying twice. The cache key includes the model, the PDF hash, the window and the prompt, so changing any of them re-runs that window and nothing else.
  • Free checks. With no API call, every record is checked: is the quote long enough, is it on the cited page, does the value appear inside the quote.
  • Judge. A different model reads the paper and rules on each record: correct, repaired, wrong, unsupported or unsure. The extractor for this run was gpt-6.1-sol and the judge was claude-sonnet-5-5, so no model graded its own work.
  • Derive and cross-reference. Rule-based code (no model calls) parses values and units, resolves sites and specimens, and sets trusted. A final report lines up the same measurement of the same specimen or site across papers.

What “Trusted” Means

Trusted is not “verified by a person”. In the repo’s own terms, as of the 2026-10-01 count, a record is trusted when three things hold: the judge ruled it correct or repaired it (and the repair was actually applied), the extractor did not mark its own confidence low, and the quote does not come from a page whose text layer garbles numbers.

The judge’s verdicts over all 50,175 records were: correct 48,480, wrong 1,464, repaired 134, unsure 82, unsupported 15. That is 2.9% marked wrong overall, 4.9% for measurements, 1.7% for claims and 0.6% for sites. The 641 records that failed a free check came out 11.1% wrong, which is at least a sign the cheap checks point at the right rows.

The database note says this plainly and I’ll repeat it: these are one model’s verdicts, and nobody has checked the judge against a hand-checked sample. The 2.9% is the judge’s opinion of the extractor. It is not a measured error rate for the database.

The rule has grown since that count. Later commits add a plausibility bound (a value outside the range for its kind of measurement is untrusted whatever the judge said) and a few narrow, documented exceptions I approved, such as one batch of recovered table rows where 25 of 25 sampled rows were right. I have not re-counted the totals under the newer rules for this page.

How Extraction Quality Was Checked

1. Bake-offs Against a Pooled Reference

The first comparisons scored each run against another run, which counts everything the reference missed as the other model’s mistake. So scoring moved to a pooled reference: pool every run’s records for a paper, have one judge verify each fact once, and score each run against all verified facts, whoever found them. Precision and recall here mean “against judge-verified facts in that pool”, not against an answer key, and a run can only be compared with another inside the same pool.

TestSampleResult
Unseen papers (2026-09-29)4 papers, 2-run poolgpt-6.1-sol recall 0.907, precision 0.823 on 2,570 records; the older Opus run 0.562 / 0.734
Rerun noise (2026-09-29, re-judged 09-30)same config twice, 4 papersrecall 0.810 vs 0.798; per-paper gaps up to 7.3 points
Pre-run validation (2026-09-30)4 papers, 1,808 recordsprecision 0.960 (recall is meaningless with one run in the pool)
Three models, same prompt (2026-10-18)7 pages, 735 verified factssol61_v8 0.94 recall / 0.97 precision; luna_v8 0.52 / 0.59; opus55_v8 0.41 / 0.54

The rerun test set the noise floor I use: a per-paper difference under about 8 points, or an overall difference under about 2, is run-to-run noise. That comes from one rerun on four papers, so it is a rule of thumb. In the 2026-10-18 slice, most of the two weaker runs’ failures were origin labels (whether a number is the paper’s own or cited from elsewhere): 253 of 639 records and 249 of 561, against 20 of 712 for the chosen run. Seven pages is a small sample.

2. Checking the Judge

A judge that is too lenient would flatter every number above, so the judge got its own tests on 2026-09-28 and 09-29.

  • Four judge settings, one blind adjudicator. I had 215 records re-read by a stronger model that saw no earlier verdict. On the 143 records every setting had judged, the setting I kept (Sonnet 5.5, 40 records per call) was overruled 33 times: 6 false accepts and 27 false rejects. The original setting was overruled 57 times. Judges mostly erred by rejecting good records.
  • A control group. Of 40 records that every judge setting verified, the adjudicator rejected 3. Three out of 40 is too few to pin down a rate: the runbook gives the plausible range as about 2.6% to 19.9%.
  • A second adjudicator from another vendor agreed with the first on 181 of 215 records (84%), and most of the splits were origin calls.
  • A stricter-or-looser check on two papers. A stronger model re-judged the same records and agreed with the Sonnet judge on 91.3% and 93.9% of them. Sonnet was the stricter of the two, so the extractor’s scores are not inflated by a soft judge. The limit is two papers.

These picks were chosen by disagreement, so none of these counts is an error rate for the whole database, and the adjudicator is a single model standing in for truth.

3. What a Person Checked

Less than I would like. I reviewed and agreed with one set of 65 origin rulings and 40 unit-rule pages on 2026-09-29. A planned check of judge flips was withdrawn because most of the flipped records were in Chinese papers and I can’t read Chinese. A 50-record mapping spot check was still not done as of 2026-09-30. For Chinese text the rule is that the strongest model settles disputes and I audit the English only.

Two later checks are worth the numbers. On 2026-10-02, 50 damaged values were compared against crops of the printed page, and the judge’s proposed fix was wrong for 9 and missing for 1, so a judge fix alone no longer counts as evidence. On 2026-10-05, five independent model reviewers sampled the standardised tables: the stored number matched the print in 62 of 62 sampled rows and page references were right on all 114, but 15 of 66 rows (23%) had some labelling fault such as the wrong column, subject or value role. The numbers held up and the labels around them did not, and the samples are small.

4. Bugs the Checks Caught

  • A plus-or-minus sign decoded as a 6. One paper’s text layer printed 13Âą3 (n=9) as 1363(9). The judge reads the same broken text, so it could not see the problem. A text-layer fault gate flagged 4,899 records across seven papers, and those papers were re-extracted from OCR text. After that, zero records carried the flag.
  • Repairs trusted but never applied. A skull chord was trusted at 12615 mm when the judge had corrected it to 126.5. Repairs are now applied in the derived layer, and one that can’t be applied leaves the row untrusted.
  • Spaced decimals. Several Chinese journals print 11.1 as 11. 1, which was read as two numbers. It hit 1,239 rows.

What It Cost

Paid steps print a free estimate first, and since 2026-09-30 an extraction run refuses to start without a spending cap. These are the figures the runbook records for the full sol61_v8 run on 2026-09-30 and 10-01:

StepSpend
Vision reads of table pages$18.28
Provenance pre-pass$4.82
Extraction$59.43
Re-extraction of the faulted papers from OCR text$10.68
Vocabulary mapping (batch)$19.72
Judge (batch)$58.16

The rows add up to $171.09. That sum is mine, not a figure from the runbook, and it covers only these six steps. It leaves out the OCR pass itself, the earlier pilots and bake-offs, the judge experiments, and all work after 2026-10-01. The extraction figure counts some cached windows twice, by the runbook’s own note, and under $1 was lost when a power cut interrupted one run. Mapping and judging went through the Message Batches API at half price, and the waves I have a real-versus-estimate figure for came in at 45% to 62% of their worst case.

The registry is built to publish extracted facts with citations, not the papers. Nothing is public yet. PDFs, page text and OCR output are kept out of the repository (stored elsewhere or gitignored, under a comment that reads “source content: never redistributed”). Each record does keep a short verbatim quote: a quoted line from a published paper, with its page, is a fact anyone can trace and verify, and that is what makes the record checkable. The export is an allowlist: page text, PDF text, abstracts and file paths never leave, and the export records the length of its longest quote so a page-sized one would show up as a leak. Code is MIT and data exports are CC-BY-4.0.

On acquisition the rule was set before the first download: no scraping of subscription databases, no shadow libraries, and no logging in anywhere. The code enforces it on every request. A blocked source is recorded as a gap with the refused URL, not dropped silently.

Code Snippet: The Trust Rule

Condensed from drawers/derive.py

UNTRUSTED_PROBLEMS = frozenset({'text_layer_fault', 'implausible_value'})


def trusted(verdict, confidence, problems=()):
    """The default filter for analysis: the judge found the record correct or
    repaired it, the extractor did not mark it low confidence, and the checker
    found no problem in UNTRUSTED_PROBLEMS."""
    if not isinstance(problems, (list, tuple)) or not all(isinstance(x, str) for x in problems):
        raise TypeError(f'problems must be a list of strings, got {problems!r}')
    return (verdict in ('correct', 'repaired') and confidence != 'low'
            and not UNTRUSTED_PROBLEMS & set(problems))

The low-confidence clause has its own evidence in the docstring: 73% of the extractor’s low-confidence records were judged bad on 2026-09-28. Trust is computed on every rebuild and the raw record is never changed, so tightening the rule later costs nothing.

Current State and Limits

  • No hand-checked precision. Every quality number on this page is a model’s verdict on another model, or a small sample.
  • Specimen identity is thin. Of 16,007 trusted measurements, 347 carry a specimen name. Most cross-paper matches are at site level (32 of 41), which says two papers report the same number at the same place, not that they measured the same bone.
  • Names don’t line up yet. 96% of the 2,927 measure names occur in exactly one paper. Cross-paper comparison works for 121 names.
  • Some bad values are still trusted. As of 2026-10-01, four tooth areas were stored as mm instead of mm², and 55 values over 300 mm were trusted without anyone sorting which are circumferences.
  • What the cross-reference found. 41 matches, no value disagreements, and three cases where two papers give the same numbers for the same specimen but name different teeth. Resolving those needs someone who can read a 1982 Chinese table, and that is not me.

Tech Stack

  • Language: Python, with six declared dependencies (pymupdf, docling, rapidocr_onnxruntime, anthropic, requests, pytest). OpenAI calls use standard-library HTTP.
  • Storage: SQLite. Raw records in one table that is never edited, and derived tables rebuilt from rules with a hash of the rule set so a stale build is detectable.
  • Models: gpt-6.1-sol for extraction, claude-sonnet-5-5 as judge, claude-sonnet-5 for vocabulary mapping, stronger models as blind adjudicators. RapidOCR is there as a local cross-check on OCR numbers, but it is not wired into the pipeline yet.
  • Cost control: free previews, a required --max-usd cap, per-window and per-chunk checkpoints, and batch submission in waves that fit under the cap.
  • Testing: pytest, 279 test files. No CI workflow in the repo.
  • Docs: a runbook split by topic with exact commands, tunables and their evidence, and dated measured results, including the ones that argued against a design.