arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.13350cs.AIcs.SE
收藏

基于跨语言中间表示的神经符号零样本代码克隆

Neuro-symbolic Zero-Shot Code Cloning with Cross-Language Intermediate Representation

TCS Research(塔塔咨询服务公司研究院)

Krishnam Hasija, Shrishti Pradhan, Manasi Patwardhan, Raveendra Kumar Medicherla, Lovekesh Vig, Ravindra Naik

AI总结:

提出共享 C/COBOL AST 中间表示并以 SBT 微调 UnixCoder 的神经符号方法,实现无 COBOL 训练数据的零样本代码克隆,MAP@2 提升 12.85。

摘要:

本文提出一种神经符号方法,用于在没有训练数据的情况下,为遗留编程语言 COBOL 的代码查找语义相似的克隆。我们定义了一个元模型,将其实例化为以抽象语法树(AST)形式呈现的中间表示(IR),该表示在 C 和 COBOL 代码之间通用。我们使用基于结构的遍历(SBT)将 IR 线性化,以生成序列输入。我们进一步利用 CodeNet 数据集中可用的 C 代码对的 SBT IR,针对代码克隆任务微调 UnixCoder——零样本跨编程语言代码搜索中性能最佳的模型。这使我们能够学习 C 代码 IR 的潜在表示,并将其迁移到 COBOL 代码的 IR。在由 CodeNet 数据集合成的 COBOL 测试划分上,使用该微调后的 UnixCoder,在零样本设置下相比预训练 UniXCoder 模型取得了 12.85 MAP@2 的性能提升。这证明了我们基于元模型的方法在促进跨编程语言迁移方面的有效性。

英文摘要:

In this paper, we define a neuro-symbolic approach to address the task of finding semantically similar clones for the codes of the legacy programming language COBOL, without training data. We define a meta-model that is instantiated to have an Intermediate Representation (IR) in the form of Abstract Syntax Trees (ASTs) common across codes in C and COBOL. We linearize the IRs using Structure Based Traversal (SBT) to create sequential inputs. We further fine-tune UnixCoder, the best-performing model for zero-shot cross-programming language code search, for the Code Cloning task with the SBT IRs of C code-pairs, available in the CodeNet dataset. This allows us to learn latent representations for the IRs of the C codes, which are transferable to the IRs of the COBOL codes. With this fine-tuned UnixCoder, we get a performance improvement of 12.85 MAP@2 over the pre-trained UniXCoder model, in a zero-shot setting, on the COBOL test split synthesized from the CodeNet dataset. This demonstrates the efficacy of our meta-model based approach to facilitate cross-programming language transfer.

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

↑