arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.07529cs.SEcs.AI
收藏

评估ChatGPT-3.5在解决不同复杂度级别编码问题中的效率:一项实证分析

Evaluating ChatGPT-3.5 Efficiency in Solving Coding Problems of Different Complexity Levels: An Empirical Analysis

University of Southern California(南加州大学)

Minda Li, Bhaskar Krishnamachari

AI总结:

本文在LeetCode平台上实证评估了ChatGPT的GPT-3.5-turbo模型解决不同难度编码问题的能力,验证了难度递增导致性能下降、提示工程提升效果及流行编程语言表现更优三个假设。

摘要:

ChatGPT及其他大型语言模型(LLMs)有望通过从程序规范自动生成代码来彻底改变软件开发。我们在LeetCode(一个用于技术面试练习的包含算法编码挑战的流行平台)上评估了ChatGPT的GPT-3.5-turbo模型在三个难度级别(简单、中等和困难)上的性能。我们测试了三个主要假设。首先,随着难度增加,ChatGPT解决的问题更少(假设1)。其次,提示工程能提升ChatGPT的性能,在较简单的问题上提升更大,而在较难的问题上收益递减(假设2)。第三,ChatGPT在Python、Java和C++等流行语言中的表现优于Elixir、Erlang和Racket等较少见的语言(假设3)。为调查这些假设,我们使用Python脚本进行自动化实验以生成提示,指导ChatGPT创建Python解决方案。这些解决方案被存储并手动提交至LeetCode以检查其正确性。对于假设1,结果显示GPT-3.5-turbo模型成功解决了92%的简单问题、79%的中等问题和51%的困难问题。对于假设2,提示工程带来了提升:思维链提示提升14-29%,在第二次反馈提示中提供失败的测试用例提升38-60%,切换至GPT-4提升33-58%。从ChatGPT用Python解决的一个随机问题子集来看,它还解决了78%的Java问题、50%的C++问题,而Elixir、Erlang或Racket则一个也没解决。这些发现总体上验证了全部三个假设。

英文摘要:

ChatGPT and other large language models (LLMs) promise to revolutionize software development by automatically generating code from program specifications. We assess the performance of ChatGPT's GPT-3.5-turbo model on LeetCode, a popular platform with algorithmic coding challenges for technical interview practice, across three difficulty levels: easy, medium, and hard. We test three main hypotheses. First, ChatGPT solves fewer problems as difficulty rises (Hypothesis 1). Second, prompt engineering improves ChatGPT's performance, with greater gains on easier problems and diminishing returns on harder ones (Hypothesis 2). Third, ChatGPT performs better in popular languages like Python, Java, and C++ than in less common ones like Elixir, Erlang, and Racket (Hypothesis 3). To investigate these hypotheses, we conduct automated experiments using Python scripts to generate prompts that instruct ChatGPT to create Python solutions. These solutions are stored and manually submitted on LeetCode to check their correctness. For Hypothesis 1, results show the GPT-3.5-turbo model successfully solves 92% of easy, 79% of medium, and 51% of hard problems. For Hypothesis 2, prompt engineering yields improvements: 14-29% for Chain of Thought Prompting, 38-60% by providing failed test cases in a second feedback prompt, and 33-58% by switching to GPT-4. From a random subset of problems ChatGPT solved in Python, it also solved 78% in Java, 50% in C++, and none in Elixir, Erlang, or Racket. These findings generally validate all three hypotheses.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑