arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.09082cs.SE
收藏

好、坏与缺失:面向机器学习任务的神经代码生成

The Good, the Bad, and the Missing: Neural Code Generation for Machine Learning Tasks

Jiho Shin, Moshi Wei, Junjie Wang, Lin Shi, Song Wang

AI总结:

本文系统评估了六种神经代码生成模型在四类ML库上83K个任务中的表现,发现其在ML任务上优于非ML任务但生成代码语义错误多,并提出将分治式代码生成分解为API序列识别与API使用生成两个子任务。

摘要:

机器学习(ML)已被越来越多地应用于各种领域,但解决ML编程任务带来了独特挑战,因为其本质和构造与一般编程任务存在根本差异,尤其是对于没有ML背景的开发者而言。从自然语言描述自动生成代码片段的技术,有望成为加速ML编程任务的一种有前景的方法。近年来,尽管许多基于深度学习的神经代码生成模型被提出并取得了较高准确率,但其中大多数主要在一般编程任务上进行评估,这一事实使人们对它们在ML编程任务中的有效性和实用性产生疑问。在本文中,我们着手研究现有神经代码生成模型在ML编程任务上的有效性。为了进行分析,我们选取了六个最先进的神经代码生成模型,并在四个广泛使用的ML库上评估它们的性能,使用了新构建的83K对自然语言描述的ML编程任务。我们的实证研究揭示了神经代码生成模型在ML任务上的一些好的、坏的和缺失的方面,下面列出几个主要方面。(好)神经代码生成模型在ML任务上的表现显著优于非ML任务。(坏)生成的大部分代码在语义上是不正确的。(坏)代码生成模型不能显著缩短开发者的完成时间。(好)生成的代码可以通过为开发者提供使用正确API的线索,帮助开发者编写更正确的代码。(缺失)我们用户研究中的观察揭示了面向ML任务的代码生成所缺失的方面,例如,将分治式代码生成分解为两个任务:API序列识别和API使用生成。

英文摘要:

Machine learning (ML) has been increasingly used in a variety of domains, while solving ML programming tasks poses unique challenges because of the fundamentally different nature and construction from general programming tasks, especially for developers who do not have ML backgrounds. Automatic code generation that produces a code snippet from a natural language description can be a promising technique to accelerate ML programming tasks. In recent years, although many deep learning-based neural code generation models have been proposed with high accuracy, the fact that most of them are mainly evaluated on general programming tasks calls into question their effectiveness and usefulness in ML programming tasks. In this paper, we set out to investigate the effectiveness of existing neural code generation models on ML programming tasks. For our analysis, we select six state-of-the-art neural code generation models, and evaluate their performance on four widely used ML libraries, with newly-created 83K pairs of natural-language described ML programming tasks. Our empirical study reveals some good, bad, and missing aspects of neural code generation models on ML tasks, with a few major ones listed below. (Good) Neural code generation models perform significantly better on ML tasks than on non-ML tasks. (Bad) Most of the generated code is semantically incorrect. (Bad) Code generation models cannot significantly improve developers' completion time. (Good) The generated code can help developers write more correct code by providing developers with clues for using correct APIs. (Missing) The observation from our user study reveals the missing aspects of code generation for ML tasks, e.g., decomposing code generation for divide-and-conquer into two tasks: API sequence identification and API usage generation.

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

↑