Natural Language Defects in Code Generation Prompts: Empirical Impact and Lightweight Detection

Amal Akli, Mike Papadakis, Maxime Cordy, Yves Le Traon


Abstract
Large language models are widely used for code generation, yet they rely on an implicit assumption that the task descriptions are sufficiently detailed and well-formed. However, in practice, users may provide defective descriptions, which can have a strong effect on code correctness. To address this issue, we conduct a large-scale empirical analysis evaluating the robustness of 10 code LLMs across 3 benchmarks under three natural language defect types: Lexical Vagueness (LV), Under-Specification (US), and Syntax/Formatting (SF). Our results show that defect impact is not uniform: Under-Specification causes Pass@1 drops of up to 15.3% with no model immune, including state-of-the-art reasoning models; Lexical Vagueness produces moderate, benchmark-dependent degradation; and surface formatting noise has a negligible effect. Crucially, robustness is shaped more by the properties of the task description than by the size or architecture of the model, in contrast to prior perturbation studies reporting uniform degradation across models. Second, to address these defects before they reach the model, we develop SpecValidator, a lightweight LoRA-fine-tuned classifier based on a 1.5B code model, achieving F1 = 0.84 and MCC = 0.79, significantly outperforming few-shot GPT-5-mini (F1 = 0.43) and Claude-Sonnet-4 (F1 = 0.56), and demonstrating that strong code generation ability does not transfer to prompt meta-reasoning. Perhaps more importantly, our analysis indicates that SpecValidator can generalize to unseen issues and detect unknown Under-Specification defects in the original (real) descriptions of the benchmarks used.
Anthology ID:
2026.findings-emnlp.1908
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
40649–40663
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.1908/
DOI:
Bibkey:
Cite (ACL):
Amal Akli, Mike Papadakis, Maxime Cordy, and Yves Le Traon. 2026. Natural Language Defects in Code Generation Prompts: Empirical Impact and Lightweight Detection. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 40649–40663, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Natural Language Defects in Code Generation Prompts: Empirical Impact and Lightweight Detection (Akli et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.1908.pdf