# How Specification Explicitness Shapes Failure in LLM-Generated Code

arXiv: https://arxiv.org/abs/2611.20195 · HTML: https://mlsanity.com/paper/2611.20195/

## Key facts

- No citing papers in the map yet (data through 24 Nov 2026).
- Builds on 49 of its 143 references that are in the map.
- Submitted 15 Nov 2026.

## Builds on (most cited first, 30 of 49)

- [Evaluating Large Language Models Trained on Code](https://mlsanity.com/paper/2107.03374/) (2021)
- [Program Synthesis with Large Language Models](https://mlsanity.com/paper/2108.07732/) (2021)
- [Measuring Coding Challenge Competence With APPS](https://mlsanity.com/paper/2105.09938/) (2021)
- [What Did I Do Wrong? Quantifying LLMs' Sensitivity and Consistency to Prompt Engineering](https://mlsanity.com/paper/2406.12334/) (2024)
- [ChatGPT Prompt Patterns for Improving Code Quality, Refactoring, Requirements Elicitation, and Software Design](https://mlsanity.com/paper/2303.07839/) (2023)
- [Bugs in Large Language Models Generated Code: An Empirical Study](https://mlsanity.com/paper/2403.08937/) (2024)
- [What's Wrong with Your Code Generated by Large Language Models? An Extensive Study](https://mlsanity.com/paper/2407.06153/) (2024)
- [What Prompts Don't Say: Understanding and Managing Underspecification in LLM Prompts](https://mlsanity.com/paper/2505.13360/) (2025)
- [A Survey of Vibe Coding with Large Language Models](https://mlsanity.com/paper/2510.12399/) (2025)
- [What Should We Engineer in Prompts? Training Humans in Requirement-Driven LLM Use](https://mlsanity.com/paper/2409.08775/) (2024)
- [Specifications: The missing link to making the development of LLM systems an engineering discipline](https://mlsanity.com/paper/2412.05299/) (2024)
- [Test Case Selection and Prioritization Using Machine Learning: A Systematic Literature Review](https://mlsanity.com/paper/2106.13891/) (2021)
- [Testing LLMs on Code Generation with Varying Levels of Prompt Specificity](https://mlsanity.com/paper/2311.07599/) (2023)
- [Prompt Engineering or Fine-Tuning: An Empirical Assessment of LLMs for Code](https://mlsanity.com/paper/2310.10508/) (2023)
- [Towards Formal Verification of LLM-Generated Code from Natural Language Prompts](https://mlsanity.com/paper/2507.13290/) (2025)
- [Risk ratio, odds ratio, risk difference... Which causal measure is easier to generalize?](https://mlsanity.com/paper/2303.16008/) (2023)
- [Documentation of Machine Learning Software](https://mlsanity.com/paper/2001.11956/) (2020)
- [Are Prompts All You Need? Evaluating Prompt-Based Large Language Models (LLM)s for Software Requirements Classification](https://mlsanity.com/paper/2509.13868/) (2025)
- [Natural Language Processing for Requirements Traceability](https://mlsanity.com/paper/2405.10845/) (2024)
- [From Requirements to Code: Understanding Developer Practices in LLM-Assisted Software Engineering](https://mlsanity.com/paper/2507.07548/) (2025)
- [Traceability in the Wild: Automatically Augmenting Incomplete Trace Links](https://mlsanity.com/paper/1804.02433/) (2018)
- [Asymmetric Release Planning-Compromising Satisfaction against Dissatisfaction](https://mlsanity.com/paper/1901.05130/) (2019)
- [What Makes Agile Software Development Agile?](https://mlsanity.com/paper/2109.11435/) (2021)
- [Developers' Perception of GitHub Actions: A Survey Analysis](https://mlsanity.com/paper/2303.04084/) (2023)
- [Eye of the Mind: Image Processing for Social Coding](https://mlsanity.com/paper/2001.06426/) (2020)
- [Extension Decisions in Open Source Software Ecosystem](https://mlsanity.com/paper/2507.23168/) (2025)
- [Examining Ownership Models in Software Teams: A Systematic Literature Review and a Replication Study](https://mlsanity.com/paper/2405.15665/) (2024)
- [GitHub Marketplace for Automation and Innovation in Software Production](https://mlsanity.com/paper/2407.05519/) (2024)
- [Mining Treatment-Outcome Constructs from Sequential Software Engineering Data](https://mlsanity.com/paper/1901.05604/) (2019)
- [Release Practices for Mobile Apps--What do Users and Developers Think?](https://mlsanity.com/paper/1910.08876/) (2019)

## Abstract (arXiv)

When LLMs turn requirements into code, every underspecified constraint becomes behavior that the model must decide during generation. We test when specifications move beyond structure and begin to control generated behavior. In a controlled experiment, 72 participants implemented and revised Python tasks with an LLM under three levels of specification explicitness. The results show a clear break between lightweight structure and explicit behavioral obligations. Lightweight structure reduced hidden-test failures by only 8.7%. Requiring participants to specify constraints, invariants, negative requirements, edge cases, tie-breaking rules, and exception handling cut failures by 47.2% and reduced the number of distinct failure modes by 20.5%. The largest drops were in failure modes tied to implicit obligations. Invariant violations fell by 66.1%, and unsupported assumptions fell by 59.5%. After a requirement change, specifications with explicit behavioral obligations produced regressions in more submissions, but each affected submission lost less previously correct behavior. Explicit specifications also changed how developers judged generated code. Without explicit obligations, participants overestimated generated-code correctness by about 23 percentage points. With explicit obligations, they produced better code but judged it more cautiously. Thus, the lesson is sharper than "better specifications help." Lightweight structure barely helped, while explicit behavioral obligations nearly halved failures, made regressions shallower, and improved calibration.
