The most dangerous hallucinations in AI-written research notes, health summaries, and technical drafts rarely look obviously wrong. They look impeccably formatted, carry clickable links that return HTTP 200, and read like legitimate scholarship.
A plain link checker misses them — the DOI resolves just fine, except it belongs to an unrelated paper from a decade earlier. Asking a second LLM to "audit the citations" fails just as quietly: another model still cannot inspect live registry metadata, retraction records, or exact byte offsets, and it happily hallucinates false alarms on niche real papers.
This post walks through how claimcite (v0.7.1, pure Python 3.10+ stdlib, zero third-party runtime dependencies) tackles citation verification deterministically:
- Four classic silent AI citation failure modes, demonstrated with exact, reproducible outputs replayed against real recorded registry payloads;
-
Why zero runtime dependencies + "false alarms are worse than misses" drives a strict 4-state verdict model (
26/26recorded-fixture benchmark with0false errors, and192offline tests finishing in<1s); -
Bridging public papers to private local knowledge bases (
sessfork→XERJ + kbwall→claimcite) by verifying host-freexerj://UTF-8 byte spans offline without ever caching private documents to disk; -
Honest boundaries (
Not tested ≠ clean) — what deterministic verification proves and what it intentionally refuses to guess.
Every CLI snippet, benchmark metric, and
xerj://verification output below comes directly from runningbenchmarks/run.py, recorded real responses intests/fixtures/, and a local loopback XERJ check — zero fabricated outputs. Offline reproduction steps are at the end.
1. Four Classic Silent AI Citation Failure Modes (With Exact Verifiable Outputs)
Across real drafts, AI-generated references consistently fail in four quiet ways that slip past skimming eyes. Each output below is produced directly by claimcite replaying real recorded registry responses (53 recorded payloads in tests/fixtures/).
Failure Mode 1: Real DOI Attached to the Wrong Paper or Year ("DOI Laundering")
LLMs routinely emit a valid, high-citation DOI and bolt it onto a fabricated or misremembered title and year. In examples/sample.md (line 7), a claim about green tea halving stroke risk cites doi:10.1016/s0140-6736(10)61388-8 as a 2021 Stroke cohort — when that real DOI actually resolves to a 2011 Lancet paper on the global burden of second-hand smoke. Any HTTP-200 link checker passes it silently.
In the recorded offline benchmark (err_title_mismatch_doi), pairing real DOI 10.1007/s10654-019-00524-3 with Tanaka H (2019). Deep Residual Learning for Image Recognition. Stroke. triggers a hard title-mismatch error:
- **Error** · line 1 · `doi:10.1007/s10654-019-00524-3`
- Coffee consumption and all-cause and cause-specific mortality: a meta-analysis by potential modifiers. (2019)
- Study type (as tagged by PubMed): Systematic review / meta-analysis
- Title does not match this identifier. Registry title: "Coffee consumption and all-cause and cause-specific mortality: a meta-analysis by potential modifiers."
Notice the restraint when only the year is wrong: in warn_year_mismatch (pmid:30221596, citing the 2018 ASPREE aspirin trial as 2024), the title matches, so claimcite emits a Warning rather than a hard CI-breaking Error (and grants a ±1 year tolerance for online-first vs. print publication):
- **Warning** · line 1 · `pmid:30221596`
- Effect of Aspirin on Disability-free Survival in the Healthy Elderly. (2018)
- Study type (as tagged by PubMed): Randomized controlled trial
- Year differs: document 2024, registry 2018
Failure Mode 2: Nonexistent DOI / PMID / arXiv ID (and Invented Unlinked References)
Models synthesize syntactically spotless fake identifiers — doi:10.1001/jama.2022.99999, doi:10.9999/does-not-exist-claimcite, PMID: 99999999, or arXiv:9912.99999.
claimcite checks DOIs against the registrar-agnostic doi.org/api/handles/ API first, then resolves metadata across PubMed, Crossref, OpenAlex, and the arXiv Atom API (including DataCite 10.48550/arXiv.* DOIs). It emits an Error only when the authoritative registry definitively reports the identifier does not exist:
- **Error** · line 1 · `doi:10.9999/does-not-exist-claimcite`
- Identifier does not exist
Even more common are hallucinated citations with no identifier at all. claimcite parses APA, Harvard, MLA, Vancouver, and GB/T 7714 bibliography entries and searches Crossref followed by PubMed by title: ""
-
Found (
ok_unlinked_title_search) → resolves the real identifier and runs full title/year/quote verification; -
Missing from both (
warn_unlinked_invented) → emits a Warning, not an Error (technical reports or slightly reworded titles can also be absent); -
Books & non-open registries (
not_checked_book, e.g., Kahneman's Thinking, Fast and Slow, or Chinese references where CNKI/Wanfang offer no open API) → stays explicitly Not checked instead of crying wolf.
Failure Mode 3: Retracted Paper Cited Uncritically (Without Flagging Retraction Notices)
Training corpora are packed with famous retracted studies. Checking retractions sounds trivial until you inspect real Crossref JSON payloads: Crossref puts update-to on the retraction notice, not on the *retracted paper*. The retracted paper carries updated-by and relation.is-retracted-by (PubMed tags Retracted Publication / RetractionIn; OpenAlex exposes is_retracted).
On top of that, publishers frequently prepend RETRACTED: to the registered title after retraction. claimcite strips _RETRACTED_PREFIX before fuzzy title comparison so you see a clean retraction error (complete with the notice DOI) rather than a spurious title-mismatch error:
- **Error** · line 1 · `doi:10.1016/s0140-6736(97)11096-0`
- RETRACTED: Ileal-lymphoid-nodular hyperplasia, non-specific colitis, and pervasive developmental disorder in children (1998)
- This paper has been retracted (notice: doi:10.1016/s0140-6736(10)60175-4)
Crucially, the paired control case ok_retraction_notice_doi verifies that citing the retraction notice itself (doi:10.1016/s0140-6736(10)60175-4) passes cleanly as OK.
Failure Mode 4: Fabricated Quotes on Real PMIDs + Dangling [n] / Uncited [^n] Markers
In the sneakiest failure mode, the paper, authors, year, and PMID are 100% real — only the quoted words inside quotation marks were invented or exaggerated by the model.
Line 11 of examples/sample.md cites real meta-analysis pmid:33237064 (Food & Function, 2020), then fabricates the quote "calcium and vitamin D supplementation cured osteoporosis in all women":
- **Warning** · line 11 · `pmid:33237064`
- Effects of combined calcium and vitamin D supplementation on osteoporosis in postmenopausal women: a systematic review and meta-analysis of randomized controlled trials. (2020)
- Study type (as tagged by PubMed): Systematic review / meta-analysis
- Quoted text not found in the abstract (it may be in the full text): “calcium and vitamin D supplementation cured osteoporosis in all women”
Because legitimate quotes often live in the paper body rather than the abstract, claimcite falls back on demand to PubMed Central (PMC) and Europe PMC open-access JATS XML full text (stripping <xref> footnote tags and nested <ref-list> blocks), and falls back to OpenAlex (abstract_inverted_index) when Crossref lacks an abstract. It also flags dangling body markers ([2]) and uncited footnote entries ([^1]) as Error while ignoring statistical intervals (60 [52-68] years, [0, 1]).
2. Why Pure Python 3.10+ Stdlib, Determinism, and Zero False Errors
claimcite specifies dependencies = [] in pyproject.toml (Python 3.10+ stdlib only):
-
Frictionless drop-in everywhere:
uvx claimcite mcp,pipx install claimcite, GitHub Actions,pre-commit, and stdio MCP run cleanly on Linux, macOS, and Windows with zero native wheel failures. -
Wall-clock time is network-bound, not CPU-bound: live runs spend their time respecting public API rate limits (Crossref 1 req/s, arXiv 3 s/req, PubMed 0.4 s/req, OpenAlex 0.2 s/req, general web 1 req/s), while offline parsing and verification finish in milliseconds (
26/26recorded-fixture benchmark in0.15swith0false errors;192/192unit tests in0.8sas ofv0.7.1). -
Core invariant — false alarms are worse than misses:
ok/warning/error/not_checkedstrictly separates authoritative failures from network errors, paywalls, or bot walls so CI gates never cry wolf.
3. Bridging Academic Papers to Local Private Knowledge Bases (sessfork → XERJ + kbwall → claimcite)
In private RAG pipelines, retrieval often finds the right paragraph and then the LLM silently flips $42.8M into $48.2M — or drifts a span offset into the middle of a multi-byte UTF-8 character.
claimcite shares a strict host-free URI contract with kbwall and XERJ (xerj://<index>/<doc_id>#b=<byte_start>[-<byte_end>][&f=<field>], forbidding host:port inside documents):
# Citation check
2 ok · 0 warnings · 2 errors · 0 not checked
- **OK** · line 1 · `xerj://fin-filings/q3-2026-memo#b=8-68&f=text`
- XERJ span verified (fin-filings/q3-2026-memo, field text)
- **OK** · line 2 · `xerj://fin-filings/q3-2026-memo#b=69-160&f=text`
- XERJ span verified (fin-filings/q3-2026-memo, field text)
- **Error** · line 3 · `xerj://fin-filings/q3-2026-memo#b=8-68&f=text`
- Quoted text not found in XERJ span: “Revenue recognized in Q3 2026 reached $48.2M”
- **Error** · line 4 · `xerj://fin-filings/q3-2026-memo#b=70-160&f=text`
- XERJ span offset is out of range or splits a UTF-8 character (byte range 70-160 starts inside a UTF-8 codepoint)
Five hard security & privacy invariants guard local verification (src/claimcite/xerj.py & mcp.py, hardened further in v0.7.1 with SECURITY.md):
-
Zero disk caching of private docs:
xerj://responses are verified in memory and never written to the 30-day SQLite registry cache. - Loopback-only by default, never auto-probed.
-
Explicit proxy bypass (
ProxyHandler({})) & zero3xxredirects, with a10 MiBhard cap. -
Strict read-only batch
POST /_mget. -
MCP isolation:
XERJ_URLand optionalCLAIMCITE_ALLOWED_ROOT(blocking symlink suffix-bypass & outside-root escapes) are read strictly from process environment variables — never exposed as MCP tool arguments.
4. Honest Limits (Not Tested ≠ Clean)
- Unquoted paraphrases are not checked — only text inside quotation marks is compared word-for-word.
- No semantic entailment or claim-truth judging — proving a paper exists, is unretracted, and contains a quote does not prove it supports a broader conclusion.
-
Paywalled full text, PDFs, and closed registries stay
warningornot_checked.
5. Reproduce Offline & Wire Into Your Workflow
git clone https://github.com/wasabihu/claimcite.git
cd claimcite
uv run pytest -q # 192 passed in ~0.8s (v0.7.1)
uv run python benchmarks/run.py # 26/26 (100.0%), false_errors=0
MCP config (uvx claimcite mcp — PyPI & Official MCP Registry io.github.wasabihu/claimcite):
{
"mcpServers": {
"claimcite": {
"command": "uvx",
"args": ["claimcite", "mcp"]
}
}
}
-
Canonical post (RSS /
llms.txt): wasabihu.github.io/blog/posts/claimcite-ai-hallucination-audit-en - GitHub & v0.7.1 Release (MIT): github.com/wasabihu/claimcite/releases/tag/v0.7.1
- Interactive Docs: wasabihu.github.io/claimcite
-
Local Verifiable KB Loop:
sessfork·XERJ·kbwall·vericorpus
Top comments (5)
The not_checked state is the part I'd copy. A verifier that quietly skips what it can't reach looks like a pass to anyone reading the result later. Showing how many items were not checked, next to the ones that passed, is what keeps a report honest. Have you thought about printing a one-line summary at the top (ok / warning / error / not_checked counts), so a reviewer sees the coverage before the details?
Totally agree — silent skips are the fastest way to make a verifier untrustworthy.
claimciteactually prints that exact one-line summary right at the top of every report (and in the GitHub Actions Job Summary):{ok} ok · {warning} warnings · {error} errors · {unchecked} not checked(inreport.py). That way a reviewer immediately sees verification coverage before reading individual findings!That summary line is the right design. A reader sees the coverage before the findings, so nothing reads as more checked than it was. Thanks for sharing it.
The restraint is the design here: an Error only when a registry definitively says the identifier does not exist, and Not checked for books and closed registries instead of a guess dressed as a verdict. Our release gate runs on the same refusal — a check that cannot verify says so in its own state rather than decaying into a pass, because the false alarm and the false pass both teach the reader to stop trusting the surface. The severity split is the part I keep turning over: a wrong year is a Warning with ±1 tolerance, a wrong title is a hard Error, so the grade follows how much of the citation's identity is actually contradicted. Was that ±1 year tolerance calibrated from observed online-first versus print gaps in the recorded fixtures, or set by judgement before the benchmark ran?
Great catch — the ±1 year tolerance started as domain judgment rather than a benchmark fit. In practice a single paper often carries multiple legitimate dates (preprint/arXiv, online-first, print issue, or PubMed vs. Crossref indexing lag), so
check.pycollects all known publication years (record.years) and allowsabs(ref.year - y) <= 1against any of them before downgrading a mismatch to a Warning instead of a hard Error. That way a 2023-online / 2024-print citation never triggers a false alarm, while a completely fabricated title or nonexistent ID still fails hard.