arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.07104cs.SEcs.AI
收藏

xASTNN: 面向工业实践的改进代码表示方法

xASTNN: Improved Code Representations for Industrial Practice

Tsinghua University(清华大学);Fudan University(复旦大学);VMware;Chongqing University(重庆大学)

Zhiwei Xu, Min Zhou, Xibin Zhao, Yang Chen, Xi Cheng, Hongyu Zhang

AI总结:

针对现有代码表示方法难落地工业的问题,提出基于AST的xASTNN神经网络,通过三项设计保障效果并以动态批处理降复杂度,在代码理解任务上性能超SOTA且速度更快。

摘要:

深度学习技术在软件工程中的应用日益广泛,核心问题之一是为代码相关任务开发高质量且易用的源代码表示方法。近年来研究领域已取得显著成果,但由于部署难度和性能瓶颈,这些方法很少应用于工业界。本文提出xASTNN,一种基于极限抽象语法树(eXtreme Abstract Syntax Tree, AST)的源代码表示神经网络,旨在推动该技术落地工业实践。xASTNN具备三大优势:其一,它完全基于广泛使用的AST,无需复杂数据预处理,可适用于多种编程语言和实际场景;其二,提出三项紧密关联的设计保障其有效性,包括体现代码自然性的语句子树序列、处理语法信息的门控递归单元、处理序列信息的门控循环单元;其三,引入动态批处理算法大幅降低时间复杂度。研究采用代码分类和代码克隆检测两项代码理解下游任务进行评估,结果表明xASTNN在超越现有最优性能的同时,速度快于基线模型。

英文摘要:

The application of deep learning techniques in software engineering becomes increasingly popular. One key problem is developing high-quality and easy-to-use source code representations for code-related tasks. The research community has acquired impressive results in recent years. However, due to the deployment difficulties and performance bottlenecks, seldom these approaches are applied to the industry. In this paper, we present xASTNN, an eXtreme Abstract Syntax Tree (AST)-based Neural Network for source code representation, aiming to push this technique to industrial practice. The proposed xASTNN has three advantages. First, xASTNN is completely based on widely-used ASTs and does not require complicated data pre-processing, making it applicable to various programming languages and practical scenarios. Second, three closely-related designs are proposed to guarantee the effectiveness of xASTNN, including statement subtree sequence for code naturalness, gated recursive unit for syntactical information, and gated recurrent unit for sequential information. Third, a dynamic batching algorithm is introduced to significantly reduce the time complexity of xASTNN. Two code comprehension downstream tasks, code classification and code clone detection, are adopted for evaluation. The results demonstrate that our xASTNN can improve the state-of-the-art while being faster than the baselines.

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

↑