check-hallucinations
A command-line tool to detect hallucinated references in BibTeX files before submitting a paper to arXiv.
It looks up each reference (Semantic Scholar, then OpenAlex when Semantic Scholar has no matching title; arXiv; the web page of a @misc), and checks that the paper found is the one the entry describes: same title, same authors, same year, and a DOI that resolves to that title.
Titles are compared whatever their punctuation and markup: &, #, +, %, ?, :, parentheses, quotes, dashes, LaTeX accents and commands (D\&C, C\#, Bissyand{\'e}, \emph{x}), and venue names that some records prefix to the title. Symbols that change the meaning stay: C, C++ and C# are different titles.
Installation
pip install check-hallucinations
Usage
check-hallucinations references.bib # silent when every entry is confirmed
check-hallucinations --json references.bib # findings as a JSON array, [] when clean
check-hallucinations -v references.bib # also list each confirmed entry with its URL
One line per finding, file:line: rule: key: message:
references.bib:5: authors-mismatch: wrongauthors: first author smith is not an author; the paper is by Ashish Vaswani, Noam Shazeer, N. Parmar, J. Uszkoreit, ...
references.bib:5: year-mismatch: wrongauthors: year 2009, but the paper is from 2017
references.bib:9: doi-mismatch: wrongdoi: doi 10.1038/nature14539 is 'Deep learning'
references.bib:13: not-found: fake: not found in SemanticScholar: A Unified Theory of Self-Healing Compilers for Quantum Blockchains
Exit status: 0 every entry confirmed, 1 findings, 2 the file cannot be read. This makes it usable as a CI step.
Rules
not-found,title-mismatch: no paper with this title (the closest title is given).authors-mismatch: the first author is not an author of the paper found, or fewer than half of the authors are. Last names are compared, LaTeX accents and diacritics removed;and othersis ignored.year-mismatch: the year differs from the paper's by more than two (preprint, online-first and issue years differ, and Semantic Scholar may date a later version).doi-not-found,doi-mismatch: thedoifield does not exist, or resolves (doi.org, Crossref and DataCite) to another title.arxiv-not-found,arxiv-mismatch: an arXiv@miscwhose identifier does not exist or has another title.web-mismatch,web-not-found,no-url: a web@miscwhose page has another title, is gone, or has no URL inhowpublished.no-title,unparsed: an entry without title, a block that is not valid BibTeX.unchecked: a lookup failed (network, rate limit). The entry is neither confirmed nor refuted; run again.
misc entries with an arXiv identifier are checked on arXiv, other misc entries on their web page.
API key
By default the tool uses the public Semantic Scholar API (rate-limited). For higher throughput, set the SEMANTICSCHOLAR_API_KEY environment variable (or store it with keyring set check-hallucinations ss_api_key):
export SEMANTICSCHOLAR_API_KEY=your-key-here
check-hallucinations references.bib
Answers are cached in ~/.cache/check-hallucinations.
Library
process_bibtex_file(path) prints the per-entry report of earlier versions (now with author, year and DOI mismatches as extra lines); check_entry(entry) returns the findings of one parsed entry.
Development
uv venv && uv pip install -e '.[dev]'
.venv/bin/pytest && .venv/bin/ruff check . && .venv/bin/mypy check_hallucinations tests scripts
.venv/bin/python scripts/live_check.py [more-real.bib ...] # network: silent when the lookup is right
The live check runs the lookup on scripts/corpus/real/ (real papers with difficult titles: every entry must be confirmed) and scripts/corpus/invented/ (every entry must be reported). Add a title that the tool gets wrong to the corpus before fixing it.
License
MIT
Metadata
Release files for check-hallucinations 0.22.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| check_hallucinations-0.22.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / check_hallucinations-0.22.0-py3-none-any.whl
| Download URL | check_hallucinations-0.22.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39089da57e372760df81aa59d41eb5a40307161bd8cb188c5c9168f11996271e
|
|
BLAKE2b-256 checksum How to use checksums |
4b028833c8018385c43c80718395eec8658f71e55f61493bb8306420284ae221
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.
Transparency logSecurity for check-hallucinations 0.22.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 1 file in this release has been uploaded with provenance metadata.
Attestation for check_hallucinations-0.22.0-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.