A Citation Hallucination Detector & Auto-Fixer
Validate and automatically correct your BibTeX bibliography against multiple academic databases.
Academic papers often contain citation errors ā wrong titles, incorrect authors, mismatched years, or even completely fabricated references (hallucinations from AI tools). RefCheck automatically:
- ā Validates each citation against 6 academic databases
- š§ Auto-fixes metadata mismatches (title, authors, year, DOI)
- šļø Removes unverifiable/hallucinated entries
- š Reports a clear verification summary
RefCheck cross-references your citations against:
| Source | Lookup Methods |
|---|---|
| arXiv | arXiv ID, Title search |
| CrossRef | DOI, Title search |
| DBLP | Title search |
| Semantic Scholar | DOI, Title search |
| OpenAlex | DOI, Title search |
| Google Scholar | Title search (disabled by default) |
- Pass 1 ā Validate & Fix: Checks each entry, auto-corrects metadata, removes invalid citations
- Pass 2 ā Verify: Re-validates the cleaned file to confirm all entries are correct
# Clone the repository git clone https://github.com/voidful/RefCheck.git cd RefCheck # Install dependencies pip install -r requirements.txt
- Python 3.9+
- Dependencies:
bibtexparser,requests,beautifulsoup4,rich,Unidecode,lxml
# Validate and auto-fix a bib file
python main.py --bib references.bib| Option | Short | Description |
|---|---|---|
--bib |
-b |
Path to your .bib file (required) |
--output |
-o |
Output report path (optional) |
# Process your bibliography python main.py --bib paper/references.bib # With custom output path python main.py --bib refs.bib --output validation_report.md
āāāāāāāāāāāāāāāāāāā
ā Load .bib file ā
āāāāāāāāāā¬āāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā For each entry: ā
ā 1. Query academic databases ā
ā 2. Compare metadata (title, author, yr)ā
ā 3. Calculate confidence score ā
āāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Decision: ā
ā ⢠confidence > 85% ā Auto-fix metadata ā
ā ⢠Match found ā Keep as-is ā
ā ⢠No match ā Remove entry ā
āāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Save updated .bib file ā
ā Run verification pass ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
RefCheck displays real-time progress and a final summary:
š BibGuard - Auto-Fix & Verify
Target: references.bib
Found 42 entries. Running validation and auto-fix...
Validating & Fixing āāāāāāāāāāāāāāāāā 100% 42/42 ā 38 ā 2 ā 2
āļø Updates:
- Fixed 2 entries (metadata updated)
- Removed 2 invalid/hallucinated entries
ā File saved.
š Double checking (Re-validation)...
Verifying āāāāāāāāāāāāāāāāāāāāāāāāāāā 100% 40/40 ā 40
==================================================
š Final Status
==================================================
Total: 40
ā Verified: 40
ā Issues: 0
ā Not found: 0
| Symbol | Meaning |
|---|---|
| ā Verified | Entry matches a known publication |
| Metadata was auto-corrected | |
| ā Removed | Entry could not be verified (likely hallucination) |
RefCheck/
āāā main.py # Entry point & workflow orchestration
āāā requirements.txt # Python dependencies
āāā README.md
āāā src/
āāā fetcher.py # API clients for academic databases
āāā comparator.py # Metadata comparison & scoring
āāā parser.py # BibTeX parsing & saving
āāā utils.py # Progress display & text utilities
MIT License ā see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with:
- bibtexparser for BibTeX handling
- Rich for beautiful terminal output
- APIs from arXiv, CrossRef, DBLP, Semantic Scholar, and OpenAlex