Skip to main content
QUICK REVIEW

[Paper Review] Extending the Frontier of ChatGPT: Code Generation and Debugging

Fardin Ahsan Sakib, Saadat Hasan Khan|arXiv (Cornell University)|Jul 17, 2023
Topic ModelingComputer Science9 citations
TL;DR

The paper evaluates ChatGPT’s ability to generate and debug code for LeetCode problems, finding a 71.875% overall success rate with limited improvement from feedback and stronger performance on structured problems.

ABSTRACT

Large-scale language models (LLMs) have emerged as a groundbreaking innovation in the realm of question-answering and conversational agents. These models, leveraging different deep learning architectures such as Transformers, are trained on vast corpora to predict sentences based on given queries. Among these LLMs, ChatGPT, developed by OpenAI, has ushered in a new era by utilizing artificial intelligence (AI) to tackle diverse problem domains, ranging from composing essays and biographies to solving intricate mathematical integrals. The versatile applications enabled by ChatGPT offer immense value to users. However, assessing the performance of ChatGPT's output poses a challenge, particularly in scenarios where queries lack clear objective criteria for correctness. For instance, evaluating the quality of generated essays becomes arduous and relies heavily on manual labor, in stark contrast to evaluating solutions to well-defined, closed-ended questions such as mathematical problems. This research paper delves into the efficacy of ChatGPT in solving programming problems, examining both the correctness and the efficiency of its solution in terms of time and memory complexity. The research reveals a commendable overall success rate of 71.875\%, denoting the proportion of problems for which ChatGPT was able to provide correct solutions that successfully satisfied all the test cases present in Leetcode. It exhibits strengths in structured problems and shows a linear correlation between its success rate and problem acceptance rates. However, it struggles to improve solutions based on feedback, pointing to potential shortcomings in debugging tasks. These findings provide a compact yet insightful glimpse into ChatGPT's capabilities and areas for improvement.

Motivation & Objective

  • Assess ChatGPT’s ability to generate correct code solutions for programming problems from natural language descriptions.
  • Evaluate ChatGPT’s debugging capabilities when feedback is provided by LeetCode.
  • Analyze performance across problem domains, difficulty levels, and acceptance rates to identify strengths and limitations.
  • Characterize runtime and memory efficiency of ChatGPT-generated solutions when successful.

Proposed method

  • Construct a curated LeetCode-based dataset spanning multiple domains (Tree, Divide and Conquer, Greedy, DP, etc.).
  • Prompt ChatGPT with problem description and code structure to generate solutions, then run in LeetCode IDE for evaluation.
  • Record outcome as Passed Instance or failure with RTE/TLE/MLE and LeetCode test results.
  • Provide LeetCode feedback to ChatGPT and re-submit to assess debugging capabilities.
  • Analyze results across domains, difficulties, and acceptance rates; additionally assess run-time and memory efficiency for successful solutions.

Experimental results

Research questions

  • RQ1What is the overall success rate of ChatGPT in producing correct solutions for LeetCode problems?
  • RQ2How does ChatGPT perform across problem domains and difficulty levels in this coding setting?
  • RQ3To what extent can ChatGPT learn from LeetCode feedback to improve solutions (debugging performance)?

Key findings

  • ChatGPT achieved an overall success rate of 71.875% (92 of 128 problems).
  • 84 of the successful cases were on the first attempt; 8 required debugging after feedback.
  • ChatGPT’s debugging improvement after feedback occurred in only 36.7% of retry cases, with 63% of revised solutions passing fewer test cases than before.
  • The model performed best on Tree and Divide and Conquer problems, and struggled with Greedy and Dynamic Programming domains.
  • Solve success correlates with problem acceptance rate and is high for Easy problems (up to 90%), while Hard problems show about 55% success.
  • Efficiency (runtime/memory) improvements are not consistently achieved; higher acceptance rates correlate with better efficiency signals.

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.