Skip to main content

Hiro Fukushima

Content Engine

Code That Checks What AI Writes

Applied AICase Study
AIVerificationContent EngineeringSystems Design

01. What problem it solves

A language model does not check whether its source supports a claim. It predicts the most probable answer from everything it has read, and a probable answer can still be wrong, even when the source is part of what it reads.

The source, an encyclopedia page on the history of artificial intelligence, says MYCIN, developed in 1972, diagnosed infectious blood diseases. The draft written from it says the MYCIN expert system was developed at Stanford in 1976. 1976 does not match 1972, and the draft is rejected.

A common fix is a second model that checks the text. But models learn from human ratings, and people rate agreement higher, so a second model tends to confirm what it is given.

In medicine, law, finance and compliance, people make decisions based on what a text says, so content written by AI has to be checked against its sources before it is published.

I built the Content Engine for this. The facts with an exact answer, such as numbers, dates, quotes and citations, are checked by code, which gives the same answer every time. A claim rated wrong or invented stops publication in a line of code that no model can skip. The same engine can check texts from any of these fields.

Where publication stops. Lines 552 and 553 of engine/pipeline/verify.py, if blocked: raise PublicationBlocked(blocked, run). A claim rated wrong or invented stops publication. No model call runs in this line.

02. The work

For each claim it finds in a text, the Content Engine returns one of five verdicts, confirmed, partially correct, wrong, invented or unverifiable. The text can be a draft or a page that is already live.

A claim check ends in a report that lists each claim with its verdict, plus a finding for each claim rated partially correct, wrong or invented, which says what is wrong with it.

A report on claims from an encyclopedia about AI. A quote from Anthropic's tool-use documentation is confirmed, the quote is in the source word for word. The perceptron created in 1957 is partially correct, the source gives 1958. MYCIN developed at Stanford in 1976 is wrong, the source says 1972. A claim that several image and video models are diffusion-based is unverifiable, no source states how these models work, so a person decides with the whole page. The fifth verdict, invented, is given to a claim the sources do not contain at all.

The engine also picks out the claims that a person should decide, and hands them over together with the whole page they come from.

For content that has to be proven sentence by sentence, the engine runs a full read. Every sentence of the body text, the title and the search title and description gets its own decision, and a page counts as done only when no sentence is left without one.

One page of a housing law site, every sentence decided. The title, search title and search description have no claim to prove, who it affects was changed because it was incomplete, and the legal status is supported. Each of the 19 body sentences has its decision, supported, no claim to prove, or changed because it was incomplete, worded wrongly or wrong. Sentences left without a decision, 0, and the page is done.

The engine runs on a computer or on a server, and it checks a single article or a whole site, several pages at a time.

For sensitive documents, such as medical or legal records, the engine can work with a local AI model, so nothing leaves an organization's own computers, and a private document can also be checked against a person's own files with code alone.

And it can export the facts it has confirmed, each with the exact passage behind it, for an AI assistant to answer from.

An export of confirmed facts. Three facts, each with its passage and marked confirmed, go to an AI assistant that answers from the confirmed facts, each with its passage.

03. Key decisions

First version, the model decides to stop, crossed out and rejected. Rebuilt, code runs the stop. German quotation marks are normalized in code.
01

The rebuild around code

In the first version of the engine, the only thing that kept a wrong claim from going out was the model deciding to stop. A verifier built on a model also judged two kinds of German quotation marks backwards in three of five files, and a short piece of code fixed it for good. So I rebuilt the engine so that code runs the engine and the stop itself, and the model answers the questions the code hands to it.

The engine code, with the fields outside it, housing law, encyclopedia about AI and compliance. A field name written into the engine, housing-law, is crossed out and rejected.
02

Everything specific to a field lives outside the engine

One field's rules had ended up inside the engine itself, and a later branch that wrote that field back into the engine was not merged. Everything specific to a field was moved out of the engine's code, and a test fails any change that writes a field's name into it, so a new field needs no change to the engine.

A change, measured for each field. Wrong claims caught must stay the same or higher, and correct claims wrongly flagged must stay the same or lower. Then the change ships. Tuned on live runs is crossed out.
03

Every change has to keep the measured accuracy

The checks were first tuned by reacting to live runs, and a fix in one round broke its own test in the next. I stopped that and made accuracy a measured number for each field, the share of wrong claims the engine catches and the share of correct claims it wrongly flags, and a change ships only when neither number gets worse.

Before a run starts, the engine asks whether the model answers. Yes, the run starts. A run that starts without an answer is crossed out and rejected. The rule, no answer, the engine refuses to start the run.
04

A run that cannot reach its model does not start

A model that stopped answering could fail without anyone noticing, and each project had to catch that with its own check before a run. The engine now refuses to start a run when the model it needs cannot answer, so no project depends on remembering that check.

04. How it works

Every verdict can be traced

Every claim check leaves a record. For each claim it keeps the verdict and how it was reached, and it keeps a copy of each source the engine fetched, as it read at the moment of the check. The record is written before publication is stopped, so even a blocked text leaves its full evidence behind.

The record of one claim. Claim, the MYCIN expert system was developed at Stanford in 1976. Verdict, wrong. How, read against the source, which says 1972. Source copy, the encyclopedia page on the history of artificial intelligence, with its sha256 fingerprint, kept as fetched. In this order, first the record is written, then publication stops.

The same principle in every engine since

Every engine I have built since works on the same principle, each for its own kind of work.

The Design Engine connects an AI to a product's design system. The AI can still pick the wrong token or the wrong component, so the engine checks the design and the code against the system's rules, and a person approves every change.

The Conversation Engine decides what an AI assistant may say and do. It decides whether the assistant may answer, what it has to find out first and when it has to ask or stop, and the model is one governed part that does not set those rules.

The Verification Engine checks robotic simulation studies before they move on. Fixed checks catch the failures that are already known, a model weighs the rest, and an uncertain case goes to an engineer.

What the AI does, what checks it and who has the last word in four engines. Content Engine, the AI writes the text, code checks exact facts and a model reads the rest against the source, and code stops publication. Design Engine, the AI designs and builds, the engine checks against the design system's rules, and a person approves every change. Conversation Engine, the AI answers people, rules decide when it may answer, ask or stop, and the rules have the last word, never the model. Verification Engine, the AI weighs what fixed checks leave open, fixed checks catch known failures, and an engineer decides uncertain cases.

05. Evidence

273 sentences corrected on a housing law site

On a site about housing law, the full read checked every one of the 1,403 sentences on its 54 pages against the official text and corrected 273 of them.

54 pages of a housing law site, one line per sentence. The 273 corrected sentences stand out from the 1,130 other sentences, spread across the pages.

150 of 150 claims correct in an independent check

The engine confirmed 1,243 claims across the same 54 pages. An independent check then read 150 claims from the same pages, drawn at random, against a fresh copy of the official text without the engine, and all 150 were correct.

Five draws of 30 claims, read without the engine. Each draw shows 30 of 30 correct.

72 unsupported sentences removed from an encyclopedia about AI

In an encyclopedia about AI, the engine read all 1,269 sentences of seven pages against their sources. It found wrong sentences on every one of the seven pages. It corrected 418 sentences and removed the 72 that no source supported.

Seven pages of an encyclopedia about AI, one cell per sentence. On every page some sentences were corrected, 418 in all, and 72 were removed because no source supported them, among 779 other sentences.

1,389 confirmed facts for an AI assistant

The engine confirmed 1,389 facts for an AI assistant that answers compliance questions.

06. What I learned

What belongs to one project stays outside the tool

The Content Engine grew with each of my first projects, because each one wrote its own rules into it, from a house style to an exception for one kind of text. When client work came, I had to start again from scratch, since a client needed an engine with nothing of my other projects in it. So I made the engine a tool of its own that stays the same for every project, and each project now plugs into it through a connector that holds its rules.

A client receives a fresh copy of the engine. Instructions inside the copy let an AI agent build the connectors for that client's content, so the client owns a version of the engine that grows with their work. For anyone building a tool for several clients, giving each of them a connector that plugs into the tool means every client starts from the same clean tool.

At the start, the Content Engine holds a house style, an exception for one kind of text and the rules of three projects, and a client's engine has to be started again from scratch, which is rejected. Now, the Content Engine is the same for every project, and connectors for housing law, an encyclopedia about AI and compliance plug into it. A client's copy is a fresh engine with instructions inside, an AI agent reads the instructions, and the client's connectors are built for its content.