TL;DR
Prompt under-specification doesn't always degrade LLM code generation; in structurally rich prompts, removing constraints or using vaguer language can actually improve code correctness. This happens because simplifying a prompt can disrupt misleading "retrieval cues" that inadvertently anchor the model to incorrect, memorized solution patterns.
What Problem Does This Paper Address?
A common assumption in prompt engineering is that more precise, highly detailed prompts lead to better LLM-generated code. Prior studies have shown that minor wording changes or missing requirements (under-specification) can tank model performance.
However, the authors point out a major flaw in this conventional wisdom: it relies almost entirely on minimal-specification benchmarks like HumanEval or MBPP. These benchmarks use short, single-docstring descriptions that lack the structural redundancy found in real-world programming tasks. This paper investigates a fundamental question: How do prompt wording, structural richness, and task complexity interact to affect code correctness across different LLMs?
Methods
The authors systematically introduced three types of prompt mutations to evaluate model robustness:
- Lexical Vagueness (LV): Replacing precise, task-relevant terms with broader synonyms and renaming identifiers to be less informative (e.g., changing
sorttoarrange). - Under-Specification (US): Removing a single explicit constraint, such as value bounds or edge-case descriptions.
- Syntax and Formatting (SF): Introducing surface-level noise like typos or formatting irregularities without altering semantic content.
Mutations were generated using an LLM and validated via an independent automated judge alongside manual human inspection. The authors evaluated 10 different code-generation models (ranging from 6B open-source models to state-of-the-art proprietary reasoning models) using two primary metrics: Pass@1 and a fine-grained transition-based analysis tracking solutions that flipped from passing to failing ($Pass \rightarrow Fail$) and vice versa ($Fail \rightarrow Pass$). They also analyzed the models' internal attention distributions to see which parts of the prompt mattered most.
Datasets
The study compared two structurally contrastive benchmarks:
- HumanEval (HE): 164 simple, hand-written Python problems characterized by minimal specifications (just a function signature and a short docstring).
- LiveCodeBench (LCB): 1,055 complex, contamination-free competitive programming problems featuring multi-layered specifications, including full prose descriptions, explicit constraint sections, input/output format specifications, and multiple sample I/O pairs with explanations.
Key Insights and Ideas
- Robustness is an Artifact of Prompt Structure, Not Model Scale: Larger models aren't inherently more robust to prompt changes. Instead, the structure of the prompt dictates robustness. Multi-layered prompts provide redundant information channels; if the description is degraded, the model can fall back on intact I/O formats or examples.
- The "Less is More" Phenomenon: Surprisingly, under-specification and vagueness frequently helped models generate correct code. Original prompts often contain domain-specific vocabulary or strict constraint formulations that act as "spurious retrieval cues." These cues trick the model into pulling an overfitted, memorized algorithm from its training data that doesn't quite fit the current problem.
- Attention Redistribution: Attention mapping revealed that when prompts are structurally rich (like LCB), models distribute 30–50% of their attention to the I/O format and sample regions. In contrast, HumanEval forces models to concentrate 60–86% of their attention purely on the short description, making it highly fragile.
Key Results
- Asymmetric Benchmark Performance: On HumanEval, mutations uniformly degraded performance. Under-specification (US) caused an average Pass@1 drop of 11.8%, and lexical vagueness (LV) caused a 7.1% drop. On LiveCodeBench, however, the net effect was near-zero (US dropped by only 0.9%, and LV dropped by 0.2%).
- Opposing Forces Cancel Out: The near-zero net effect on LiveCodeBench wasn't due to insensitivity; rather, it was caused by two opposing forces balancing each other out. For LV mutations on LCB, the ratio of $Fail \rightarrow Pass$ to $Pass \rightarrow Fail$ transitions was 0.99 (nearly perfect balance), whereas on HumanEval it was a heavily skewed 0.40.
- Consistent Improvements: The authors identified 47 "clean" tasks in LiveCodeBench where introducing vagueness or under-specification consistently and exclusively improved the pass rate across multiple models. Manual analysis showed that 74% of these improvements under under-specification occurred because removing a constraint either fixed a LeetCode-style input parsing assumption or disrupted a constraint-anchored wrong algorithm.
Limitations and Future Work
The authors acknowledge several limitations:
- Python-Only: The study was conducted exclusively on Python code generation; results might differ for languages with different type systems or library dependencies.
- Greedy Decoding: The evaluation relied on Pass@1 with greedy decoding to ensure reproducibility, which masks the variance inherent in multi-sample generation ($Pass@k$).
- Exploratory Nature: As an exploratory study, the findings are primarily hypothesis-generating. Future work will require tightly controlled causal experiments to isolate specific linguistic triggers.
Summary updated