Large Language Models (LLMs) are nowadays extensively used for various types of software engineering tasks, primarily code generation. Previous research has shown how suitable prompt engineering could help developers in improving their code generation prompts. However, so far, there do not exist specific guidelines driving developers towards writing suitable prompts for code generation. In this work, we derive and evaluate development-specific prompt optimization guidelines. First, we use an iterative, test-driven approach to automatically refine code generation prompts, and we analyze the outcome of this process to identify prompt improvement items that lead to test passes. We use such elements to elicit 10 guidelines for prompt improvement, related to better specifying I/O, pre-post conditions, providing examples, various types of details, or clarifying ambiguities. We conduct an assessment with 50 practitioners, who report their usage of the elicited prompt improvement patterns, as well as their perceived usefulness, which does not always correspond to the actual usage before knowing our guidelines. Our results lead to implications not only for practitioners and educators, but also for those aimed at creating better LLM-aided software development tools.


翻译:大型语言模型(LLMs)当前已广泛应用于各类软件工程任务,其中代码生成是主要应用场景。已有研究表明,恰当的提示工程能够帮助开发者优化其代码生成提示。然而,迄今为止,尚缺乏专门指导开发者编写适用于代码生成任务提示的具体准则。本研究提出并评估了面向开发场景的提示优化指南。首先,我们采用迭代式测试驱动方法自动优化代码生成提示,并通过分析该过程的输出结果,识别出能够通过测试的提示改进要素。基于这些要素,我们归纳出10项提示改进指南,涉及输入输出规范、前置后置条件说明、示例提供、多维度细节描述以及模糊性澄清等方面。我们邀请50名从业者进行评估,收集了他们对于所归纳提示改进模式的使用情况及其感知有用性反馈——这些反馈在了解本指南前与实际使用情况并不完全一致。研究结果不仅对从业者和教育者具有启示意义,也为开发更优质的LLM辅助软件开发工具提供了参考。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
大型语言模型系统中提示缺陷的分类学
专知会员服务
8+阅读 · 2025年9月19日
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
大型语言模型的高效提示方法综述
专知会员服务
75+阅读 · 2024年4月2日
如何提示?浙大最新《大型语言模型提示框架》综述
专知会员服务
83+阅读 · 2023年11月23日
大语言模型简明指南
专知会员服务
143+阅读 · 2023年7月29日
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
自然语言处理中的语言模型预训练方法
PaperWeekly
14+阅读 · 2018年10月21日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
VIP会员
相关VIP内容
大型语言模型系统中提示缺陷的分类学
专知会员服务
8+阅读 · 2025年9月19日
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
大型语言模型的高效提示方法综述
专知会员服务
75+阅读 · 2024年4月2日
如何提示?浙大最新《大型语言模型提示框架》综述
专知会员服务
83+阅读 · 2023年11月23日
大语言模型简明指南
专知会员服务
143+阅读 · 2023年7月29日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员