The problem, in one story
Imagine a clinic puts an AI assistant in front of its vaccine storage manual, so staff can ask questions instead of digging through the binder. Someone asks how long a certain vaccine keeps after it's been opened. The AI answers, fluently and confidently: "45 days." The manual says 28.
Nobody typed 45 anywhere. The AI just produced it, the way AI sometimes does. The industry calls this a hallucination, and it's the single biggest reason companies that would love to use AI on their own documents don't. If you have to re-read the manual to trust every answer, the assistant saved you nothing.
The common fixes both bother me. One is to ask a second AI to judge whether the first AI's answer looks right, which just moves the problem back a step: the judge can hallucinate too, so now you have two guessers instead of one. The other is to compute a "similarity score" between the answer and the document and pick a cutoff, say 0.87, above which you call it true. Who picked 0.87? Someone tuned it until the demo looked good. Both approaches are, at bottom, guessing about guessing.
What FACTGATE does instead
FACTGATE removes the judgement entirely. You write the facts of your document down once, in a small structured file: this product stores at 2 to 8 degrees Celsius, this membership costs $199, sick leave accrues at 3 days per quarter. The tool checks that file for mistakes and ambiguities before it will accept it, and every fact has to quote the exact sentence in the document it came from, so the file and the document can't quietly disagree.
Then, when the AI answers a question, the gate finds the factual claims in the answer and compares them against what you declared, using exact arithmetic. Not "similar," not "close enough." Equal or not equal, the way a calculator would decide it. Every claim gets exactly one of three verdicts:
- VERIFIED. The answer's value provably matches the declared fact. "1 to 2 days" matches a declared "1-2 days." "Three" matches a declared "3." Different phrasing, same fact, and the gate can prove it.
- BLOCK. The answer provably contradicts the document. The AI said $398, the document says $199. This answer does not reach the user as confirmed.
- HELD. The gate cannot prove either. Maybe the answer uses a wording nobody declared, or restates two values where the document itself lists two. Instead of picking one, the gate hands the answer to a human and says: I couldn't settle this one, you look.
That third verdict is the whole design. Think of a security checkpoint with three lights instead of two: cleared, stopped, and "please check this bag by hand." A checkpoint that never flags anything is dangerous, and one that flags everything is useless. The honest machine is the one that knows the difference between "I checked and it's fine" and "I couldn't check."
Engineers call this fail-closed, like a fire door that swings shut when the power dies. When FACTGATE is uncertain, it is not allowed to guess in either direction. There is no confidence score, no threshold, no knob to tune. The only way to get a VERIFIED is a provable match, and the only way to get a BLOCK is a provable contradiction. Everything else is HELD, visibly, where a person can see it.
The numbers
| Result | Number | Where it comes from |
|---|---|---|
| Wrong answers confirmed as correct | 0 of 110 | Four supervised pilots, every verdict checked by hand |
| Leaks in adversarial trials (a wrong value slipping through as verified) | 0 of 366 | A deliberately hostile set of made-up answers, spanning 15 subject areas |
| Answers that reach the gate at all (nothing slips past it unchecked) | 99% | 151 natural-language answers across 10 subject areas, 8 of them written by people who had never seen the tool |
| Answers a human no longer needed to review | 58% average | The four pilot documents (ranging 33% to 68%) |
| First-time users who wrote a working fact file from the guide alone | 3 of 3 | The HR, food-safety, and gym pilot documents; zero errors on their first try |
| Automated tests, plus a 19-check proof harness | 816 | Re-run automatically on every change, results public (what programmers call CI) |
The pilots are the row I care about most, because they're the closest thing to real life. I took four documents in four different worlds: a vaccine cold-storage sheet, an HR leave policy, a restaurant food-safety procedure, and a gym membership agreement. A local AI model answered 110 natural questions about them, phrased the way a person would actually ask ("a colleague asked me about the storage temperature for Product B, what should I tell them?"). The gate ruled on every answer, and then I read every single verdict against the source document by hand.
It confirmed 64 answers as VERIFIED. All 64 were actually correct. It held 46 for review, and none of the held ones was the gate being wrong, they were the gate being honest: mostly answers that repeated two values because the document itself lists two. No machine should quietly pick one of those for you. And zero times, across all four documents, did a wrong answer get stamped as confirmed. That's the failure that matters, because that's the one that erodes trust in the whole system.
The trade is explicit: on an average document, the gate settled 58% of answers by itself and handed the other 42% to a human. That review queue is the price. It is bounded, it is visible, and in 110 hand-checked answers it was never wrong. A gate that guessed instead would have a smaller queue and, eventually, a confirmed lie.
How I tried to break it
A fact-checker that hasn't been attacked is just a promise. Most of the work on FACTGATE wasn't building the gate, it was building the machinery that tries to destroy it, and being honest about what that machinery found.
A second, independent checker
The gate's arithmetic is verified against a separate program, written from scratch with none of the same code, that does every comparison with exact fractions, the way you would on paper. The two must agree on every case, and the test suite fails if they ever disagree. One checker can be wrong; two independent checkers that always agree are much harder to fool.
Breaking my own code on purpose
Here's the part I'd defend the hardest, because it caught me. A test that cannot fail proves nothing, so the proof harness deliberately sabotages the gate twelve different ways, disabling one defence at a time, and requires the test suite to notice every single sabotage. If a broken gate still passes green, the build fails. The very first time I ran this, it caught zero of the sabotages. That wasn't good news, it meant my independent checker was itself broken in two places, silently agreeing with everything. My checker's checker was broken, and the only reason I know is that I tested it. Both bugs are fixed, and the sabotage run is now part of every build.
Fresh eyes, no mercy
After all the proofs were green, I ran a blind adversarial round: reviewers were handed the code and the claim with no history of past fixes, and told to attack it from first principles. They found two real bugs the entire proof suite had missed. One let "100 F" be verified against a declared "100 C" because of a gap in how temperature units were handled, which is exactly the kind of leak this project exists to prevent. The other wrongly blocked "board-certified" against a declared "Board Certified" over a hyphen. Both are fixed, and, more importantly, both are now permanent tests and permanent sabotage checks, so neither can ever quietly come back.
I want to be precise about what that round means, because it's the honest boundary of the whole project: the proofs did not make this code perfect, and fresh eyes still find bugs. What the machinery guarantees is narrower and, I think, more valuable: every bug anyone has ever found is provably unable to return, and every claim I publish is machine-checked against the code on every change. "Correct over everything we've tested, and structurally unable to regress" is a claim I can defend. "Correct over all inputs" is not, and I won't make it.
The measurement that embarrassed me
One more confession, kept visible on purpose. The first time I measured how many answers actually reach the gate at all, I got 99% and briefly believed it. It was a selection effect: I had only measured four easy subject areas. Measured honestly across ten subject areas, most written by people who had never seen the tool (so the tests couldn't be secretly easy), the real number was 85%. I fixed the problems that measurement exposed and re-measured as each fix landed: 85% became 91%, then 94%, and finally 99% again, earned this time. The project's records keep the whole arc, wrong number included, because a corrected mistake you can audit is worth more than a clean history you have to take on faith.
What it isn't
- It is not a lie detector for the open internet. FACTGATE checks answers against facts you declared from your documents. It knows nothing about the world beyond that file. If you didn't declare it, the gate holds it for a human rather than ruling on it.
- The held queue is a real cost. On an average pilot document, 42% of answers still went to a person. On the most conditional-heavy document (an HR policy full of "it depends on tenure"), it was 67%. The queue is never wrong, but it is not free, and documents full of conditions hold more, by design.
- The AI is still in the loop for reading prose. Finding the factual claims inside a conversational answer uses a language model. The guarantee is that the verdict itself never does: what the AI pulls out is double-checked by fixed, rule-based code that gives the same result every single time, and the final compare is pure arithmetic. The "no guessing" claim belongs to the verdict, and I've kept it there deliberately.
- Four documents is field evidence, not certification. One model, one reviewer, four genres, 110 answers. Enough to show the design holds up outside my own test files. Not enough to call it proven in a clinical or regulated setting, and I don't.
How it works, in plain English
The whole loop, end to end:
- Declare. You (or honestly, your AI assistant) write the document's facts into a small file: who, what, which value, and the exact sentence it came from. FACTGATE's built-in checker refuses the file if anything is ambiguous, contradictory, or not actually quoted from the document. In the pilots, three people who had never seen the project wrote working files on their first try using only the public guide.
- Ask. Your AI assistant answers questions about the document the way it always would. FACTGATE doesn't change how the AI writes, it stands behind it.
- Compare. The gate extracts the factual claims from the answer and compares each against the declared facts with exact arithmetic. Units and phrasings that provably mean the same thing ("three" and "3", "1 to 2 days" and "1-2 days") are equated. Anything less than provable is not.
- Rule. VERIFIED goes through as confirmed. BLOCK is stopped with the contradicting fact attached. HELD lands in a review queue for a person, along with the tool's suggestion for the one-word vocabulary edit that would often settle it next time.
That last detail is my favorite part of the pilots. When the gate held "below 60 percent" against a declared "60 percent," it didn't just shrug, it suggested: declare the word "below" as harmless here and this verifies next time. One-line edit, re-run, verified, and a wrong value like "90 percent" still gets blocked afterward. The vocabulary grows with use, and safety doesn't shrink as it grows.
Try it
FACTGATE is open source, meaning the code is free for anyone to use and inspect, under a license called Apache 2.0. As of this week it's also published on PyPI, the standard shelf where Python programmers get their tools, so if you or your developer write Python, it is one command away:
pip install factgate
If you don't code, the GitHub link below holds the same project in readable files, documentation included. Everything in this writeup is reproducible from those public files: the 816 tests, the 19-check proof harness with its sabotage runs, the hostile test set, the coverage measurements, and the full pilot protocol with every hand-reviewed verdict. The measurement history, including the numbers I got wrong before I got them right, is in the docs, on purpose.
Where to go deeper
- Code, proofs, and docs: github.com/NORTHTEKDevs/factgate
- The package: pypi.org/project/factgate
- The supervised pilots, verdict by verdict: docs/PILOT.md
- Release notes: v0.3.0
Break it, please
The fastest way to make this better is to find a wrong value it verifies. Grab the code from GitHub, run the proof harness yourself, and if you can get a leak past the gate, that's a security report I genuinely want.
github.com/NORTHTEKDevs/factgate →Built by Kristian Baer / Northtek. Apache-2.0 licensed. Every number above is regenerated by the public test suite and recorded in the project's public docs.