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.
翻译:本文提出一种神经符号方法,以在无训练数据条件下解决遗留编程语言COBOL代码的语义相似克隆检测任务。我们定义了一个元模型,该模型实例化后生成以抽象语法树(AST)形式呈现的中间表示(IR),该表示在C和COBOL代码间具有通用性。采用基于结构的遍历(SBT)方法对中间表示进行线性化处理,生成序列化输入。进一步对UniXCoder(当前零样本跨编程语言代码搜索性能最优模型)进行微调,使其针对CodeNet数据集中C代码对的SBT中间表示执行代码克隆任务。通过此过程,我们学习到C代码中间表示的潜在表示特征,该特征可迁移至COBOL代码的中间表示。基于微调后的UniXCoder,在从CodeNet数据集合成的COBOL测试集上,零样本场景下的MAP@2指标较预训练UniXCoder模型提升12.85%。这证明了基于元模型的方法在促进跨编程语言迁移学习方面的有效性。