arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2310.06342cs.SEcs.AI
收藏

基于交互矩阵的对比提示学习代码搜索

Contrastive Prompt Learning-based Code Search based on Interaction Matrix

Beihang University(北京航空航天大学);Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所)

Yubo Zhang, Yanfang Liu, Xinxin Fan, Yunfeng Lu

AI总结:

本文提出CPLCS,一种基于跨模态交互机制的对比提示学习代码搜索方法,通过对比学习、提示学习和交互机制解决语义表示不足与NL-PL语义鸿沟问题,实验验证了其有效性。

摘要:

代码搜索旨在检索与给定自然语言查询高度匹配的代码片段。近年来,许多代码预训练方法在代码搜索上展示了令人印象深刻的表现。然而,现有的代码搜索方法仍然面临两个性能限制:语义表示不足以及自然语言(NL)与编程语言(PL)之间的语义鸿沟。在本文中,我们提出了CPLCS,一种基于跨模态交互机制的对比提示学习代码搜索方法。CPLCS包括:(1)PL-NL对比学习,学习PL和NL表示之间的语义匹配关系;(2)针对双编码器结构的提示学习设计,以缓解语义表示不足的问题;(3)跨模态交互机制,以增强NL和PL之间的细粒度映射。我们在包含六种编程语言的真实世界数据集上进行了大量实验,以评估我们方法的有效性。实验结果证明了我们的方法在提高语义表示质量以及PL和NL之间映射能力方面的有效性。

英文摘要:

Code search aims to retrieve the code snippet that highly matches the given query described in natural language. Recently, many code pre-training approaches have demonstrated impressive performance on code search. However, existing code search methods still suffer from two performance constraints: inadequate semantic representation and the semantic gap between natural language (NL) and programming language (PL). In this paper, we propose CPLCS, a contrastive prompt learning-based code search method based on the cross-modal interaction mechanism. CPLCS comprises:(1) PL-NL contrastive learning, which learns the semantic matching relationship between PL and NL representations; (2) a prompt learning design for a dual-encoder structure that can alleviate the problem of inadequate semantic representation; (3) a cross-modal interaction mechanism to enhance the fine-grained mapping between NL and PL. We conduct extensive experiments to evaluate the effectiveness of our approach on a real-world dataset across six programming languages. The experiment results demonstrate the efficacy of our approach in improving semantic representation quality and mapping ability between PL and NL.

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

↑