Kenneth W. Bingham

case study · Python · a small language · local models · measured, bars first

Do not trust the answer. Gate it, with rules a person can read.

Relation Gate is a small language for checking what an AI produces. Every line is a relation, logic is arithmetic over 0 and 1, and the edges are values: a division by zero is a refusal, an ambiguous answer is a fork that a person decides, and no loop runs past its cap. Put in place of the "model checks the model" step in an agent pipeline, on a 3B local model, it cut wrong answers from 68 to 4 percent at a quarter of the tokens. It is the sibling of TestThisPuppy: that one says do not read the code, test it; this one says do not trust the answer, gate it.

The problem

The common agent pipeline has a model answer a task, a second call to the same model check the answer, and a retry on a no. The checker sounds the same whether it is right or wrong, it costs as much as the answer, and when it is wrong the same way as the worker, nothing catches either. On a small local model, the kind a team runs for privacy or cost, that step let through 68 percent wrong answers in my benchmark while spending most of the tokens.

Why it is hard

What it does

The proof

Same model, same tasks, same prompts, same retry wording. Design B is the common pipeline, a model checking a model. Design R is identical except the checker is a page of gate rules, and after three refusals it gives no answer instead of handing over the last try. Forty held-out tasks (classify, extract, calculate, format), three seeds. The pass bars were written into the plan before the run.

Technologies and skills

How it was built: one day, from my prompts

Built on 21 November 2026 in one directed session. The order below is the order I gave it. Everything on this page was run before it was written down.

  1. "We want a programming language for AI that can be pure mathematics but contains logic. A truth table, a circuit, a deterministic graph, a decision tree, and regex can be used to quickly search."
  2. "Plus you have all the mathematical operators and algebra."
  3. "It should be very stable."
  4. "I would like to see something written that actually does some kind of computation, something normally complex, where it goes through like butter."
  5. "Then use TestThisPuppy to check, because it's not human readable."
  6. "Since we are dealing with AI and AI uses tokens, the token is the unit. Using AI's own unit as a basis for the program."
  7. "Your verdict." Then: "OK, let's do it." (The benchmark, with the bars written first.)
  8. "Solve the travelling salesman, dining philosophers, towers of Hanoi, Rubik's cube, and crack the Enigma code with the algorithm used with this new way of coding." Then: "Report with results and big-O of each, whether it matches what is already established, and whether that should have been possible on a simple laptop."
  9. "The question really is not speed, it is AI reliability with using a native AI language as opposed to a traditional programming language. And less tokens." (A second experiment, running as this page goes up.)
  10. "Is this a product?" Then: "OK, let's make something I can demonstrate." Then: "Put it in the same thing as TestThisPuppy on butterflyfx.us."

What it does not claim

68 → 4%wrong answers, 3B model, held-out
4.5×fewer tokens per correct answer (bar: 2)
126/137planted bugs caught by the tests
1bar not met, reported as it is