arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2306.14893cs.SEcs.AIcs.CLcs.LG
收藏

LongCoder:一种用于代码补全的长程预训练语言模型

LongCoder: A Long-Range Pre-trained Language Model for Code Completion

Sun Yat-sen University(中山大学);University of California, San Diego(加州大学圣地亚哥分校);Microsoft Research Asia(微软亚洲研究院)

Daya Guo, Canwen Xu, Nan Duan, Jian Yin, Julian McAuley

AI总结:

本文针对长代码输入的代码补全任务提出稀疏Transformer模型LongCoder,通过滑动窗口机制与桥接、记忆两类全局token,在保持推理效率的同时显著提升了模型性能。

摘要:

在本文中,我们引入了一个专注于处理长代码输入的代码补全新任务,并提出了一个名为 LongCoder 的稀疏 Transformer 模型来解决该任务。LongCoder 采用滑动窗口机制进行自注意力计算,并引入了两种全局可访问的 token——桥接 token 和记忆 token——以提升性能和效率。桥接 token 被插入到整个输入序列中,以聚合局部信息并促进全局交互;而记忆 token 则用于突出显示后续可能被调用且需要被记住的重要语句,例如包导入以及类、函数或结构的定义。我们在一个新构建的包含更长代码上下文的数据集和公开的 CodeXGLUE 基准上进行了实验。实验结果表明,与之前的模型相比,LongCoder 在代码补全任务上取得了更优的性能,同时在推理期间的计算资源方面保持了相当的效率。所有代码和数据均可在 https://github.com/microsoft/CodeBERT 获取。

英文摘要:

In this paper, we introduce a new task for code completion that focuses on handling long code input and propose a sparse Transformer model, called LongCoder, to address this task. LongCoder employs a sliding window mechanism for self-attention and introduces two types of globally accessible tokens - bridge tokens and memory tokens - to improve performance and efficiency. Bridge tokens are inserted throughout the input sequence to aggregate local information and facilitate global interaction, while memory tokens are included to highlight important statements that may be invoked later and need to be memorized, such as package imports and definitions of classes, functions, or structures. We conduct experiments on a newly constructed dataset that contains longer code context and the publicly available CodeXGLUE benchmark. Experimental results demonstrate that LongCoder achieves superior performance on code completion tasks compared to previous models while maintaining comparable efficiency in terms of computational resources during inference. All the codes and data are available at https://github.com/microsoft/CodeBERT.

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

↑