Abstract
Large Language Models (LLMs) demonstrate remarkable proficiency in generating code from clear, expert-written prompts. However, real-world software requirements are often informal, vague, or inconsistent. This paper investigates the robustness of state-of-the-art LLMs—including GPT-4, Qwen-2.5, and DeepSeek-Coder—when faced with ambiguous, contradictory, or incomplete task descriptions. Our findings reveal a significant "compliance trap": models rarely flag low-quality prompts and instead attempt to generate code, leading to performance drops of up to 40% and a high rate of logically incorrect but runnable code.
Introduction
Standard code generation benchmarks like HumanEval and MBPP rely on "idealized" task descriptions. These prompts are meticulously crafted to be complete and unambiguous. In contrast, professional developers frequently encounter "informal developer instructions" that may omit parameters or contain conflicting goals.
The central question of this research is whether LLMs possess the robustness to recognize these flaws and seek clarification, or if they blindly follow instructions to produce incorrect results. Even state-of-the-art models suffer performance drops of up to 40% when trying to solve flawed prompts, often producing syntactically correct but logically useless code.
Methodology
To evaluate robustness, the researchers developed a framework to inject realistic flaws into existing high-quality benchmarks using GPT-4 as a "mutation engine."
Mutation Strategies
The team transformed clear prompts from HumanEval and MBPP into three categories of low-quality requirements:
- Ambiguous: Using vague wording or terms with multiple interpretations.
- Contradictory: Inserting conflicting constraints or incompatible post-conditions.
- Incomplete: Omitting critical parameters, constraints, or edge cases.
Evaluation Framework
Seven models were tested, ranging from 6B to 34B parameters. The evaluation focused on two primary metrics: classification accuracy (the ability to identify prompt quality via Matthews Correlation Coefficient) and functional correctness (Pass@1).
Results and Key Insights
The study highlights several critical vulnerabilities in current LLMs.
The "Compliance" Trap
Models exhibit a strong "helpful" bias. Rather than identifying a prompt as nonsensical, they attempt to reconcile impossible constraints, leading to "hallucinated" logic. Even top-tier models like GPT-4 and Qwen-32B showed only modest capability in identifying unclear prompts, with Matthews Correlation Coefficient (MCC) scores hovering around 0.5.
Performance Degradation
Across all models, Pass@1 accuracy plummeted when prompts were flawed. Contradictory prompts were the most damaging. Notably, GPT-4’s performance on HumanEval dropped from 73.8% on original prompts to a staggering 6.7% when faced with contradictions.
Runnable but Wrong
A dangerous trend observed was the "Runnable but Incorrect Rate" (RIR). For GPT-4, the rate of code that executed but failed tests jumped from 24% to 89% under contradictory conditions. This suggests that models prioritize syntactic correctness over logical consistency, which is particularly dangerous for developers who might assume that "if it runs, it's right."
Conclusion
Current LLMs are not yet robust enough to handle the messiness of real-world requirements. Scaling models provides some resilience but does not solve the underlying reasoning failures. Future work must focus on "clarification-aware training," teaching models to pause and ask for more information when faced with low-quality instructions, and developing diagnostic tools to explain why a prompt is flawed.
Summary updated