{"slug": "specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models", "title": "Specs cut defects in AI-generated code from 148 to 23 across five models", "summary": "A pre-registered arXiv study submitted 20 Sep 2026 found that prepending a 267-word specification frame to prompts cut defects in LLM-generated backend code across all five frontier models tested, with the frame arm winning 95 of 100 paired comparisons and the Bandit security scanner recording 53 medium-or-high issues in the bare arm versus 11 in the frame arm. The study ran 50 realistic finance, healthcare, and insurance backend tasks twice through five models from five vendor lineages, scoring outputs with nine deterministic AST-based checkers; mean defect reduction ranged from 0.16 to 0.70 findings per task, with every Holm-adjusted sign test significant and every bootstrap confidence interval excluding zero. All 500 outputs, prompts, checkers, scoring code, and the pre-registration were published with a DOI.", "body_md": "# Computer Science > Software Engineering\n\n  [Submitted on 20 Sep 2026]\n\n# Title:Specification Before Generation: A Pre-Registered, Five-Model Paired Evaluation of a Specification Frame for LLM-Generated Code in Money, Time, Idempotency, and Access Tasks\n\n[View PDF](https://arxiv.org/pdf/2609.23270)\n\n[HTML (experimental)](https://arxiv.org/html/2609.23270v1)\n\nAbstract:Code generated by large language models passes security checks at a rate that has barely moved in four years. In regulated backends, the defect classes that matter most are money arithmetic, time handling, retry safety, and access control. Teams answer with instruction files, yet the largest controlled study of instruction files to date found no benefit. This paper tests a narrower idea: generated code improves when the prompt carries a specification, a fixed preamble stating what must be true of the result. We pre-registered hypotheses, refuters, analysis code, and a one-shot generation rule, then ran 50 realistic backend tasks from finance, healthcare, and insurance practice through five frontier models from five vendor lineages, each task twice: bare, and preceded by a 267-word filled specification frame. Nine deterministic AST-based checkers scored the outputs. The Bandit security scanner, which knows nothing of the frame, scored them independently. The frame reduced defects in all five models (mean reduction 0.16 to 0.70 findings per task, every Holm-adjusted sign test significant, every bootstrap confidence interval excluding zero). Where the arms differed, the frame arm won 95 of 100 times. It never made any model worse in any domain. Bandit found 53 medium-or-high issues in the bare arm and 11 in the frame arm, in the same direction for every model. The effect was largest where a model's unprompted defaults were weakest: the frame supplies the discipline a model lacks. All 500 outputs, prompts, checkers, scoring code, and the pre-registration are published with a DOI, so any team can re-derive the result without trusting the author.\n    \n\n### References & Citations\n\nLoading...\n\n# Bibliographic and Citation Tools\n\nBibliographic Explorer \n\n*(*[What is the Explorer?](https://info.arxiv.org/labs/showcase.html#arxiv-bibliographic-explorer))\nConnected Papers \n\n*(*[What is Connected Papers?](https://www.connectedpapers.com/about))\nLitmaps \n\n*(*[What is Litmaps?](https://www.litmaps.co/))\nscite Smart Citations \n\n*(*[What are Smart Citations?](https://www.scite.ai/))\n# Code, Data and Media Associated with this Article\n\nalphaXiv \n\n*(*[What is alphaXiv?](https://alphaxiv.org/))\nCatalyzeX Code Finder for Papers \n\n*(*[What is CatalyzeX?](https://www.catalyzex.com))\nDagsHub \n\n*(*[What is DagsHub?](https://dagshub.com/))\nGotit.pub \n\n*(*[What is GotitPub?](http://gotit.pub/faq))\nHugging Face \n\n*(*[What is Huggingface?](https://huggingface.co/huggingface))\nScienceCast \n\n*(*[What is ScienceCast?](https://sciencecast.org/welcome))\n# Demos\n\n# Recommenders and Search Tools\n\nInfluence Flower \n\n*(*[What are Influence Flowers?](https://influencemap.cmlab.dev/))\nCORE Recommender \n\n*(*[What is CORE?](https://core.ac.uk/services/recommender))\n# arXivLabs: experimental projects with community collaborators\n\narXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.\n\nBoth individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.\n\nHave an idea for a project that will add value for arXiv's community? [**Learn more about arXivLabs**](https://info.arxiv.org/labs/index.html).", "url": "https://wpnews.pro/news/specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models", "canonical_source": "https://arxiv.org/abs/2609.23270", "published_at": "2026-09-23 03:33:02+00:00", "updated_at": "2026-09-23 03:53:52.400697+00:00", "lang": "en", "topics": ["large-language-models", "ai-research", "ai-safety", "developer-tools"], "entities": ["arXiv", "Bandit", "Holm"], "alternates": {"html": "https://wpnews.pro/news/specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models", "markdown": "https://wpnews.pro/news/specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models.md", "text": "https://wpnews.pro/news/specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models.txt", "jsonld": "https://wpnews.pro/news/specs-cut-defects-in-ai-generated-code-from-148-to-23-across-five-models.jsonld"}}