清晨好,您是今天最早来到科研通的研友!由于当前在线用户较少,发布求助请尽量完整地填写文献信息,科研通机器人24小时在线,伴您科研之路漫漫前行!

SkCoder: A Sketch-based Approach for Automatic Code Generation

素描 计算机科学 编码(集合论) 代码段 代码生成 源代码 代码重用 重新使用 草图识别 人工智能 冗余代码 程序设计语言 情报检索 自然语言处理 钥匙(锁) 算法 软件 生态学 手势识别 手势 计算机安全 集合(抽象数据类型) 生物
作者
Jia Li,Yongmin Li,Ge Li,Zhi Jin,Yiyang Hao,Xing Hu
标识
DOI:10.1109/icse48619.2023.00179
摘要

Recently, deep learning techniques have shown great success in automatic code generation. Inspired by the code reuse, some researchers propose copy-based approaches that can copy the content from similar code snippets to obtain better performance. Practically, human developers recognize the content in the similar code that is relevant to their needs, which can be viewed as a code sketch. The sketch is further edited to the desired code. However, existing copy-based approaches ignore the code sketches and tend to repeat the similar code without necessary modifications, which leads to generating wrong results. In this paper, we propose a sketch-based code generation approach named Skcoderto mimic developers' code reuse behavior. Given a natural language requirement, Skcoderretrieves a similar code snippet, extracts relevant parts as a code sketch, and edits the sketch into the desired code. Our motivations are that the extracted sketch provides a well-formed pattern for telling models "how to write". The post-editing further adds requirement-specific details into the sketch and outputs the complete code. We conduct experiments on two public datasets and a new dataset collected by this work. We compare our approach to 20 baselines using 5 widely used metrics. Experimental results show that (1) Skcodercan generate more correct programs, and outperforms the state-of-the-art -CodeT5-base by 30.30%, 35.39%, and 29.62% on three datasets. (2) Our approach is effective to multiple code generation models and improves them by up to 120.1% in Pass@l. (3) We investigate three plausible code sketches and discuss the importance of sketches. (4) We manually evaluate the generated code and prove the superiority of our Skcoderin three aspects.

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
111完成签到 ,获得积分10
26秒前
28秒前
深情安青应助鳗鱼傲柏采纳,获得10
31秒前
心灵美的天川完成签到,获得积分10
40秒前
oleskarabach发布了新的文献求助10
1分钟前
1分钟前
鳗鱼傲柏发布了新的文献求助10
1分钟前
lorentzh完成签到,获得积分10
1分钟前
1分钟前
1分钟前
1分钟前
禤禤发布了新的文献求助10
1分钟前
酷波er应助科研通管家采纳,获得10
2分钟前
小蘑菇应助科研通管家采纳,获得10
2分钟前
随心所欲完成签到 ,获得积分10
2分钟前
幸运小张完成签到,获得积分10
2分钟前
雪山飞龙完成签到,获得积分10
2分钟前
啊伟应助雪山飞龙采纳,获得10
2分钟前
wuzhe03完成签到,获得积分10
3分钟前
起风了完成签到 ,获得积分10
3分钟前
淡然觅荷完成签到 ,获得积分10
3分钟前
禤禤驳回了ding应助
3分钟前
李爱国应助鳗鱼傲柏采纳,获得10
4分钟前
4分钟前
neversay4ever完成签到 ,获得积分10
4分钟前
4分钟前
禤禤发布了新的文献求助10
4分钟前
4分钟前
5分钟前
zzhui完成签到,获得积分10
5分钟前
标致初曼完成签到,获得积分20
5分钟前
鳗鱼傲柏发布了新的文献求助10
5分钟前
科目三应助高大的帆布鞋采纳,获得10
5分钟前
5分钟前
5分钟前
5分钟前
5分钟前
傻瓜完成签到 ,获得积分10
5分钟前
6分钟前
Shirley发布了新的文献求助10
6分钟前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
Lewis’s Child and Adolescent Psychiatry: A Comprehensive Textbook Sixth Edition 2000
Cronologia da história de Macau 1600
Treatment response-adapted risk index model for survival prediction and adjuvant chemotherapy selection in nonmetastatic nasopharyngeal carcinoma 1000
Lloyd's Register of Shipping's Approach to the Control of Incidents of Brittle Fracture in Ship Structures 1000
BRITTLE FRACTURE IN WELDED SHIPS 1000
Atlas of Anatomy 5th original digital 2025的PDF高清电子版(非压缩版,大小约400-600兆,能更大就更好了) 1000
热门求助领域 (近24小时)
化学 材料科学 医学 生物 工程类 有机化学 纳米技术 计算机科学 化学工程 生物化学 物理 复合材料 内科学 催化作用 物理化学 光电子学 细胞生物学 基因 电极 遗传学
热门帖子
关注 科研通微信公众号,转发送积分 6202993
求助须知:如何正确求助?哪些是违规求助? 8029866
关于积分的说明 16719904
捐赠科研通 5295124
什么是DOI,文献DOI怎么找? 2821506
邀请新用户注册赠送积分活动 1801041
关于科研通互助平台的介绍 1662993