AceCoder : An Effective Prompting Technique Specialized in Code Generation

计算机科学 编码(集合论) 代码生成 程序设计语言 操作系统 钥匙(锁) 集合(抽象数据类型)
作者
Jia Li,Yunfei Zhao,Yongmin Li,Ge Li,Zhi Jin
出处
期刊:ACM Transactions on Software Engineering and Methodology [Association for Computing Machinery]
卷期号:33 (8): 1-26 被引量:2
标识
DOI:10.1145/3675395
摘要

Large language models (LLMs) have shown great success in code generation. LLMs take as the input a prompt and output the code. How to make prompts (i.e., Prompting Techniques ) is a key question. Existing prompting techniques are designed for natural language generation and have low accuracy in code generation. In this article, we propose a new prompting technique named AceCoder . Our motivation is that code generation meets two unique challenges (i.e., requirement understanding and code implementation). AceCoder contains two novel mechanisms (i.e., guided code generation and example retrieval) to solve these challenges. ❶ Guided code generation asks LLMs first to analyze requirements and output an intermediate preliminary (e.g., test cases). The preliminary clarifies requirements and tells LLMs “what to write.” ❷ Example retrieval selects similar programs as examples in prompts, which provide lots of relevant content (e.g., algorithms, APIs) and teach LLMs “how to write.” We apply AceCoder to four LLMs (e.g., GPT-3.5, CodeGeeX) and evaluate it on three public benchmarks using the Pass@ \(k\) . Results show that AceCoder can significantly improve the performance of LLMs on code generation. In terms of Pass@1, AceCoder outperforms the SOTA baseline by up to 56.4% in MBPP, 70.7% in MBJP, and 88.4% in MBJSP . AceCoder is effective in LLMs with different sizes (i.e., 6B–13B) and different languages (i.e., Python, Java, and JavaScript). Human evaluation shows human developers prefer programs from AceCoder .

科研通智能强力驱动
Strongly Powered by AbleSci AI
更新
大幅提高文件上传限制,最高150M (2024-4-1)

科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
1秒前
yellow完成签到,获得积分10
1秒前
1秒前
小蘑菇应助llllllll采纳,获得10
2秒前
赘婿应助艺歌采纳,获得10
2秒前
2秒前
3秒前
3秒前
3秒前
ZyW发布了新的文献求助10
4秒前
cuddles完成签到,获得积分10
4秒前
5秒前
Singularity发布了新的文献求助10
6秒前
loka发布了新的文献求助30
7秒前
7秒前
慕青应助天气不错呀采纳,获得10
8秒前
吧嗒蹭发布了新的文献求助10
8秒前
shuang0116应助yt采纳,获得30
8秒前
8秒前
123发布了新的文献求助10
8秒前
8秒前
科研通AI2S应助和尘同光采纳,获得10
9秒前
9秒前
9秒前
333cu发布了新的文献求助10
9秒前
周周发布了新的文献求助10
11秒前
牛啊牛啊发布了新的文献求助10
11秒前
12秒前
12秒前
wuhaixia发布了新的文献求助10
12秒前
刺猬完成签到,获得积分10
12秒前
Cola完成签到,获得积分10
12秒前
丘比特应助隐形哈密瓜采纳,获得10
12秒前
穆秋寒完成签到 ,获得积分10
12秒前
CodeCraft应助自由冬亦采纳,获得10
13秒前
Rui完成签到,获得积分10
13秒前
易槐完成签到,获得积分10
13秒前
zho关闭了zho文献求助
14秒前
磊878完成签到 ,获得积分10
14秒前
llllllll发布了新的文献求助10
15秒前
高分求助中
歯科矯正学 第7版(或第5版) 1004
Smart but Scattered: The Revolutionary Executive Skills Approach to Helping Kids Reach Their Potential (第二版) 1000
Semiconductor Process Reliability in Practice 720
PraxisRatgeber: Mantiden: Faszinierende Lauerjäger 700
GROUP-THEORY AND POLARIZATION ALGEBRA 500
Mesopotamian divination texts : conversing with the gods : sources from the first millennium BCE 500
Days of Transition. The Parsi Death Rituals(2011) 500
热门求助领域 (近24小时)
化学 医学 生物 材料科学 工程类 有机化学 生物化学 物理 内科学 纳米技术 计算机科学 化学工程 复合材料 基因 遗传学 催化作用 物理化学 免疫学 量子力学 细胞生物学
热门帖子
关注 科研通微信公众号,转发送积分 3227431
求助须知:如何正确求助?哪些是违规求助? 2875461
关于积分的说明 8191338
捐赠科研通 2542765
什么是DOI,文献DOI怎么找? 1373026
科研通“疑难数据库(出版商)”最低求助积分说明 646618
邀请新用户注册赠送积分活动 621099