Apply to my task
arXiv:2607.06636 ★ 92 Jul 7, 2026

Specification Grounding: Explicit Criteria Instead of "Check for Errors"

Key result

Here's the paradox: you ask the model to write tests that cover 'invalid inputs and edge cases' — and it still misses bugs, while in one test a third of its checks rejected correct code. Without explicit rules, the model doesn't know exactly what the author missed — so it guesses. The Specification Grounding method lets you test code against its requirements so far fewer real bugs slip through. Applying it to other material is our extension. The trick: instead of 'find problems,' say 'here's a list of N rules — check each one in turn.' The model stops guessing and works through a checklist instead — on the core tasks, buggy functions caught went from 18 of 30 to 30 of 30, and on three behavioural tasks false alarms fell from 33% to zero.

01

TL;DR

The paper studies tests that an LLM writes for LLM-generated Python functions. The outcome hinges on one thing: does the test-writing model have an explicit list of requirements, or is it hunting for problems "by eye"? Giving it the requirements as a list of rules, one test per rule, made a big difference: on the core tasks, the final code was correct 100% of the time versus 60% with an "include invalid inputs and edge cases" prompt (+38 to +40 points across settings). We think the same idea carries over to reviewing documents, plans and texts, but the paper only tested code.

The core finding — a model told to "check for edge cases" without explicit rules catches only part of the problems. Not because it's lazy, but because it doesn't know what exactly the author forgot. It guesses — on the core tasks, its tests caught 18 of 30 buggy functions, versus 30 of 30 with the rules. Worst of all, the misses happen precisely where the author themselves forgot something: non-obvious cases that nobody spelled out explicitly.

The fix is simple: instead of "find the problems," say "here's a list of N specific requirements, check each one in turn." The content of the specification is what does all the work. Even a plain paragraph of requirements beats an elaborate "think about edge cases" instruction (27 of 30 bugs caught). A numbered checklist with one test per rule adds a small margin on top (30 of 30).

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: Build a specification -> an explicit list of requirements (N rules)
        Can be a separate request: "Give me a list of criteria for [task]"

STEP 2: Feed the model the spec + the material to review
        -> For each rule: find a violation or confirm compliance
        -> Output: specific violations with the rule they broke

STEP 3: Fix the material based on the violations found
        -> Targeted edits only, don't rewrite everything from scratch

Steps 1 and 2 can be merged into one request if the criteria are already known. If not, get the criteria list first, then run the check. This review procedure is our adaptation: in the paper, the rules came from the real spec and were used to write tests for code.

03

Example in Action

Task: You wrote a sales proposal for a major client worth $50,000. You want to review it before sending — you don't want to hear "looks good overall," you want to know exactly what's wrong.

Prompt:

You are an experienced sales manager who reviews sales proposals before they go out to a client.

Here's a list of requirements for a strong proposal:
1. The client's pain point is clearly stated — not our product, but their problem
2. A concrete, measurable outcome (numbers, timelines, units)
3. Explains WHY us specifically, not competitors
4. Transparent pricing structure — the client understands what they're paying for
5. A specific next step with a deadline
6. No corporate jargon ("leverage," "synergy," "utilize," "in scope of")
7. Length — no more than one page

Check my proposal against each of these 7 rules, one at a time. For each rule: status (✅ met / ⚠️ partial / ❌ violated) and a specific explanation of what exactly is wrong.

Here's the proposal:
[proposal text]

Result:
The model walks through each of the 7 rules separately. For each one — a status and specifics: not "the outcome section feels weak," but "rule 2 is missing numbers — it says 'we'll improve efficiency' but doesn't specify by what percentage or over what timeframe." At the end — a list of exactly the spots that need rewriting, each tied to a rule.

04

Why This Works

An LLM without explicit criteria is like an editor told to "just check the text." It'll check whatever it itself considers important. If the author forgot to include a price, the editor might skip that, because in their mental model a price is "usually there." The model doesn't know what the author actually left out — it's not a mind reader.

When you give it an explicit list of rules, something different happens: each rule becomes its own separate check request. The model isn't choosing what to check — it's checking everything. A non-obvious case ("what if the client submits an empty string?") becomes explicit ("rule 4: handling empty input"). The model can't skip it.

Prompt control levers: - Number of rules → there's no magic number. In the paper, what mattered was covering the right rules (the core tasks had 4–5 each), not the raw count. Cover every requirement that can actually be broken - Rule specificity → the more concrete the wording ("numbers and timelines" instead of "specifics"), the more precise the check - Output format → add "output only the violations" for a quick result, or "output everything with explanations" for a full audit - Source of rules → rules can come from a standard, a methodology, a client checklist — and they're already explicit criteria

05

Prompt Template

Check {what we're reviewing} against the following list of requirements.

Requirements:
1. {requirement_1}
2. {requirement_2}
3. {requirement_3}
[... all requirements]

For each requirement, in turn:
- Status: ✅ met / ⚠️ partial / ❌ violated
- Specific explanation: what exactly is wrong (if not met)
- A quote from the material demonstrating the issue (if applicable)

At the end — a short list of edits: what exactly to rewrite and how.

Here's the material to review:
{text / plan / document}

Placeholders: - {what we're reviewing} — "sales proposal," "product spec," "article," "business plan" - {requirement_N} — specific criteria for your task (you can ask the LLM to generate the list first) - {text / plan / document} — the actual material to review


🚀 Quick Start — paste into the chat:

Here's the Specification Grounding template — checking material against an explicit list of criteria.
Adapt it to my task: [your task].
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask what material you're reviewing and whether you have criteria — because without a list of requirements, the method won't run. If you don't have criteria, it will first offer to generate some for your task, then apply the review template.

06

Limitations

⚠️ Algorithmic logic: The method helps wherever there's a specification — clear requirements for behavior. For tasks where the main difficulty is the algorithm itself ("figure out how to optimize...") rather than rule compliance, the paper saw no gain: on its logic tasks it neither helped nor hurt.

⚠️ Spec quality: If the rules are incomplete or vague, you lose much of the benefit: in the paper, detection depended on covering the right rules. "The text should be good" is not a rule. "Each paragraph starts with a thesis explained in the following sentences" is a rule.

⚠️ False alarms without a spec: Without explicit rules, LLMs not only miss real problems but also flag nonexistent ones more often. In the study, on three behavioural tasks, tests written with the edge-case prompt falsely rejected correct code on 33% of checks; rule-based tests had 0%. Rules give the model an anchor: "this violates rule N" instead of a subjective judgment call.

⚠️ Subjective criteria: If the rules describe taste or style ("the text should feel alive"), expect the model to be less accurate than with objective criteria (our caution; the paper only tested checkable code behaviour).

07

How It Was Studied

A team from TD Bank ran an elegant experiment: one variable, everything else fixed. They took 18 tasks involving writing small Python functions. Each function was generated by an LLM — and it almost always handled ordinary cases correctly but forgot the edge cases. They then had a fixed tester model (Claude Sonnet 4.6) write tests for the exact same code in two ways: FREE+ ("include invalid inputs and edge cases") and SPEC (same tester, same number of tests — but with explicit rules, one test per rule). Failing tests were fed back for repair. Correctness was determined by an independent "gold" test suite no model ever saw.

What was surprising: doubling the number of tests for the plain baseline (no edge-case prompt) produced almost nothing (+4 pp). On a separate set of 29 buggy functions, combining 8 independent edge-case runs caught 15, while a single pass through the rules caught all 29. The researchers expected quantity to help — it didn't. Only the content of the specification helped.

They also checked whether it was about format rather than content. They gave the model the spec as a single connected paragraph (not a list) — it still caught 27 of 30 buggy functions. Asked to plan tests from the task description alone, with no spec — 2 of 30. That answers the "why": the model doesn't infer what the author left out. It needs to be told explicitly.

The main study used Claude models only (Haiku 4.5, Sonnet 4.6, Opus 4.8 as code writers; +38 points on each). A smaller cross-vendor check on 12 tasks also showed gains with GPT-5.3-codex (+28) and Gemini 3.5 Flash (+19). An appendix test on tasks whose specs come from public standards (RFC, CSS, ISO) gave 100% vs 32% — so the researchers couldn't simply "stack the deck" by inventing convenient rules.

08

Original from the Paper

SPEC arm (tester sees the ticket + the spec as K rules; prompt from Appendix B):
"Produce exactly K test cases, one focused case per rule, in order.
A rule about invalid input should give a case that expects an error."

FREE+ arm (tester sees only the ticket; prompt from Appendix B):
"Produce exactly K test cases that check the function thoroughly.
Be sure to include cases for invalid inputs, error conditions,
and boundary/edge values, not just typical inputs."

Expected values come from the specification, never from any code.

Key ablation results (§4.2, buggy functions caught):
- Plan only (task decomposition, no spec): 2/30 bugs caught
- Spec as plain paragraph: 27/30 bugs caught  
- Spec as enumerated checklist (one test per rule): 30/30 bugs caught

Context: These are the paper's tester prompts for the two main arms, SPEC and FREE+. The key difference is that SPEC gets the specification as a list of rules. The ablation shows that most of the gain comes from the content of the spec, not the format: enumerating the rules adds only a small margin over a paragraph (30 vs 27 of 30).

09

Adaptations and Extrapolations

1. Adaptation: generating the spec before reviewing

If you don't have rules — ask the LLM to come up with them first, then apply the method. Be careful: in an appendix test, rules drafted by a model instead of taken from a real spec brought false alarms back (up to 33%), so check the list yourself.

💡 Two-step SPEC:

Step 1:

I want to review {what we're reviewing} before finalizing it.
Draft a list of 7-10 specific, checkable quality criteria for {type of material}.
Each criterion should be objective: answerable with YES or NO.

Step 2: use the resulting list in the main review template.


2. Technique: "SPEC for the other side"

🔧 Use the client's/audience's requirements as the spec → review from their point of view

Instead of your own criteria — the other party's explicit objections or requirements:

Here's a list of typical investor objections at a pitch session:
1. Market is too small — less than $100 million
2. No defense against a big player copying it (Google, Amazon)
3. Unit economics don't hold up at scale
4. Team has no experience in this industry
5. Dependent on a single customer-acquisition channel

Check my pitch against each objection. For each one: is it addressed in the pitch, and how convincingly?

3. Extrapolation: SPEC + iterative improvement

Standard SPEC gives you a review and a list of edits. You can add a repair loop:

[SPEC review prompt]

After reviewing: fix every item marked ❌ and ⚠️.
Output the corrected version and a list of changes.
Then go through the requirements list again — confirm every ❌ became a ✅.

This mirrors the repair loop from the study — just in a single conversation. The LLM first finds violations, then fixes them, then double-checks itself.

10

Resources

Paper: "Specification Grounding Drives Test Effectiveness for LLM Code"
Authors: Amin Haeri, Mahdi Ghelichi — Model Development Innovation, TD Bank, Toronto, Canada
Contact: [email protected], [email protected]

Related work cited in the paper: - AlphaCodium (Ridnik et al., 2024) — iterative code generation with tests - Self-Refine (Madaan et al., 2023) — LLM self-correction - Reflexion (Shinn et al., 2023) — feedback-based iteration - EvalPlus (Liu et al., 2023) — extended test suites for code evaluation - TiCoder (Lahiri et al., 2022) — formalizing intent through human-in-the-loop tests

Research digest

Key result

Here's the paradox: you ask the model to write tests that cover 'invalid inputs and edge cases' — and it still misses bugs, while in one test a third of its checks rejected correct code. Without explicit rules, the model doesn't know exactly what the author missed — so it guesses. The Specification Grounding method lets you test code against its requirements so far fewer real bugs slip through. Applying it to other material is our extension. The trick: instead of 'find problems,' say 'here's a list of N rules — check each one in turn.' The model stops guessing and works through a checklist instead — on the core tasks, buggy functions caught went from 18 of 30 to 30 of 30, and on three behavioural tasks false alarms fell from 33% to zero.

Principle

A standard 'check for errors' request asks the model to decide WHAT to check. It picks whatever it thinks is important. If the author forgot to specify an edge case, the model doesn't see that gap — its picture of 'what's normally there' doesn't match what was specifically forgotten here. Specification Grounding turns one vague review request into N separate ones — one per rule. The model doesn't choose — it works through a list. A non-obvious case ('what if the input is an empty string?') becomes explicit ('rule 4: handling empty input'). It's impossible to skip. A structured list works slightly better than a paragraph with the same requirements (30 of 30 vs 27 of 30 bugs caught) — each item stands on its own and doesn't get lost among its neighbors.

Why it works

A model without criteria is like an editor told 'take a look at this text.' It looks at whatever it considers important. The problem is that its picture of 'what's usually there' doesn't match what was specifically left out this time. With an explicit list, every violation is tied to a specific rule — not to a subjective judgment. In the paper, this reduced two problems at once: missed issues (there's a rule, so there's a check) and false alarms (no rule, no signal). Without an anchor, the model flags 'problems' that don't exist. With a rule, there's either a violation or there isn't.

When to apply

Tested on writing tests for small Python functions. Our extension: use it anywhere there are evaluation criteria → checking code against standards, auditing contracts and documents, evaluating business proposals, reviewing articles against an editorial policy — especially when you need more than 'looks good overall' and want to know exactly what's wrong. It doesn't fit tasks where the main challenge is coming up with an algorithm ('how to optimize search'), rather than checking compliance with already-known rules. Specification won't help there.

Mini recipe

1. Build a list of rules: Use concrete wording — not 'good text,' but 'every paragraph opens with a thesis that gets explained afterward.' No ready-made rules? Ask the model: `Give me a list of criteria for reviewing [type of material]` 2. Pass the material and rules together: Show what's being checked and the full list. Cover every requirement that can actually be broken: in the paper, covering the right rules mattered, not the raw count. 3. Ask for a rule-by-rule check: For each rule — a status (met / partially met / violated) and a specific quote from the material that illustrates the issue. 4. Tailor the output format to the task: Want speed? Add `output only the violations`. Want a full audit? Add `output everything with explanations and quotes`.

Examples

[BAD]: `Check this spec for any problems` [GOOD]: `Check this spec against these 6 rules: 1. Every function has a clear acceptance criterion 2. No vague requirements like 'fast' without numbers 3. Error handling is described for every scenario 4. Dependencies between modules are specified 5. Deadlines are tied to specific milestones 6. There's a section covering limitations and exceptions For each rule — a status (met / partially met / violated) and a quote from the spec that confirms or refutes it. [spec text]`

In plain words

When you ask a model to check your code or text for errors, it acts like a lazy intern: it glances at the surface and hands back a verdict of "looks fine, I guess." The problem is that without clear boundaries, the model falls back on its own internal hallucinations about what "good" even means. The Specification Grounding study shows that tests an LLM writes for code catch far more bugs when you literally shove a checklist of requirements under the model's nose. Told only to "include edge cases", its tests caught 18 of 30 buggy functions on the core tasks, because it can't guess what the author left out.

It's like showing up to inspect a newly built apartment without a checklist. You'd glance at the smooth wallpaper and declare everything great, only to discover a week later that the outlets don't work and the ventilation duct dead-ends into a closet. Specification Grounding is that exact checklist in the hands of a professional inspector. When the model has a line item that says "check for proper grounding on the outlets," it goes and checks exactly that, instead of just admiring the wall color. Without an explicit list of requirements, any review turns into a guessing game — one you always lose.

The core of the method is dead simple: give the model concrete specifications and force it to run the object through each one individually. Instead of a vague "review this code," hand it a list: "1. Is error handling in place? 2. Are memory limits respected? 3. Do variable names follow the standard?" The model then has to report on each point separately. The numbers speak for themselves: with the rules, the tests caught 30 of 30 buggy functions and the final code was correct 100% of the time, versus about 60% with the edge-case prompt.

The researchers tested this method only on small Python functions. Using it for legal contracts, marketing strategies, and even vacation plans is our extrapolation, but the logic looks the same. If you ask ChatGPT to evaluate your sales pitch, don't expect a miracle from a vague prompt. Give it a list of conditions instead: "check whether deadlines are stated, whether there's a call to action, and whether we're groveling to the client too much." That's the only way to get real feedback instead of a polite brush-off that ends up costing you the deal.

Bottom line: stop hoping the model's "intelligence" will save you — it's not a mind reader and has no clue what your standards are. Either you give it explicit evaluation criteria, or you get a result that's technically correct but practically useless. If you want AI actually working for you instead of just putting on a show of activity, bake Specification Grounding into every prompt. Without clear rules, any review is just burning tokens and time.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Specification Grounding: Explicit Criteria Instead of "Check for Errors" arXiv:2607.06636

Sign in to apply this study New accounts get 50 free credits.