Abstract
Code generation, the task of producing source code from prompts, has seen significant advancements with the advent of pre-trained large language models (PLMs). Despite these achievements, there lacks a comprehensive taxonomy of weaknesses about the benchmark and the generated code, which risks the community's focus on known issues at the cost of under-explored areas. Our systematic study aims to fill this gap by evaluating five state-of-the-art PLMs: three larger models, CodeGen2.5 with 7 billion parameters, CodeGeeX2 with 6 billion parameters, GPT-4 Turbo, and two smaller ones, UnixCoder with 110 million parameters and CodeT5 base with 220 million parameters, across three popular datasets, CoNaLa, HumanEval Plus, and DS-1000. We assess the quality of generated code using match-based and execution-based metrics, then conduct thematic analysis to develop a taxonomy of nine types of weaknesses. We dissected weakness distributions in both larger and smaller models, applying an extensive methodology that encompasses model-specific as well as collective analysis (union and intersection) across models. Our research uncovers three salient findings:
- In the CoNaLa dataset, inaccurate prompts are a notable problem, causing all large models to fail in 26.84% of cases, with even higher failure rates of 40% for smaller models;
- Missing pivotal semantics is a pervasive issue across benchmarks, with one or more large models omitting key semantics in 65.78% of CoNaLa tasks, and similarly high occurrences in HumanEval Plus (66.09%) and DS-1000 (80.51%);
- All models struggle with proper API usage, a challenge amplified by vague or complex prompts. Our findings aim to steer researchers towards addressing specific weaknesses and challenges in code generation. Furthermore, our annotations can offer a targeted benchmark subset for detailed analysis.
Introduction
While large language models (LLMs) have revolutionized code generation, they still stumble over specific, predictable hurdles. The current "arms race" in neural code generation often prioritizes aggregate leaderboard scores (like Pass@k) over a deep understanding of failure modes. This paper introduces a comprehensive taxonomy of nine weakness types, revealing that "missing pivotal semantics" and "inaccurate benchmark prompts" are primary reasons even state-of-the-art models like GPT-4 fail to produce functional code. By providing a "diagnostic manual," this study aims to help researchers build more robust models and clearer benchmarks.
Experimental Setup
The researchers evaluated five state-of-the-art Pre-trained Language Models (PLMs), categorized into Large Models (GPT-4, CodeGen2.5 7B, CodeGeeX2 6B) and Smaller Models (UnixCoder 110M, CodeT5-base 220M). Evaluation utilized three distinct benchmarks:
- CoNaLa: Mined from Stack Overflow for "how-to" snippets.
- HumanEval+: An enhanced version of HumanEval with an expanded test-case suite (~81x) to ensure functional correctness.
- DS-1000: 1,000 problems targeting data science libraries like NumPy and Pandas.
The methodology combined match-based metrics (Exact Match, CodeBLEU) and execution-based metrics (Pass@1) with a rigorous thematic analysis. A team of 14 participants manually annotated 3,125 prompt-code pairs to categorize failures that automated tools often miss.
Results and Analysis
The study's results highlight a significant "Semantic Gap." The most pervasive issue across all models was Missing Pivotal Semantics, where models grasp general intent but omit critical constraints (e.g., failing to sum over specific rows and instead summing an entire array).
Key Findings:
- Semantic Omissions: One or more large models missed key semantics in 65.78% of CoNaLa failures, 66.09% of HumanEval+ failures, and 80.51% of DS-1000 failures.
- Benchmark Fragility: In CoNaLa, inaccurate descriptions caused all large models to fail in nearly 27% of cases. Cleaning 90 problematic prompts led to a 400% gain in GPT-4's Exact Match scores.
- The Complexity Wall: Smaller models are highly sensitive to prompt complexity, with failure rates reaching 40% on complex prompts.
- "Gold Plating": GPT-4 often generates extra, unrequested features. While functional, this code fails match-based evaluations (EM = 0) despite high Pass@1 scores, highlighting its stylistic "creativity."
- API Hallucinations: Models frequently invoke non-existent methods or provide incorrect parameters, especially when prompts are vague.
Conclusion
This systematic study uncovers that model failure is often tied to semantic omissions and benchmark inaccuracies rather than a total lack of capability. Future work should focus on automated prompt refinement to clarify user intent and advanced stop criteria to mitigate "gold plating" and verbosity. By addressing these specific weaknesses, the community can move beyond leaderboard scores toward truly reliable code generation.
Summary updated