mlsanityData to 14 Oct 2026

Specification Grounding Drives Test Effectiveness for LLM Code

arXiv 2607.06636 ↗First posted 7 Jul 2026cs.SE cs.AI cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language models frequently generate code that appears correct on typical inputs yet fails on edge cases, invalid inputs, and other specification-defined corner conditions. A popular fix has the model write its own tests and repair until they pass, but the source of the gain is unclear: does it come from the tests merely existing, or from their grounding in a specification of what the code should do? We isolate this factor. Holding the tester, test budget, and repair loop fixed, we change a single prompt line that controls whether the tester receives the spec as a checklist of rules. The baseline is strong: it is already told to probe invalid inputs and edge cases. Grounding the tests in the spec produces correct code +38 percentage points more often than this baseline across three Claude tiers (Haiku 4.5, Sonnet 4.6, Opus 4.8), and +36 points on a held-out set. Grounding, not test quantity, is the primary driver: doubling the test budget barely helps, and combining eight independent ungrounded suites plateaus far below grounding. An ablation isolates the spec's content, not its format: given the spec as a plain paragraph the tester recovers 27 of 30 bugs, but asked to plan tests without the spec it recovers only 2 of 30. The effect survives stronger baselines: a property-based generator catches 28 of 30 bugs but invents out-of-spec requirements, and an AlphaCodium-style loop only matches the baseline. It replicates across vendors (GPT-5.3-codex +28, Gemini 3.5 Flash +19), with a task-level sign test over 18 tasks significant at p=0.002. Grounding improves both sensitivity and precision: it catches more real bugs and wrongly rejects far less correct code, cutting the false-alarm rate from 33% (68% against a Python standard-library oracle) to 0%. On well-specified algorithmic problems it neither helps nor hurts.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 16 of its 23 references that are in the map. First posted on arXiv 7 Jul 2026.

Builds on

16 of 23 references.

References · 16

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
  3. 2021Program Synthesis with Large Language Modelscited by 3,637
  4. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
  5. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  7. 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,737
  8. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  9. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 1,017
  10. 2023Teaching Large Language Models to Self-Debugcited by 988
  11. 2017Selective Classification for Deep Neural Networkscited by 852
  12. 2022CodeT: Code Generation with Generated Testscited by 384
4 more
  1. 2023LEVER: Learning to Verify Language-to-Code Generation with Executioncited by 239
  2. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 197
  3. 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 103
  4. 2022Interactive Code Generation via Test-Driven User-Intent Formalizationcited by 50

Built on by

Not cited yet.