Generate-and-Verify AI Loop
Generate candidate answers, reject bad reasoning paths, and verify consistency
- Difficulty
- Expert
- Time to result
- ~months to results
- Steps
- 6
- Confidence
- 86%
The Generate-and-Verify Loop treats model output as a set of candidates rather than a trustworthy single answer. The system generates one or more possible responses or reasoning paths, then applies separate checks to detect candidates based on invalid programs, broken constraints, unsupported claims, or inconsistent results. Only candidates that survive verification are eligible for selection. Repeating the same task tests whether the system can return the expected answer consistently rather than occasionally. The method directly addresses the variability and hallucination tendencies of generative models, but its reliability depends on verification signals that are genuinely independent and harder to fool than the generator itself.
Origin
Extracted from Marketing Against The Grain
Core principles
- 01Generation and verification are different functions
- 02A plausible answer may come from a bad reasoning path
- 03Produce multiple candidates when the model is inherently variable
- 04Use independent checks to reject invalid candidates
- 05Measure reliability through repeated consistency tests
How to run it
- 1
Specify verifiable criteria
Define the constraints, evidence, invariants, or expected outputs that a correct answer must satisfy. Make failure conditions explicit.
Pro tip Prefer machine-checkable criteria where available.
Watch out A vague verifier merely reproduces subjective confidence.
- 2
Generate candidates
Produce multiple answers, programs, or reasoning paths rather than relying on the first result. Preserve enough information to inspect how each was formed.
Pro tip Vary generation conditions to expose different failure modes.
Watch out More candidates increase cost and do not guarantee that a correct one exists.
- 3
Run independent checks
Test candidates against rules, external evidence, executable tests, or a separately designed verifier. Flag unsupported or inconsistent outputs.
Pro tip Use deterministic tools for arithmetic, code, schemas, and factual retrieval whenever possible.
Watch out A verifier using the same unsupported assumptions may approve the same mistake.
- 4
Reject bad paths
Discard candidates whose reasoning process or constraints are invalid even when the final wording appears plausible.
Pro tip Record failure categories to improve future generation.
Watch out Correct-looking answers reached through faulty logic may fail on nearby cases.
- 5
Select the verified result
Rank surviving candidates by correctness, completeness, and relevance. Return an answer only when it meets the stated threshold.
Pro tip Allow abstention when no candidate passes.
Watch out Forcing a selection defeats the purpose of verification.
- 6
Test repeatability
Run the same bounded task repeatedly and measure how often the system reaches the same verified answer. Investigate variance rather than hiding it.
Pro tip Track consistency separately from average quality.
Watch out Repeated agreement can still reflect a systematic error.
In the wild
A model produces several implementations of a function. Each candidate is compiled, run against unit and property tests, and checked for forbidden dependencies. Candidates that fail are discarded, and only a passing implementation is reviewed for maintainability.
→ Executable verification prevents a persuasive but broken first answer from reaching production.
A system is asked the same question with one correct answer many times. Each response is checked against the known criterion, and the consistency rate is recorded rather than judging the system from one successful run.
→ The evaluation exposes instability that a one-shot demonstration would conceal.
Common mistakes
Using the generator as its only judge
A model may repeat or rationalize its own error when generation and verification share the same blind spots.
Checking only the final wording
A plausible conclusion can conceal an invalid program or reasoning path that will fail on related cases.
Forcing an answer after all checks fail
Selecting the least-bad rejected candidate converts a verification system back into unguarded generation.
Is it for you?
Best for
AI systems solving tasks with checkable constraints, evidence, or one expected answer.
Not ideal for
Purely subjective creative work where no meaningful verification criteria can distinguish candidates.
From the transcript
“So it's gonna go through a bunch of a bunch of different verifications to make sure that AI produces the answer the person is looking…”
“Hey, I'll know GPT is really good when I ask it to give me something which has one answer 10,000 times and it gives me…”
“And these two papers talk about how AI can like recognize when it's using a bad program and actually verify that out so it's using…”
From the episode
Generate 10x Views On A LinkedIn Post With These GPT-4o Prompts