LLM Pipeline for Unstructured Bibliography

*A highly complicated archaeological bibliography, turned into 40,628 structured rows with provenance.*

**Summary:** GLM OCR preserves layout, a deterministic parser routes rows, an LLM does only what LLMs are good at, and rules carry the rest of the load.

**Status:** active · **Year:** 2024 - ongoing **Tags:** AI Systems, Digital Humanities, Data Engineering, OCR, Multilingual

---

A bibliography stuck in a book *THE PROBLEM*

The Nova Bibliografia Pompeiana is a huge bibliography of work on Pompeii and Herculaneum. It was valuable, but it was still basically trapped as a book: pages, columns, headings, and citations that humans could read but software could not reliably sort. To turn it into data, the pipeline had to understand the words alongside the layout, author inheritance, cross-references, and source location. That is why the problem stayed stuck for so long.

![A raw page from the Nova Bibliografia Pompeiana.](/figures/palp/fig-nbp-book-scan.png) *SOURCE — A raw page from the Nova Bibliografia Pompeiana.*

Six ways this breaks naive pipelines *FAILURE MODES*

![The same bibliography varies by language, authors, places, dates, series, and level of detail. Color overlay maps each axis of variation onto a real two-column page.](/figures/palp/fig-failure-modes-overview.png) *OVERVIEW — The same bibliography varies by language, authors, places, dates, series, and level of detail. Color overlay maps each axis of variation onto a real two-column page.*

Multilingual Italian, German, French, English, Latin - often in the same citation. > Zanker, P. 1995. Pompeji: Stadtbild und Wohngeschmack. Mainz: von Zabern.

German title in an Italian-language bibliography. Title-case rules differ.

Bibliographic abbreviations RM, BdA, NSc, MEFRA - journal abbreviations with no universal registry. > Eschebach, H., RM 85 (1978), 237–252.

RM is Mitteilungen des Deutschen Archäologischen Instituts. No universal registry maps it.

Inherited author headings An author name appears once as a heading, then silently applies to the next several numbered entries. The link is layout, not syntax - nothing in the row text says who wrote it. ![Blank, David - Langslow - Longo Auricchio, Francesca appears once. Entries 4508–4510 all inherit it.](/figures/palp/fig-inherited-author.png)

Fragmentary rows Ibid, Cfr., v. anche - cross-references that look like citations but aren’t records. > 4526. v. anche altra ed.: Valencia (Prometeo) 1917.

"v. anche" = "see also." A pointer, never a standalone record. Has a number, still isn’t one.

Duplicate citation numbers The same number appears multiple times across volumes. > 3776. Maiuri, A. La Casa del Menandro. Roma 1933. > 3776. Della Corte, M. Case ed abitanti di Pompei. Napoli 1954.

Same number, different volumes, different authors, different years. The number alone fails as an ID.

Gold-set drift Reference sheets use normalized forms; strict comparison punishes the model for matching the page. > PAGE: De Carolis, E. 'Il tesoro di Moregine', BdA serie VI, 2000. > GOLD: De Carolis, Ernesto - Il tesoro di Moregine (Bollettino d'Arte, 2000)

Model matches the page exactly. Strict scoring marks it wrong because it doesn’t match the normalized gold.

The pipeline *THE SYSTEM*

The breakthrough was GLM OCR. It preserved enough of the page structure, columns, headings, and citation numbers to make the rest of the pipeline possible. From there, the system could parse rows, classify fragments, send real standalone citations to Qwen 3.6 Plus, and keep risky rows out of the clean import path. The final pipeline is not one prompt, it is a full production system with parsing, routing, extraction, cleanup, IDs, and review tiers.

**Pipeline:**

1. **Source PDF** (input) — Nova Bibliografia Pompeiana, scanned pages and columns. 2. **GLM OCR** (process) — Layout-preserving read of pages, columns and citation numbers. 3. **OCR parser** (process) — Segments rows and tracks each row back to its page and column. 4. **Row classifier** (rule) — Decides if a row is a standalone citation or a fragment like 'v. anche'. 5. **Qwen 3.6 Plus** (process) — Structured field extraction on standalone citations only. 6. **Fragment rules** (rule) — Keeps the raw row, marks it for review, never invents fields. 7. **Postprocess** (process) — Normalizes whitespace, dates, ranges and inherited authors. 8. **Deep-sweep audit** (process) — Fixed 12,503 cells, every change logged with a reason. 9. **NBP_UI_UID** (process) — Collision-safe ID built from source, page, column and hash. 10. **Final split** (output) — Zotero-ready rows on one side, need-review rows on the other.

Each stage has one job. The LLM only sees rows the rule layer has already declared safe; everything risky stays in a separate, fully traceable lane until a human signs off.

What sorting looks like *EXAMPLES*

Strict scoring is misleading *ACCURACY*

  • Strict gold-aware: **67.7%**
  • Calibrated: **91.0%**
  • Text-evidence verified: **96.7%**

*Genuine model-error rate after text-evidence verification: ~1.5%.*

  • **Source-backed citations:** 884
  • **Acceptable rate:** 94.0%
  • **Genuine model error:** 1.5%
  • **Wrong:** 53

Why this was solvable in 2026 *CONDITIONS*

For years, this was possible in theory but not practical in reality. OCR could read some text, but it usually lost the layout that made the bibliography understandable. LLMs were either too expensive, too inconsistent, or not good enough to run across tens of thousands of messy citations. In 2024 to 2026, the missing pieces finally started arriving close together.

AUGUST 2025 — Layout-aware vision models arrive *106B params · 42 benchmarks* Zhipu AI releases GLM-4.5V. Vision-language models start to understand document structure alongside the text.

FEBRUARY 2025 — LLM inference hits commodity prices *$0.26 / $0.78 per M tokens* Qwen Plus drops to a price point where running 50,000 citations costs under ten dollars, not thousands.

MARCH 2026 — Specialized document OCR matures *1.86 pages / second* GLM-OCR ships a 0.9B-parameter model ranked #1 on OmniDocBench v1.5. Layout preservation stops being the hard part.

*Sources: Sources: Zhipu AI (GLM-4.5V, GLM-OCR), Alibaba Cloud Model Studio (Qwen Plus pricing), OmniDocBench v1.5 leaderboard*

What matters is that the exact things this project needed all crossed the quality and price line at almost the same time. Earlier, this pipeline would have been technically possible but economically unreasonable. Now it became something I could actually build, test, rerun, and verify.

What it took to get here *ATTEMPTS*

I started working on this seriously in mid-2024. The first approach was the obvious one: give a frontier model a very detailed system prompt and ask it to sort citations directly. That helped me write the rulebook, but it did not produce a stable enough dataset. Each later attempt got closer, but each one failed for a different reason.

MID 2024 — GPT-4.1 (failed) *FRONTIER · SYSTEM PROMPT* First honest attempt. Built the rulebook - fragmentary row detection, inherited authors, multilingual normalization - all in one long system prompt. **Takeaway:** The rules were right. The model wasn’t reliable enough to follow them across 50,000 citations.

LATE 2024 — Gemini 2.5 Pro (failed) *LONG CONTEXT · BATCHED* Moved to longer batches, tried to push whole chapters through a single call. **Takeaway:** Output quality degraded past ~30 citations per batch. Long context wasn’t the constraint.

EARLY 2025 — Gemini 2.5 Flash (failed) *COST OPTIMIZATION* Traded accuracy for throughput. The batch job finally ran end-to-end. **Takeaway:** Fast and cheap, but hallucinations on ambiguous rows made the output unverifiable.

MID 2025 — Gemini 2.5 Pro - fine-tuned (partial) *SFT ON 3K HAND-LABELED ROWS* Fine-tuned on hand-corrected citations. Accuracy on seen patterns improved, generalization didn’t. **Takeaway:** Training data labels were the bottleneck. A bigger labeled set wasn’t coming.

LATE 2025 — GPT-OSS (failed) *OPEN WEIGHTS · LOCAL* Open-weights models caught up enough to be worth trying. Ran locally to remove API cost from the equation. **Takeaway:** Unblocked cost but hit the accuracy ceiling of smaller open models on multilingual edge cases.

EARLY 2026 — Kimi K2.5 (partial) *LONG CONTEXT · OPEN WEIGHTS* Better at long structured instructions than the GPT-OSS family. Handled the rulebook more faithfully. **Takeaway:** Closest attempt yet. Still not stable enough across reruns to trust without heavy review.

2026 — Qwen 3.6 Plus (final) *PRODUCTION* Right accuracy, consistent across reruns, fast enough to batch 50k citations in a weekend, cheap enough to re-run. **Takeaway:** All four constraints finally aligned at the same model.

The pipeline shape was already right from the first attempt: parse the citation, apply rules, preserve uncertainty, and verify the result. What changed was that model quality, OCR quality, and inference cost finally caught up to the design. Sometimes the right engineering move is knowing when not to force a weak system to ship.

What's in the file *THE DATASET*

  • **Total rows:** 40,628
  • **Zotero-acceptable:** 30,526 (75.1%)
  • **Need-review:** 10,102 (24.9%)
  • **Duplicate UIDs:** 0
  • BLANK Title: 0
  • BLANK Object Type: 0
  • BLANK FullCitation: 0
  • BLANK OCR_Page: 0
  • BLANK OCR_Column: 0
  • BLANK NBP_UI_UID: 0
  • DUPLICATE UIDs: 0

The final file is a structured bibliography with authors, titles, object types, years, pages, source locations, stable IDs, and review labels. The safe rows can move toward Zotero and website search, while uncertain rows are clearly separated for human review. That means future work can focus on the hard remaining cases instead of redoing the whole bibliography by hand.

**Future work:**

  • Public search interface over the cleaned bibliography
  • Cross-reference with archaeological site and object databases
  • Open-source the rule engine as a standalone library
  • Methodology paper on multilingual citation extraction evaluation
  • [Dataset (staging)](#)
  • [Pipeline notebook](#)
  • [Methodology draft](#)
  • [Audit log](#)