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

GuardRails:为澄清歧义目的语句提供自动化建议

GuardRails: Automated Suggestions for Clarifying Ambiguous Purpose Statements

Mrigank Pawagi, Viraj Kumar

AI总结:

本文提出GuardRails启发式方法,利用LLM自动建议能暴露目的语句歧义的输入,并构建开放数据集、对比GitHub Copilot、提供VS Code开源扩展以帮助程序员澄清函数预期行为。

摘要:

在实现一个函数之前,鼓励程序员编写目的语句,即对函数计算内容的简短自然语言解释。目的语句可能是歧义的,即当两个或多个不等价的计算在某些输入上都是合理的时,它可能无法指定预期行为。本文做出四项贡献。第一,我们提出一种新颖的启发式方法,利用大型语言模型(LLMs)来建议此类输入。利用这些建议,程序员可以选择澄清目的语句(例如,通过提供一个函数示例来指定在此类输入上的预期行为)。第二,为了评估我们的启发式方法所建议输入的质量,并促进未来研究,我们创建了一个包含已知歧义的目的语句开放数据集。第三,我们将我们的启发式方法与 GitHub Copilot 的 Chat 功能进行比较,后者在被提示生成单元测试时可以建议类似的输入。第四,我们提供了启发式方法的开源实现,作为 Visual Studio Code 的 Python 编程语言扩展,其中目的语句和函数示例分别以 docstring 和 doctest 的形式指定。我们相信该工具对新手程序员和教师将特别有帮助。

英文摘要:

Before implementing a function, programmers are encouraged to write a purpose statement i.e., a short, natural-language explanation of what the function computes. A purpose statement may be ambiguous i.e., it may fail to specify the intended behaviour when two or more inequivalent computations are plausible on certain inputs. Our paper makes four contributions. First, we propose a novel heuristic that suggests such inputs using Large Language Models (LLMs). Using these suggestions, the programmer may choose to clarify the purpose statement (e.g., by providing a functional example that specifies the intended behaviour on such an input). Second, to assess the quality of inputs suggested by our heuristic, and to facilitate future research, we create an open dataset of purpose statements with known ambiguities. Third, we compare our heuristic against GitHub Copilot's Chat feature, which can suggest similar inputs when prompted to generate unit tests. Fourth, we provide an open-source implementation of our heuristic as an extension to Visual Studio Code for the Python programming language, where purpose statements and functional examples are specified as docstrings and doctests respectively. We believe that this tool will be particularly helpful to novice programmers and instructors.

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

↑