Skip to main content
QUICK REVIEW

[Paper Review] A Performance Study of LLM-Generated Code on Leetcode - Code and Dataset artifacts

Jean-Baptiste Döderlein|arXiv (Cornell University)|Oct 26, 2022
Software Engineering ResearchComputer Science6 citations
TL;DR

This paper investigates how prompt variations and temperature settings impact the performance of Codex and GitHub Copilot on algorithmic coding tasks. Through automated experimentation on LeetCode and HumanEval, it demonstrates that tuning these parameters can boost success rates up to 79.27% in one-shot generation—significantly outperforming default settings—revealing both high potential and inherent brittleness in current code-generation models.

ABSTRACT

Language models are promising solutions for tackling increasing complex problems. In software engineering, they recently gained attention in code assistants, which generate programs from a natural language task description (prompt). They have the potential to save time and effort but remain poorly understood, limiting their optimal use. In this article, we investigate the impact of input variations on two configurations of a language model, focusing on parameters such as task description, surrounding context, model creativity, and the number of generated solutions. We design specific operators to modify these inputs and apply them to three LLM-based code assistants (Copilot, Codex, StarCoder2) and two benchmarks representing algorithmic problems (HumanEval, LeetCode). Our study examines whether these variations significantly affect program quality and how these effects generalize across models. Our results show that varying input parameters can greatly improve performance, achieving up to 79.27% success in one-shot generation compared to 22.44% for Codex and 31.1% for Copilot in default settings. Actioning this potential in practice is challenging due to the complex interplay in our study - the optimal settings for temperature, prompt, and number of generated solutions vary by problem. Reproducing our study with StarCoder2 confirms these findings, indicating they are not model-specific. We also uncover surprising behaviors (e.g., fully removing the prompt can be effective), revealing model brittleness and areas for improvement.

Motivation & Objective

  • To evaluate how variations in prompts and temperature settings affect the quality and correctness of code generated by Codex and GitHub Copilot.
  • To investigate whether systematic tuning of input parameters can significantly improve code generation performance on algorithmic programming problems.
  • To assess the robustness and sensitivity of code assistants to input configuration changes across diverse coding tasks.
  • To identify unexpected or counterintuitive configurations (e.g., removing prompts) that may outperform standard settings.
  • To provide a reproducible benchmark and dataset for future research on LLM-based code generation in software engineering.

Proposed method

  • Designed custom operators to systematically vary prompts, temperature, and number of generated solutions (pass@k) for each coding task.
  • Applied these operators across two benchmarks: HumanEval (50 tasks) and LeetCode (300 tasks) across 6 programming languages.
  • Automated the execution of code generation using Codex and Copilot APIs with controlled input variations.
  • Evaluated generated code using automated test suites to determine correctness (success rate).
  • Collected and analyzed results across multiple configurations to identify performance trends and optimal settings.
  • Released datasets and artifacts for reproducibility, including prompt variations and evaluation results.

Experimental results

Research questions

  • RQ1How does varying the prompt description affect the success rate of code generated by Codex and Copilot on algorithmic problems?
  • RQ2What is the impact of temperature hyperparameter tuning on code generation quality and correctness?
  • RQ3Can removing or simplifying the prompt lead to better code generation outcomes than standard or complex prompts?
  • RQ4How do the optimal configurations (temperature, prompt, pass@k) vary across different types of algorithmic problems?
  • RQ5To what extent is the performance of code assistants sensitive to input parameter configurations, and what does this imply for reliability and automation?

Key findings

  • Varying prompts and temperature settings significantly improved code generation performance, with a peak success rate of 79.27% in one-shot generation using optimized configurations.
  • Codex in default settings achieved only 22.44% success rate, while Copilot reached 31.1%, highlighting the substantial performance gap under standard configurations.
  • Surprisingly, fully removing the prompt in some cases yielded better results than using standard or complex prompts, indicating potential brittleness in current models.
  • The optimal configuration (temperature, prompt, pass@k) varied significantly across problems, making generalized tuning challenging.
  • Performance gains were not uniform across problem types or programming languages, suggesting context-dependent sensitivity in model behavior.
  • The study revealed that current code assistants are highly sensitive to input configuration, implying that manual or automated hyperparameter tuning is essential for optimal use.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.