Quoting a paper without letting the model write the quote

Abstract

Literature tools built on language models usually ask one model to read a paper, quote it, and cite it in a single pass. Small errors survive that process: a dropped unit prefix, a rounded value, a missing bound. verifylit separates selection from quotation. The model returns only the identifier of a stored sentence or table row, and code slices the quotation from hashed source text, then checks its numbers, units, and bibliographic record before a person reviews it. On a ten-excerpt paired benchmark the constraint did not change answer accuracy, and both arms missed the same wrong-quantity answer. What the design adds is that every exported quotation can be reproduced from stored bytes.

A one-character error

The verifylit offline demo is built around a seeded error. A stored excerpt from Wang et al.[1] reports a bulk ionic conductivity of 6.0 mS cm⁻¹ at 25 °C. The demo's claim states 6.0 S/cm. The value looks plausible, and it is a thousand times too large.

A model that writes its own quotation can make the same edit in the quote and in the claim. The two then agree with each other while both disagree with the paper. Related errors include a silently rounded figure, a stripped bound such as “≥” or “up to”, and a publication year that is off by one.

Separating selection from quotation

The pipeline never asks the model for quoted text:

  1. Fetch. Each source from Europe PMC (JATS XML), arXiv, or OpenAlex is stored as raw bytes with a SHA-256 hash, retrieval time, identifiers, and source URL.
  2. Index. The canonical text is split into sentences and JATS table rows, each addressed by half-open character offsets [start, end).
  3. Extract. The model returns only a span identifier and a claim, as JSON of the form {"items":[{"span_id":"…","claim":"…"}]}.
  4. Slice. Python validates the identifier and slices the quotation directly from the stored canonical text.

A quotation can therefore be wrong only if the indexed text is wrong, and that text is hashed and can be re-derived from the stored source.

Checking the claim against its slice

Before a claim reaches the reader, code compares it with its slice: every number, qualifier, range, tolerance, and compound unit. It also checks the DOI or arXiv identifier, title, and year against Crossref or arXiv. An optional --semantic pass sends only the question, the sliced quotation, and the claim to a second model, to catch answers to the wrong physical quantity. Claims judged unsupported, or rated below 2 for relevance on a 0–3 scale, enter a priority review queue.

The unit comparison needed one correction. An early parser treated any unit it did not recognise as empty, so “2 mol/L” and “2 cd” compared as equal, and “4.8 W/mK” matched a source that said “4.8 W”. Three regression tests failed. The fix keeps unfamiliar unit names and the whole denominator. A checker that silently normalises what it does not understand is worse than no checker, because it reports agreement it has not established.

One file of evidence

Each run lives in a single SQLite file, evidence.sqlite. Human review decisions are stored separately from the automatic findings, so rejecting a claim leaves the source and the original claim intact.

Table 1. Evidence persisted at each stage.
StagePersisted evidence
FetchSource bytes, SHA-256, retrieval time, publication identifiers, source URL
IndexCanonical text and its hash, section, span kind, half-open Unicode character offsets
ExtractQuestion, validated span ID, claim, stable claim ID
VerifyDOI or arXiv identity, title and year, numeric tokens, optional semantic result
Review and exportExact quotation, each gate outcome, reviewer decision and note, source provenance

A bundled trace script reopens the database offline, recomputes both SHA-256 hashes, and compares the exported quotation with the canonical slice.

What the benchmark showed

The benchmark pairs naive extraction with constrained span selection on ten preselected open-access excerpts about solid electrolytes, with one question and one human-confirmed reference answer per excerpt. Both arms used the same local model (Inkling-2-Mini, IQ4_NL quantisation, llama.cpp on CPU, greedy decoding, seed 42). The naive arm writes a claim, citation, and supporting quotation; the constrained arm returns a span identifier and a claim and then runs the verification gates.

Table 2. Paired results on ten excerpts, as reported in the repository.
MetricNaive extractionVerified spans
Answer matches human reference9/109/10
Exact supporting quotations10/1010/10
Wrong target quantities caught / missed0 / 10 / 1
Citation errors caught / missed0 / 00 / 0
Claims sent to priority reviewn/a0
Inference wall time (s)264.8229.2

On this sample the constraint did not improve answers. Both arms answered nine of ten correctly and quoted all ten excerpts exactly. Both returned 418.7 mS for the excerpt that reports only a conductance. The question asked for conductivity, which needs a length dimension, so the correct response was to abstain. The constrained answer passed the lexical checks because that number and unit do appear in the source. The semantic reviewer, which targets this kind of error, was disabled in the run. The timings include model loading on CPU, so the wall-time difference says little about the method.

Each excerpt offered a single candidate span. The benchmark therefore measures quotation fidelity and claim checking on supplied text. Retrieval and span selection across a whole paper are separate questions, and ten excerpts are too few to estimate error rates.

Limitations

  • A passing numeric check establishes lexical support only. It can still accept an answer to the wrong scientific question, as in the conductance case above.
  • PDF indexing depends on the text layer and reading order that Poppler's pdftotext extracts.
  • When a bibliographic registry cannot be reached, the claim goes to review instead of passing.

Reproducing the demo

With Python 3.11 or later, from a clone of the repository. Installation downloads dependencies; the demo then runs offline.

python -m venv .venv
. .venv/bin/activate
python -m pip install .
verifylit demo
verifylit review verifylit-demo --list
python examples/trace.py verifylit-demo 041722e50617e6d3

The benchmark protocol, saved model outputs, and scorer are in benchmark/.

References

  1. Wang, D., Jhang, L.-J., Kou, R., et al. (2023). Realizing high-capacity all-solid-state lithium–sulfur batteries using a low-density inorganic solid-state electrolyte. Nature Communications, 14, 1895. doi:10.1038/s41467-023-37564-z ↩
  2. Li, T. (2026). verifylit, version 0.1.0. MIT License. github.com/TomLiTao/verifylit