一句话:通过大规模实证评估自然语言到代码技术,揭示其效果、互补性并提出自动集成策略。
本文针对自然语言到代码研究缺乏系统性理解的问题,对6种代码搜索和4种代码生成技术进行大规模实证评估。基于22K+自然语言查询,研究发现:基于模型预训练的代码搜索最有效,代码生成也具潜力;不同技术间广泛存在互补性;将10种技术结合可较最佳单项提升35%。最后提出一种后处理策略,根据各技术生成的代码自动集成它们,实验证明该策略有效且可扩展。
A longstanding dream in software engineering research is to devise effective approaches for automating development tasks based on developers' informally-specified intentions. Such intentions are generally in the form of natural language descriptions. In recent literature, a number of approaches have been proposed to automate tasks such as code search and even code generation based on natural language inputs. While these approaches vary in terms of technical designs, their objective is the same: transforming a developer's intention into source code. The literature, however, lacks a comprehensive understanding towards the effectiveness of existing techniques as well as their complementarity to each other. We propose to fill this gap through a large-scale empirical study where we systematically evaluate natural language to code techniques. Specifically, we consider six state-of-the-art techniques targeting code search, and four targeting code generation. Through extensive evaluations on a dataset of 22K+ natural language queries, our study reveals the following major findings: (1) code search techniques based on model pre-training are so far the most effective while code generation techniques can also provide promising results; (2) complementarity widely exists among the existing techniques; and (3) combining the ten techniques together can enhance the performance for 35% compared with the most effective standalone technique. Finally, we propose a post-processing strategy to automatically integrate different techniques based on their generated code. Experimental results show that our devised strategy is both effective and extensible.
@inproceedings{WangGLSWLLBM23,
title = {Natural Language to Code: How Far Are We?},
author = {Shangwen Wang and Mingyang Geng and Bo Lin and Zhensu Sun and Ming Wen and Yepang Liu and Li Li and Tegawendé F. Bissyandé and Xiaoguang Mao},
booktitle = {FSE},
year = {2023},
doi = {10.1145/3611643.3616323}
}