Skip to main content

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, 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.

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 others is 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: the doi field does not exist, or resolves (doi.org, Crossref and DataCite) to another title.
  • arxiv-not-found, arxiv-mismatch: an arXiv @misc whose identifier does not exist or has another title.
  • web-mismatch, web-not-found, no-url: a web @misc whose page has another title, is gone, or has no URL in howpublished.
  • 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

License

MIT

Metadata

Release files for check-hallucinations 0.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for check-hallucinations 0.21.0
File Interpreter ABI Platform
check_hallucinations-0.21.0-py3-none-any.whl Python 3 none any Details

Release files / check_hallucinations-0.21.0-py3-none-any.whl

Download URL check_hallucinations-0.21.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4aa99c7cc064c4cf52abd5db4a448810ded464399c619783ebea33bfef6f962c
BLAKE2b-256 checksum
How to use checksums
a6cec013d68e0a716e59a7b0d8e8d12e7c6a5431693e5a1a1fd368188610a32d
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 log

Security for check-hallucinations 0.21.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.21.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page