Summarizing source code into natural language descriptions (code summarization) helps developers better understand program functionality and reduce the burden of software maintenance. Abstract Syntax Trees (ASTs), as opposed to source code, have been shown to improve summarization quality in traditional encoder-decoder-based code summarization models. However, most large language model (LLM)-based code summarization methods rely on raw code or only incorporate partial AST signals, meaning that the potential of complete AST representation has not been fully explored for LLMs. This paper presents AST(NIT), an AST augmentation and serialization method that preserves lexical details and encodes structural information into LLM-compatible sequences. Experiments with the LLaMA-3.1-8B model on the CodeXGLUE Python dataset show that the proposed serialized ASTs reduce the length of LLM inputs, require shorter training times, and achieve summarization quality comparable to existing approaches.


翻译:将源代码概括为自然语言描述(代码摘要)有助于开发者更好地理解程序功能并减轻软件维护负担。与传统基于编码器-解码器的代码摘要模型相比,抽象语法树(AST)已被证明能提升摘要质量。然而,当前大多数基于大语言模型(LLM)的代码摘要方法仍依赖原始代码或仅融入部分AST特征,这意味着完整的AST表征在LLM中的潜力尚未得到充分探索。本文提出AST(NIT)——一种保留词法细节并将结构信息编码为LLM兼容序列的AST增强与序列化方法。基于LLaMA-3.1-8B模型在CodeXGLUE Python数据集上的实验表明,所提出的序列化AST能缩短LLM输入长度,减少训练时间,同时获得与现有方法相当的摘要质量。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
《大型语言模型 (LLM) 对比研究》美海军最新报告
专知会员服务
85+阅读 · 2024年6月28日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
基于句子嵌入的无监督文本摘要(附代码实现)
用深度学习做文本摘要
专知
24+阅读 · 2019年3月30日
最新论文解读 | 基于预训练自然语言生成的文本摘要方法
微软研究院AI头条
57+阅读 · 2019年3月19日
独家 | 基于TextRank算法的文本摘要(附Python代码)
数据派THU
14+阅读 · 2018年12月21日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
【干货】深入理解自编码器(附代码实现)
论文报告 | Graph-based Neural Multi-Document Summarization
科技创新与创业
15+阅读 · 2017年12月15日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
VIP会员
相关资讯
基于句子嵌入的无监督文本摘要(附代码实现)
用深度学习做文本摘要
专知
24+阅读 · 2019年3月30日
最新论文解读 | 基于预训练自然语言生成的文本摘要方法
微软研究院AI头条
57+阅读 · 2019年3月19日
独家 | 基于TextRank算法的文本摘要(附Python代码)
数据派THU
14+阅读 · 2018年12月21日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
【干货】深入理解自编码器(附代码实现)
论文报告 | Graph-based Neural Multi-Document Summarization
科技创新与创业
15+阅读 · 2017年12月15日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员