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

通过提出澄清问题生成 Python 代码

Python Code Generation by Asking Clarification Questions

TU Darmstadt(达姆施塔特工业大学);Hessian Center for AI (hessian.AI)(黑森人工智能中心);Bosch Center for Artificial Intelligence(博世人工智能中心);Instituto Superior Técnico(高等技术学院);LUMLIS (Lisbon ELLIS Unit)(LUMLIS(里斯本ELLIS单元));Instituto de Telecomunicações(电信研究所);Unbabel(Unbabel公司)

Haau-Sing Li, Mohsen Mesgar, André F. T. Martins, Iryna Gurevych

AI总结:

本文提出通过提出澄清问题来解决自然语言描述不够具体导致的代码生成失败问题,并构建了包含合成澄清问答对的 CodeClarQA 数据集,实验证明澄清能显著提升预训练语言模型的代码生成精度。

摘要:

从文本生成代码需要从自然语言描述中理解用户意图,并生成满足该意图的可执行代码片段。尽管最近的预训练语言模型在此任务上表现出色,但当给定的自然语言描述不够具体时,这些模型会失败。在这项工作中,我们为此任务引入了一种新颖且更贴近现实的设定。我们假设自然语言描述的不够具体可以通过提出澄清问题来解决。因此,我们收集并引入了一个名为 CodeClarQA 的新数据集,其中包含自然语言描述与代码的配对,并附有人工合成的澄清问题和答案。我们对预训练语言模型在代码生成上的性能评估实证结果表明,澄清能够使生成的代码更加精确,所有评估指标上的模型性能均有显著提升。与此同时,我们的任务和数据集为社区带来了新的挑战,包括何时以及应该提出什么样的澄清问题。我们的代码和数据集可在 GitHub 上获取。

英文摘要:

Code generation from text requires understanding the user's intent from a natural language description and generating an executable code snippet that satisfies this intent. While recent pretrained language models demonstrate remarkable performance for this task, these models fail when the given natural language description is under-specified. In this work, we introduce a novel and more realistic setup for this task. We hypothesize that the under-specification of a natural language description can be resolved by asking clarification questions. Therefore, we collect and introduce a new dataset named CodeClarQA containing pairs of natural language descriptions and code with created synthetic clarification questions and answers. The empirical results of our evaluation of pretrained language model performance on code generation show that clarifications result in more precisely generated code, as shown by the substantial improvement of model performance in all evaluation metrics. Alongside this, our task and dataset introduce new challenges to the community, including when and what clarification questions should be asked. Our code and dataset are available on GitHub.

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

↑