TECHDEV 開發 factfence,核查 AI 助理引用的數字是否獲來源支持
AI assistants cite fake stats with total confidence. I built a 10-second checker.
TECHDEV 開發 factfence,一款零依賴、適用 Python 3.10+ 的 Python CLI,可檢查文稿中的量化主張是否出現在引用頁面。它會跳過程式碼區塊,並為每項主張標示 SUPPORTED、UNVERIFIED、BROKEN、UNCITED 或 CITED;亦支援 CI 結束碼(0、1、2)及 --json 機器可讀輸出。
Last week I read a Hacker News thread about someone publishing fake statistics on a throwaway site just to watch LLMs cite them as fact. 295 points, 168 comments — and it hit a nerve because I've lived the milder version of this: an AI assistant hands me a draft with a confident "73% of developers…" plus a link, and I have no fast way to check whether the link actually says 73%.
The existing citation checkers I found mostly answer a different question — "does this reference exist?" — aimed at academic bibliographies, usually as paid web services. I wanted something narrower and local: does the cited page contain the actual numbers? So I built it.
Meet factfence
factfence is a zero-dependency Python CLI. Point it at any markdown or text file — a blog draft, a doc, an AI-generated report — and it:
-
Extracts every quantitative claim (percentages, money, large counts, multipliers, ratios), skipping code blocks so
retries = 99never becomes a "claim". - Fetches each unique citation once (polite user-agent, 8s timeout, 1.5MB cap) and reduces the page to normalized plain text.
- Reports one of five verdicts per claim:
-
SUPPORTED— the cited page contains the numbers -
UNVERIFIED— the page loads but doesn't contain them (the classic AI hallucination shape) -
BROKEN— every cited link failed -
UNCITED— a hard number with no citation at all -
CITED— a "studies show…" assertion with a working link, nothing numeric to cross-check
Real output on a sample AI-written paragraph:
[✓ SUPPORTED]
According to the 2026 State of DevTools Survey, 73% of developers say AI-
generated code needs human review before merging
↳ http://127.0.0.1:18347/source-a.html
HTTP 200, matched 73%
[? UNVERIFIED]
Some teams claim 99.9% of AI suggestions are production-ready, citing an
internal study (http://127.0.0.1:18347/source-b.html).
↳ http://127.0.0.1:18347/source-b.html
HTTP 200
cited page(s) fetched but contain none of the claim's numbers
[! UNCITED]
It is often repeated that 60% of all code will be AI-written by 2027,
though nobody cites a source.
quantitative claim with no citation — verify by hand
6 claim(s) checked: 2 supported, 1 cited, 1 unverified, 1 broken, 1 uncited. 3 need review.
Exit codes are CI-friendly (0 clean, 1 needs review, 2 error), and --json gives you machine-readable output for pipelines.
Try it
git clone https://github.com/techdevfun/factfence.git
cd factfence
python3 -m factfence your-draft.md
No pip install needed — it's stdlib only, Python 3.10+.
What it deliberately doesn't do
It checks citation support, not truth. A SUPPORTED claim can still be wrong if the source is wrong — the tool just catches the far more common failure of confident numbers with dead, irrelevant, or missing citations. Number matching is textual ("73%" vs "nearly three quarters" won't match), pages behind logins can't be fetched, and it's English-focused. All of this is documented as limitations in the README rather than hidden.
If you publish anything an LLM helped write, run your draft through it once. The three sentences it flags are exactly the three worth re-reading.
Repo: https://github.com/techdevfun/factfence — MIT licensed, issues and PRs welcome.
來源:DEV Community · dev.to