Building a Coding Assistant via the Retrieval-Augmented Language Model

计算机科学 编码(社会科学) 自然语言处理 情报检索 语言学 人工智能 语音识别 数学 统计 哲学
作者
Xinze Li,Hanbin Wang,Zhenghao Liu,Shi Yu,Shuo Wang,Yukun Yan,Yukai Fu,Yu Gu,Ge Yu
出处
期刊: 卷期号:43 (2): 1-25 被引量:5
标识
DOI:10.1145/3695868
摘要

Pretrained language models have shown strong effectiveness in code-related tasks, such as code retrieval, code generation, code summarization, and code completion tasks. In this article, we propose COde assistaNt viA retrieval-augmeNted language model (CONAN), which aims to build a code assistant by mimicking the knowledge-seeking behaviors of humans during coding. Specifically, it consists of a code structure-aware retriever (CONAN-R) and a dual-view code representation-based retrieval-augmented generation model (CONAN-G). CONAN-R pretrains CodeT5 using Code-Documentation Alignment and Masked Entity Prediction tasks to make language models code structure-aware and learn effective representations for code snippets and documentation. Then CONAN-G designs a dual-view code representation mechanism for implementing a retrieval-augmented code generation model. CONAN-G regards the code documentation descriptions as prompts, which help language models better understand the code semantics. Our experiments show that CONAN achieves convincing performance on different code generation tasks and significantly outperforms previous retrieval augmented code generation models. Our further analyses show that CONAN learns tailored representations for both code snippets and documentation by aligning code-documentation data pairs and capturing structural semantics by masking and predicting entities in the code data. Additionally, the retrieved code snippets and documentation provide necessary information from both program language and natural language to assist the code generation process. CONAN can also be used as an assistant for Large Language Models (LLMs), providing LLMs with external knowledge in shorter code document lengths to improve their effectiveness on various code tasks. It shows the ability of CONAN to extract necessary information and help filter out the noise from retrieved code documents.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
matt完成签到,获得积分10
2秒前
2秒前
YEE完成签到,获得积分10
3秒前
matt发布了新的文献求助10
4秒前
4秒前
DAYTOY发布了新的文献求助10
4秒前
9秒前
11秒前
领导范儿的应助被shui采纳,获得10
12秒前
15秒前
15秒前
16秒前
橘子完成签到 ,获得积分10
18秒前
yyyyy发布了新的文献求助10
18秒前
19秒前
无花果的应助被温婉的亦云采纳,获得10
19秒前
一只鱼完成签到,获得积分10
20秒前
22秒前
明礼A完成签到,获得积分10
22秒前
miaofajin完成签到,获得积分10
22秒前
shui发布了新的文献求助10
26秒前
26秒前
留的白完成签到,获得积分10
26秒前
小猪猪饲养员完成签到,获得积分10
27秒前
夕阳完成签到 ,获得积分10
27秒前
含蓄的白安完成签到,获得积分10
27秒前
zjw完成签到 ,获得积分10
28秒前
28秒前
温婉的亦云对应助文件撤销了驳回
28秒前
珍珠爱学习完成签到,获得积分10
29秒前
无花果的应助被艾斯比采纳,获得10
30秒前
QDF发布了新的文献求助10
30秒前
科研通AI6.4的应助被二二春采纳,获得10
32秒前
wanci的应助被wgf采纳,获得30
33秒前
领导范儿的应助被欣喜战斗机采纳,获得10
34秒前
东都哈士奇完成签到,获得积分10
36秒前
QDF完成签到,获得积分10
37秒前
38秒前
42秒前
Nole的应助被崔崔采纳,获得10
42秒前
高分求助中
(应助此贴封号)通过应助OA文献获取积分 10000
The Student's Guide to Social Neuroscience 800
Rosenblum, Global Change Biology 800
Computational Chemical Reaction Engineering: Modeling, Simulation, and Design with MATLAB 600
Photoredox-Catalyzed Alkoxy-fluorosulfonylmethyl Difunctionalization of Alkenes 550
Organizational Behavior 510
Management and the Arts 510
热门求助领域 (近24小时)
化学 材料科学 医学 生物 计算机科学 工程类 纳米技术 内科学 物理 有机化学 化学工程 生物化学 复合材料 光电子学 细胞生物学 心理学 量子力学 催化作用 物理化学 电极
热门帖子
关注 科研通微信公众号,转发送积分 7811522
求助须知:如何正确求助?哪些是违规求助? 9342877
关于积分的说明 20515615
捐赠科研通 7404394
什么是DOI,文献DOI怎么找? 3329737
关于科研通互助平台的介绍 2476511
邀请新用户注册赠送积分活动 2349067