← Latest papers
💻 computer science

When Prompt Under-Specification Improves Code Correctness: An Exploratory Study of Prompt Wording and Structure Effects on LLM-Based Code Generation

This exploratory study reveals that while prompt under-specification typically degrades code generation on structurally minimal benchmarks, it can surprisingly improve correctness on richer tasks like LiveCodeBench by disrupting misleading cues, demonstrating that prompt robustness is highly dependent on task structure rather than being a fixed model property.

Original authors: Amal AKLI, Mike PAPADAKIS, Maxime CORDY, Yves Le TRAON

Published 2026-04-28
📖 4 min read☕ Coffee break read

Original authors: Amal AKLI, Mike PAPADAKIS, Maxime CORDY, Yves Le TRAON

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are hiring a brilliant but slightly literal-minded assistant to write a computer program for you. You give them a set of instructions (a "prompt"). For a long time, experts believed that the more precise, detailed, and strict your instructions were, the better the assistant would do. If you left out a detail, the assistant would get confused and fail.

This paper challenges that old belief. The researchers found that sometimes, giving your assistant fewer details actually helps them write better code.

Here is how they discovered this, explained through simple analogies:

1. The Two Types of "Exams"

The researchers tested this idea on two different types of "exams" (benchmarks) for AI models:

  • The "Flashcard" Exam (HumanEval): These are like short, single-sentence flashcards. The instructions are very brief, with no extra context. It's like asking, "Write a function to sort this list."
  • The "Textbook" Exam (LiveCodeBench): These are like full textbook chapters. They include a long story, a list of rules, examples of inputs and outputs, and specific constraints. It's like saying, "Here is a story about sorting a list of names. Here are the rules: names can't be longer than 10 letters, and here is an example of how the input looks..."

2. The Experiment: "Breaking" the Instructions

The researchers took these instructions and intentionally "mutated" them in three ways to see what would happen:

  • Vagueness (LV): They swapped specific words for vague ones (e.g., changing "sort" to "arrange").
  • Under-Specification (US): They deleted a specific rule or constraint (e.g., removing a rule about how big the numbers can be).
  • Messy Formatting (SF): They added typos or changed the spacing.

3. The Surprising Results

The results were very different depending on which "exam" the AI took:

  • On the "Flashcard" Exam: When the researchers removed details or made the words vague, the AI's performance crashed. Just like a student who panics when a teacher removes a hint from a short quiz, the AI got confused and wrote broken code.
  • On the "Textbook" Exam: When they did the same thing, the AI's performance stayed the same or, surprisingly, got better.

The "Net Zero" Illusion:
At first, the researchers thought the AI on the "Textbook" exam just didn't care about the changes. But when they looked closer, they found a tug-of-war.

  • Some changes made the AI fail (degradation).
  • But an almost equal number of changes made the AI succeed where it had previously failed (improvement).
  • These two forces canceled each other out, making it look like nothing happened.

4. Why Does "Less" Sometimes Mean "More"?

The paper found a fascinating reason why removing a rule sometimes fixes the code. It's about bad habits and "cues."

Imagine the AI is like a student who has memorized answers from a specific textbook.

  • The Trap: Sometimes, a specific word or a specific number in the prompt acts like a "trigger." It reminds the AI of a memorized solution that looks right but is actually wrong for this specific problem.
    • Example from the paper: A problem mentioned "Currency." This word triggered the AI to think about financial exchange rates, leading it to use a backward-thinking algorithm.
  • The Fix: When the researchers removed the word "Currency" and replaced it with a vague word like "Resource," the AI stopped triggering its "financial memory." Instead, it was forced to actually think about the problem structure from scratch. This led to a correct solution.

In other words, the extra details in the prompt sometimes accidentally gave the AI a "hint" that led it down the wrong path. Removing that hint forced the AI to do the work correctly.

5. The Main Takeaway

The paper concludes that robustness isn't about how big the AI is (whether it's a small or giant model); it's about how the instructions are built.

  • If you give an AI a short, single-sentence prompt, it is very fragile. If you mess up the wording, it fails.
  • If you give an AI a rich, multi-layered prompt (with examples, constraints, and formats), it is much more robust. It has "backup signals" to rely on if one part of the instruction is confusing.
  • Crucially: Sometimes, being too specific is a trap. Specific words or numbers can accidentally "prime" the AI to use a memorized but incorrect shortcut. Removing those specific cues can sometimes force the AI to solve the problem correctly.

In short: Don't assume that a perfect, detailed prompt is always the best. Sometimes, a slightly vaguer prompt forces the AI to think for itself, avoiding the traps of its own memorized habits.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →