Automatic program synthesis is a long-lasting dream in software engineering. Recently, a promising Deep Learning (DL) based solution, called Copilot, has been proposed by OpenAI and Microsoft as an industrial product. Although some studies evaluate the correctness of Copilot solutions and report its issues, more empirical evaluations are necessary to understand how developers can benefit from it effectively. In this paper, we study the capabilities of Copilot in two different programming tasks: (i) generating (and reproducing) correct and efficient solutions for fundamental algorithmic problems, and (ii) comparing Copilot's proposed solutions with those of human programmers on a set of programming tasks. For the former, we assess the performance and functionality of Copilot in solving selected fundamental problems in computer science, like sorting and implementing data structures. In the latter, a dataset of programming problems with human-provided solutions is used. The results show that Copilot is capable of providing solutions for almost all fundamental algorithmic problems, however, some solutions are buggy and non-reproducible. Moreover, Copilot has some difficulties in combining multiple methods to generate a solution. Comparing Copilot to humans, our results show that the correct ratio of humans' solutions is greater than Copilot's suggestions, while the buggy solutions generated by Copilot require less effort to be repaired.
翻译:自动程序合成一直是软件工程领域的长期梦想。近期,OpenAI与微软联合提出了一个基于深度学习(Deep Learning, DL)的工业级解决方案——Copilot。尽管已有研究评估了Copilot生成代码的正确性并报告了其存在的问题,但仍需更多实证评估来理解开发者如何有效利用这一工具。本文从两类编程任务出发研究Copilot的能力:(i)为基本算法问题生成(和复现)正确且高效的解决方案;(ii)将Copilot提出的解决方案与人类程序员在编程任务集上的方案进行对比。针对前者,我们评估了Copilot在解决计算机科学基础问题(如排序、数据结构实现)时的性能与功能;针对后者,我们使用了包含人类提供解决方案的编程任务数据集。结果表明,Copilot几乎能为所有基础算法问题提供解决方案,但部分代码存在缺陷且无法复现。此外,Copilot在组合多种方法生成解决方案时存在困难。与人类相比,我们的结果显示人类解决方案的正确率高于Copilot的建议,但Copilot生成的缺陷代码需要更少的修复工作量。