What matters in AI.

Subscribe

Learn / AI agents

Definition · AI agents

Specification-oracle gap

A specification-oracle gap is a mismatch between what a coding task says and what its grading tests (the oracle) require. The tests use a detail, such as a function name or a message. The agent cannot get it from the task or the code. Thus code with the correct behaviour can fail.

Last reviewed

Key points

  • In a specification-oracle gap, grading tests use a detail that the task does not give and the agent cannot infer.
  • Such details include a function name, a file path or the text of a message.
  • A 2026 preprint by Fei Ding found such a test in 25 of 98 graded SWE-Milestone milestones.
  • Without the affected tests, the leaderboard ranking held. Scores in single repositories moved.
  • The fix is to give the necessary names in the task, or to remove tests of internal code.

How the gap gets into a test

A test-graded benchmark gives a coding agent a written task and a code base. It then runs tests from a reference solution.

Hidden detail What the test does with it
Function, type or constant name Calls or reads it
Module or file path Imports or mocks it
Message or text format Compares it with the output

A detail does not count if the task or the code base gives it. It also does not count if a clear naming pattern lets the agent infer it.

The agent gets the task, but the grading tests come from the reference solution.
The agent gets the task, but the grading tests come from the reference solution.

In one example from Fei Ding, the task wants support for Server-Sent Events. It does not give two constant names that the tests use, headerAccept and valueSSE. A different name makes all 84 required tests of that Go package fail.

Why a failed test can mislead you

A failed test can look like low skill. With this gap, the agent can simply have a different name.

Use the 1.67 ratio. Ding says that the comparison of the two raw rates makes the effect look too large.

If you use scores to select an agent:

  • A score can include how well the agent guesses names from the source project.
  • A total ranking can stay stable while scores for one repository move.
  • Results for each test help you find why a task failed.

Where audits have found it

Ding made a static audit, with no model calls, for five languages. A flag shows a possible gap, not a confirmed one.

Benchmark Tasks flagged Reviewed flags confirmed
SWE-Milestone 25 of 98 58 of 65
SWE-EVO 17 of 48 24 of 40
SWE-Chain 64 of 155 28 of 40
SWE-bench Verified 3 of 500 3 of 4
DeepSWE 7 of 113 1 of 23

The review units and sample sizes are different in each row. Do not rank the benchmarks by these numbers alone.

In February 2026, OpenAI reported a related fault. It audited 138 SWE-bench Verified problems that its o3 model did not solve consistently. In 35.5% of them, strict tests enforced specific implementation details.

These were hard problems for one model, not a random sample. OpenAI did not use the same definition. Do not compare its number with the table.

4 ways to close the gap

Ding gives these recommendations for benchmark makers:

  1. Audit the dependencies. Give the necessary names, paths and messages in the task, or remove tests of internal code.
  2. Replay chained tasks. Run the reference solutions in more than one correct sequence, and repair tests that fail.
  3. Isolate build units. One missing name must not stop other tests. Tell the agent which names did not resolve.
  4. Publish results for each test. Other people can then examine failures and calculate scores again.

You can apply the first point to your own agent tests. Before you blame the agent, make sure that the task gave each name the verifier uses.

Trade-offs and limits

  • More detail changes the task. Our view: if the task fixes interface names, it gives the agent less design work to show.
  • Removed tests lose evidence. The score then covers less behaviour.
  • The fix is not proven. Ding wrote additions to the task specifications but did not test them with new agent runs.
  • The audit misses cases. Ding calls its counts a lower bound.
  • The research is new. The term comes from one preprint by one author.

Specification-oracle gap vs nearby faults

Fault What happens
Specification-oracle gap Tests use a detail the task did not give
Weak tests Tests accept code that is incorrect
Reward hacking The agent gets a score without the intended result

Wang, Pradel and Liu studied weak tests in SWE-bench. They found that 7.8% of all patches counted as correct but failed the test suite that developers wrote (version 2, September 2025).

In July 2026, OpenAI audited SWE-Bench Pro. Its list of faults includes strict tests and prompts that do not give all requirements.

Questions and answers

Is a specification-oracle gap the same as a weak test?

No. A weak test accepts code that is incorrect. A specification-oracle gap comes from a test that wants more than the task says. It can reject code that does the told work. One benchmark can have the two faults.

Does a specification-oracle gap make coding leaderboards useless?

The evidence does not show that. In Fei Ding's 2026 study of SWE-Milestone, the ranking held without the affected tests. Scores in single repositories did change. Only one benchmark had a full study.

Sources

  1. What the Specification Did Not Say: Specification-Oracle Gaps in Test-Graded Coding-Agent BenchmarksarXiv (Fei Ding), 22 Oct 2026
  2. What the Specification Did Not Say (full text, version 1)arXiv (Fei Ding), 22 Oct 2026
  3. Why we no longer evaluate SWE-bench VerifiedOpenAI, 23 Feb 2026
  4. Separating signal from noise in coding evaluationsOpenAI, 8 Jul 2026
  5. Are "Solved Issues" in SWE-bench Really Solved Correctly? An Empirical StudyarXiv (Wang, Pradel, Liu), 19 Mar 2025

In the news