Skip to content

About

BibTeX hallucination detector — verifies references against CrossRef and Semantic Scholar, flags potentially fabricated entries, and generates a corrected .bib file

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

BibTeX Hallucination Detector

A Python tool that checks .bib file entries against academic databases (CrossRef and Semantic Scholar) to flag potentially fabricated or hallucinated references — a common problem when using LLMs to generate bibliographies.

How It Works

For each entry in a BibTeX file, the tool:

  1. Queries CrossRef by title (and by DOI if present)
  2. Queries Semantic Scholar by title
  3. Scores each candidate match using a weighted composite:
    • Title similarity: 40%
    • Author overlap: 25%
    • Year match: 20%
    • Venue similarity: 15%
  4. Classifies the entry into one of:
    • VERIFIED (score >= 0.80) — likely a real paper
    • PLAUSIBLE (0.50 - 0.80) — probably real but metadata may differ
    • SUSPICIOUS (0.30 - 0.50) — needs manual review
    • LIKELY_HALLUCINATED (< 0.30) — probably fabricated
    • NOT_FOUND — no results from either API
    • SKIPPED — entry types like @misc, @phdthesis, @techreport that are hard to verify automatically

Installation

pip install bibtexparser requests

Usage

# Check all entries in a .bib file
python verify_bib.py main.bib

# Check only the first N entries
python verify_bib.py main.bib --top 50

# Resume a previously interrupted run (uses cached results)
python verify_bib.py main.bib --resume

# Regenerate the report from cached results without re-querying APIs
python verify_bib.py main.bib --report-only

# Provide your email for CrossRef's polite pool (faster access)
python verify_bib.py main.bib --email you@example.com

Output Files

File Description
verify_results.json Full machine-readable results with match details
verify_report.txt Human-readable summary sorted by suspicion level
verify_cache.json Incremental cache for resuming interrupted runs

Running Tests

python test_verify_bib.py

Unit tests cover the offline logic: text normalization, title similarity, author parsing, author overlap, and scoring functions.

Caveats

  • NOT_FOUND does not mean hallucinated. Very recent papers, niche venues, non-English publications, or items not yet indexed may score low despite being real.
  • VERIFIED does not mean correct metadata. A real paper may have wrong year, volume, or pages in your .bib file.
  • Books are harder to verify than journal articles (CrossRef coverage varies).
  • @misc, @phdthesis, and @techreport entries are skipped — verify those manually.
  • Semantic Scholar has stricter rate limits (1 second delay between requests); you may see 429 errors under heavy use.
  • Always manually confirm any entry flagged as SUSPICIOUS or worse before removing it from your bibliography.

About

BibTeX hallucination detector — verifies references against CrossRef and Semantic Scholar, flags potentially fabricated entries, and generates a corrected .bib file

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages