Detecting Hallucinated Citations with Modular Arithmetic, ISO 26324 DOIs & arXiv Bounds
Autoregressive language models generate bibliographies left-to-right by sampling statistically plausible digit subwords rather than computing global algebraic invariants. Evaluating four offline mathematical checks—EAN Modulo-10 (ISBN-13), prime Modulo-11 (ISBN-10/ISSN), ISO 26324 DOI syntax, and arXiv YYMM calendar bounds—immediately exposes fabricated references in milliseconds inside browser RAM.
Why do autoregressive language models fail citation check digits?
Direct answer: Tokenized transformers sample identifier sub-tokens sequentially without executing modular reduction across all preceding digits. Because Byte-Pair Encoding splits arbitrary 13-digit book numbers into variable 1-, 2-, and 3-digit tokens, the hidden state lacks a reliable linear parity register, causing hallucinated ISBNs and ISSNs to fail check-digit verification roughly 90% to 91% of the time.
Empirical bibliometric audits published in Scientometrics and clinical medical literature documented hallucination rates between 18% and 55% when ungrounded chat models drafted reference lists. Worse, fabricated references rarely look cartoonishly wrong to a tired graduate student or referee: they pair authentic senior authors with plausible journal abbreviations, realistic page ranges, and correctly hyphenated 13-digit book identifiers. A human reader skimming a 60-entry LaTeX bibliography cannot compute a 12-term weighted inner product modulo 10 in their head—whereas a deterministic 40-line parser verifies every entry in under two milliseconds.
Confidentiality constraints compound the problem. Major funding councils—including the U.S. National Institutes of Health (NOT-OD-23-149) and numerous peer-reviewed journals—strictly prohibit reviewers from pasting unpublished manuscripts or embargoed bibliographies into hosted cloud AI portals. Deterministic client-side arithmetic verification sidesteps network disclosure altogether: zero bytes leave the workstation, and every flagged error carries an exact mathematical counterexample rather than an opaque confidence percentage.
How does EAN-13 Modulo-10 verification expose synthetic ISBN-13 strings?
Direct answer: Every modern 13-digit book identifier begins with GS1 Bookland prefix 978 or 979 and terminates in check digit d13 computed by taking the alternating 1× and 3× weighted sum of the first twelve digits modulo 10 and subtracting from 10. Any single-digit hallucination fails immediately.
Consider Kernighan & Ritchie’s The C Programming Language (2nd ed.), whose authentic ISBN-13 is 978-0-13-110362-7. Evaluating the first twelve digits gives: 9(1) + 7(3) + 8(1) + 0(3) + 1(1) + 3(3) + 1(1) + 1(3) + 0(1) + 3(3) + 6(1) + 2(3) = 9 + 21 + 8 + 0 + 1 + 9 + 1 + 3 + 0 + 9 + 6 + 6 = 73. Taking (10 − (73 mod 10)) mod 10 yields 7. If an LLM hallucinates the final digit as 9 (978-0-13-110362-9), the residue shifts to 73 + 9 = 82 ≠ 0 (mod 10), triggering an immediate checksum failure. Note one subtle algebraic blind spot of Modulo-10: because gcd(3 − 1, 10) = 2, an adjacent transposition between two digits differing by exactly 5 (such as swapping 2 and 7) preserves the sum modulo 10 because 2 × 5 ≡ 0 (mod 10). All other adjacent transpositions and 100% of single-digit substitutions are caught deterministically.
Why are ISBN-10 and ISO 3297 ISSN check digits stronger modulo prime 11?
Direct answer: Working over the prime field ℤ11 eliminates zero divisors. Both ISBN-10 (weights 10 down to 1) and 8-digit journal ISSNs (weights 8 down to 1, allowing terminal X = 10) guarantee 100% detection of every single-digit alteration and every transposition of any two distinct digits, even non-adjacent ones.
Suppose positions a ≠ b holding digits x ≠ y are swapped. The change in the weighted sum equals (b − a)(x − y). Since 1 ≤ |b − a| ≤ 9 and 1 ≤ |x − y| ≤ 10, neither factor is divisible by prime 11; therefore their product cannot vanish modulo 11. In practice, older academic monographs and journal runs (like Nature ISSN 0028-0836 or Science ISSN 0036-8075) frequently appear in literature reviews—validating ISSN Mod-11 instantly catches synthetic serial numbers invented to dress up a fake journal name.
What structural invariants catch malformed ISO 26324 DOIs and arXiv preprints?
Direct answer: Unlike ISBNs, DOIs and arXiv IDs lack a trailing check digit, but both enforce strict grammar and chronological rules. ISO 26324 requires prefix 10.<4..9 digits>/<non-empty suffix> excluding placeholder registrants (10.0000, 10.1234, 10.9999), while post-2007 arXiv IDs encode YYMM submission dates and transitioned from 4-digit to 5-digit sequence counters in January 2015.
| Era / Scheme | Valid Grammar | Common Hallucination Signature | Deterministic Verdict |
|---|---|---|---|
| arXiv 2007–2014 | 0704.NNNN .. 1412.NNNN | 1315.4821 (month 15) or 5 digits in 2012 | REJECT |
| arXiv 2015–present | YYMM.NNNNN (5 digits) | 2309.6180 (4 digits post-2015) or year mismatch (2019 ID cited as 2025) | REJECT / WARN |
| ISO 26324 DOI | ^10\.\d{4,9}/[^\s]+$ | 10.1234/ai.2025.001 or trailing period swallowed into suffix | FLAG PLACEHOLDER |
| BibTeX Syntax | Balanced {} + required fields | Unclosed title braces, duplicate cite keys, orphan \cite{} | PARSE ERROR |
// Deterministic arXiv YYMM + 4/5-digit era check (runs in < 0.05 ms)
function validateArxivId(id, citedYear) {
const m = id.trim().match(/^(\d{2})(\d{2})\.(\d{4,5})(?:v\d+)?$/);
if (!m) return { ok: false, reason: 'Invalid post-2007 YYMM.NNNN(N) grammar' };
const yy = Number(m[1]), mm = Number(m[2]), seq = m[3];
const fullYear = 2000 + yy;
if (mm < 1 || mm > 12) return { ok: false, reason: `Impossible month ${mm}` };
if (fullYear === 2007 && mm < 4) return { ok: false, reason: 'Predates 0704 scheme' };
if (fullYear >= 2015 && seq.length !== 5) return { ok: false, reason: 'Post-2015 IDs require 5 digits' };
if (fullYear < 2015 && seq.length !== 4) return { ok: false, reason: '2007-2014 IDs require 4 digits' };
if (citedYear && Math.abs(citedYear - fullYear) > 2) {
return { ok: false, reason: `Year splice: arXiv ${fullYear} vs cited ${citedYear}` };
}
return { ok: true, fullYear, mm };
}How should students and editors combine offline math with live registry resolution?
Direct answer: Run a two-stage verification funnel. Stage 1 runs offline in local browser RAM to strip malformed BibTeX braces, orphan inline citations, bad ISBN/ISSN check digits, and impossible arXiv dates with zero manuscript disclosure. Stage 2 resolves surviving DOIs and titles against Crossref, PubMed, or library catalogs before camera-ready export.
Separating deterministic structural verification from remote metadata lookup solves both speed and privacy. You never leak unpublished prose to an external API just to learn that entry #14 is missing a closing brace or that (Author, 2024) was deleted from the bibliography during revision. Once Stage 1 is clean, resolving only the bare DOI list against Crossref reveals semantic mismatches—such as a real DOI attached to an invented title.
As a concrete worked walk-through, examine how a three-entry conference bibliography behaves across every stage of deterministic screening. Entry 1 carries authentic ACM DOI 10.1145/872757.872770 (Schleimer et al., SIGMOD 2003), balanced BibTeX braces, required venue/year metadata, and a matching inline citation (Schleimer, 2003) inside the manuscript body—passing all syntax, registrant, and cross-reference checks. Entry 2 cites arXiv identifier 2309.06180 (Kwon et al., 2023): prefix 2309 maps to September 2023, sequence suffix 06180 satisfies the post-2015 five-digit rule, and the cited publication year 2023 matches the arXiv submission year with zero drift. Entry 3 represents a classic synthetic composite: an invented journal title (Journal of Advanced Modern Computing), ISBN-13 978-0-13-110362-9 (weighted sum 73 requires check digit 7, not 9), placeholder DOI prefix 10.1234/, and a four-digit arXiv suffix 2019.9999 bearing impossible month 19—triggering four independent deterministic failures in under one millisecond.
Finally, watch for three subtle parser edge cases when implementing automated bibliography linters in LaTeX and Markdown toolchains: (1) trailing punctuation copied from prose (such as https://doi.org/10.1145/872757.872770.) must strip terminal periods or closing parentheses before regex validation so authentic citations are not falsely rejected; (2) ISBN-10 strings ending in lowercase x must normalize to uppercase X representing integer value 10 before summing modulo 11; and (3) multi-author APA/Harvard inline keys (Smith & Patel, 2024 or Kwon et al., 2023) should normalize Unicode diacritics via NFKD decomposition before matching against BibTeX surname tokens so accented scholar names never register as false orphan citations.
Primary Standards & Peer-Reviewed References
- ISO 26324:2022 — Information and documentation — Digital object identifier system
- International ISBN Agency — ISBN Users’ Manual, 7th Edition (EAN-13 & Mod-11 Algorithms)
- ISSN International Centre — ISO 3297 International Standard Serial Number Check Digit Specification
- Cornell University arXiv — Understanding the arXiv Identifier (0704 & 1501 Scheme Transitions)
- NIH Notice NOT-OD-23-149 — Prohibition on Using Generative AI Technologies in Peer Review
- Walters & Wilder (Scientometrics, 2023) — Fabrication and Errors in the Bibliographic Citations Generated by ChatGPT
Citation Checksum Forensics FAQ
- What percentage of randomly fabricated ISBN-13 numbers fail Modulo-10 checksum verification?
- Exactly 90% of uniformly sampled 13-digit strings violate the EAN-13 Modulo-10 congruence, because only 1 out of 10 terminal digits satisfies the alternating 1×/3× weighted sum. Combined with GS1 978/979 prefix screening, deterministic checksum math eliminates the vast majority of hallucinated book citations offline.
- Why does ISBN-10 detect every single-digit error and every adjacent transposition?
- Because 11 is prime, every nonzero weight difference (w_i - w_j) and every nonzero digit delta (d_i - d_j) is invertible modulo 11. Thus swapping any two distinct digits or altering any single digit produces a nonzero residue mod 11, guaranteeing 100% detection of both error classes.
- How can a peer reviewer catch fabricated arXiv IDs without external API lookups?
- Check three structural invariants: (1) post-April 2007 prefixes YYMM must fall within valid calendar months 01–12 and not lie in the future, (2) sequence suffixes switched strictly from 4 digits (0704–1412) to 5 digits starting in January 2015 (1501+), and (3) the YY year must reconcile with the cited publication year.
- Does passing ISO 26324 DOI syntax validation prove a paper exists?
- No. Offline syntax validation catches placeholder registrants (10.0000, 10.1234, 10.9999), illegal whitespace, unbalanced BibTeX braces, and malformed prefixes, but confirming title-to-DOI correspondence still requires resolving the DOI against Crossref or doi.org.