PythonSaga: Redefining the Benchmark to Evaluate Code Generating LLMs

Ankit Yadav, Himanshu Beniwal, Mayank SinghEMNLP 2024

Abstract

As Large Language Models (LLMs) achieve increasingly high scores on standard code-generation benchmarks like HumanEval and MBPP, the industry faces a problem of "saturation." High performance on these tests often fails to translate to real-world coding proficiency, as models may rely on pattern matching or memorization of training data. This paper introduces PythonSaga, a rigorous new benchmark of 185 hand-crafted problems across 38 diverse programming concepts. Our evaluation reveals a massive performance gap: even top-tier models like GPT-4, which excel on standard tests, see their success rates plummet when faced with balanced difficulty levels and complex logic, highlighting the need for more robust evaluation frameworks.

The Problem: Benchmark Saturation and Bias

In the current landscape of AI development, benchmarks serve as the primary yardstick for progress. However, the industry standards, HumanEval and MBPP, suffer from two critical flaws identified through expert human audit:

  1. Concept Bias: These benchmarks focus heavily on basic tasks like simple math and string manipulation, while neglecting essential concepts such as Object-Oriented Programming (OOP), Graphs, and Concurrency.
  2. Difficulty Inflation: The vast majority of problems in these sets are classified as "Easy," creating an illusion of superhuman performance that does not hold up in complex engineering environments.
Distribution of programming concepts in HumanEval and MBPP benchmarks, showing a heavy skew toward basic tasks and a lack of advanced concepts.

As illustrated in the figure above, the "Advance" category is nearly non-existent in traditional benchmarks, leaving a significant portion of a developer's toolkit untested.

Methodology: The PythonSaga Framework

To address these gaps, we developed PythonSaga using a three-step approach:

  • Taxonomy: We established a comprehensive hierarchy of 38 programming concepts, divided into Basic, Intermediate, and Advanced levels.
  • Curation: We hand-crafted 185 problems, ensuring a perfectly balanced distribution of 5 problems per concept (1 Easy, 2 Medium, 2 Hard).
  • Real-World Context: To mitigate the risk of "pattern matching" common interview questions, every problem was manually rephrased into a real-world scenario. For example, a standard substring problem might be reframed as a task involving unique car brands at a show, forcing the model to reason through the logic rather than recognizing a memorized template.

Key Results and a "Reality Check"

The results on PythonSaga provide a sobering look at the current state of AI coding. While GPT-4 scores approximately 67% on HumanEval, its performance drops to just 12.4% on PythonSaga.

Heatmap showing model performance across 38 concepts. Darker colors represent higher success rates; the prevalence of yellow in the Intermediate and Advance sections highlights widespread failure.

As shown in the heatmap, performance across all models—including state-of-the-art proprietary and open-source models—degrades significantly as tasks move from Basic to Advanced. No model was able to successfully solve problems involving specific concepts like "Max Flow" or "Context Managers." Popular open-source models like Llama 3 and Code Llama performed even lower, with most scoring below 5% overall. The most common failure modes identified were "Invalid Syntax" and "Incomplete Code," which became more frequent as difficulty increased.

Conclusion and Future Work

PythonSaga demonstrates that current LLMs are far from mastering general-purpose programming. The benchmark reveals that many models are "pattern matching" rather than "reasoning." While this study focused on Python, future work will involve expanding PythonSaga to other languages like Java and C++ to determine if these weaknesses are universal across the field of AI-assisted software engineering.

Summary updated

BibTeX
@inproceedings{yadav2024pythonsaga,
  author = {Ankit Yadav and Himanshu Beniwal and Mayank Singh},
  title = {{PythonSaga: Redefining the Benchmark to Evaluate Code Generating LLMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.996},
}
Figure