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

开发者能否进行提示?代码文档生成的受控实验

Can Developers Prompt? A Controlled Experiment for Code Documentation Generation

Hans-Alexander Kruse, Tim Puhlfürß, Walid Maalej

AI总结:

本研究通过受控实验发现,开发者在代码文档生成中缺乏提示工程技能,临时提示效果不如预定义提示,需进一步研究其提示偏好与支持需求。

摘要:

大型语言模型(LLMs)在自动化繁琐的开发任务(如创建和维护代码文档)方面具有巨大潜力。然而,开发者在多大程度上能有效地提示LLMs以生成简洁且有用的文档尚不清楚。我们报告了一项受控实验,涉及20名专业人士和30名计算机科学学生,任务是为两个Python函数生成代码文档。实验组在Visual Studio Code的类ChatGPT扩展中自由输入临时提示,而对照组执行预定义的少样本提示。我们的结果显示,专业人士和学生不知道或无法应用提示工程技术。尤其是学生认为,与准备好的提示生成的文档相比,临时提示生成的文档可读性显著较差、不够简洁且帮助性较低。一些专业人士仅通过在临时提示中包含关键词Docstring就生成了更高质量的文档。虽然学生希望在制定提示时获得更多支持,但专业人士则欣赏临时提示的灵活性。两组参与者很少将输出评估为完美。相反,他们将工具理解为迭代改进文档的支持。需要进一步研究以了解开发者具有哪些提示技能和偏好,以及他们在特定任务中需要哪些支持。

英文摘要:

Large language models (LLMs) bear great potential for automating tedious development tasks such as creating and maintaining code documentation. However, it is unclear to what extent developers can effectively prompt LLMs to create concise and useful documentation. We report on a controlled experiment with 20 professionals and 30 computer science students tasked with code documentation generation for two Python functions. The experimental group freely entered ad-hoc prompts in a ChatGPT-like extension of Visual Studio Code, while the control group executed a predefined few-shot prompt. Our results reveal that professionals and students were unaware of or unable to apply prompt engineering techniques. Especially students perceived the documentation produced from ad-hoc prompts as significantly less readable, less concise, and less helpful than documentation from prepared prompts. Some professionals produced higher quality documentation by just including the keyword Docstring in their ad-hoc prompts. While students desired more support in formulating prompts, professionals appreciated the flexibility of ad-hoc prompting. Participants in both groups rarely assessed the output as perfect. Instead, they understood the tools as support to iteratively refine the documentation. Further research is needed to understand which prompting skills and preferences developers have and which support they need for certain tasks.

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

↑