GavLabs
← all posts

Can AI fact-check its own work? An experiment

Language models make things up. I wanted to see whether you can stop one by refusing to accept any fact it can't prove against an exact quote — and letting plain, dumb code, not the model, decide what's true enough to publish. So I built a pipeline to find out, and pointed it at something with real, checkable facts.

The thing that makes LLMs unreliable for data work is well known: they paraphrase, they round numbers up, they fill gaps with plausible-sounding guesses. The usual answers are "use a better model" or "add a disclaimer." I wanted to try a different one — assume the model lies, and build a cage that only lets verified facts out — and then measure how often the cage actually fires.

I needed a test bed with lots of specific, verifiable facts, so I built three small Florida directories as the experiment's subject matter:

DirectoryListingsPublished facts
Roofing contractors (Okaloosa & Walton)142 businesses966
CDL truck-driving schools (statewide)103 schools1,215
Flight schools (statewide)106 schools776

The rule I set myself fits on a sticky note: every fact has to have a receipt. A public-registry record, or a quote from the business's own website, stamped with the date I saw it. No receipt, no publish — not "flagged," not "shown with a disclaimer," not published.

Start from the public record

Every listing begins with an official source, never a search result — state license registers, the federal CDL Training Provider Registry, the FAA's Part 141 roster. A business only goes live when it has a verified registry record and evidence it actually offers the service. Everything else stays in the data, with the reason it didn't qualify, but off the public page.

The interesting part: make the model cite its source

Registries say a business exists; they don't say what it costs or how long the course runs. That comes from the business's own website — and that's exactly where an LLM wants to start inventing. So the extraction step has a hard requirement: every fact an agent pulls out has to arrive with the exact sentence from the page that supports it. Then a deterministic gate — ordinary code, no AI judgement anywhere in it — decides whether to believe the model:

  1. Exact quote. The supporting sentence has to appear word-for-word on the saved page. A paraphrase fails, every time.
  2. The value must follow from the quote. A fixed rule per field derives the value from the sentence. A tuition figure has to be dollars, in a sane range, with no "starting at." "Decades of experience" does not quietly become "20 years."
  3. Live re-check. The quote is looked for again on the live page at the next build; if it's gone, the fact is withdrawn. A changed page can't keep a stale fact alive.

When two independent sources agree, the fact is marked corroborated. When they disagree, I publish neither and say so.

The rejection rate is the result

Here's the part that actually answered the question: the gate rejected a large share of everything the models proposed. Misquotes were the most common failure, then values the quote didn't support. At first that felt like the system was broken. Then it clicked — that rejection rate is the fact-checking working. The model does the reading, which it's genuinely good at; the code decides what's true, which the model is genuinely bad at. Separating those two jobs is the whole trick.

Keeping it honest over time

None of this is a one-off scrape. A job runs nightly: refresh the registries, re-crawl the sites, re-extract, rebuild, and then check the result before anything goes live. The release is held if a step errored, the tests failed, or too many facts vanished at once (5% is the ceiling). One build tried to publish 16 flight schools known only from a stale FAA record; the gate caught it, I added a test so it can't recur, and shipped the fixed version. A full nightly refresh of all three directories costs about $1.70 in model fees. When the local GPU box is handling it instead of the cloud, here's how I tuned that server.

What I took away

  • Separate reading from deciding. Let the model read messy pages; let plain code decide what's true. Don't let the thing that hallucinates also be the thing that approves.
  • A high rejection rate is a feature. If your verifier never rejects anything, it isn't verifying — it's rubber-stamping.
  • Dates are part of the fact. A quote proves what a page said the day it was saved, not that it's still true. Showing the date is the honest move.

It started as a "can this even work?" experiment. It's now quietly running every night — and the pattern (make the model cite, let code judge, measure the rejects) is the thing I reach for anywhere I'd otherwise be tempted to just trust an LLM's output.