REINFOREST:增强跨语言代码搜索模型的语义代码相似性
REINFOREST: Reinforcing Semantic Code Similarity for Cross-Lingual Code Search Models
AI总结:
本文提出 REINFOREST,通过融合静态与动态特征及正负参考样本训练 LLM,实现无需推理期执行代码的跨语言代码搜索,并最高领先现有工具 44.7%。
摘要:
本文介绍了一种新颖的代码到代码搜索技术,通过同时纳入静态与动态特征,并在训练期间利用相似与不相似样本来提升大型语言模型(LLM)的性能。我们提出了首个在训练过程中编码动态运行时信息的代码搜索方法,该方法在推理时既不需要执行待搜索代码库,也不需要执行搜索查询;同时,这也是首个同时使用正参考样本和负参考样本进行训练的代码搜索技术。为验证该方法的有效性,我们开展了一系列研究,展示增强后的 LLM 执行跨语言代码到代码搜索的能力。评估表明,该方法的有效性在多种模型架构和编程语言之间保持一致。我们相比最先进的跨语言搜索工具最高提升 44.7%。此外,消融研究显示,即使在训练过程中仅加入一个正参考样本和一个负参考样本,也会带来显著的性能提升,证明相似与不相似参考都是代码搜索的重要组成部分。重要的是,我们表明,经过增强且精心微调的模型始终优于经过增强但未微调的更大规模现代 LLM;即使增强的是当前可用的最大 LLM,这一结论依然成立,从而凸显了开源模型的重要性。为确保研究的可复现性和可扩展性,我们公开了名为 REINFOREST 的工具及训练流程的开源实现。
英文摘要:
This paper introduces a novel code-to-code search technique that enhances the performance of Large Language Models (LLMs) by including both static and dynamic features as well as utilizing both similar and dissimilar examples during training. We present the first-ever code search method that encodes dynamic runtime information during training without the need to execute either the corpus under search or the search query at inference time and the first code search technique that trains on both positive and negative reference samples. To validate the efficacy of our approach, we perform a set of studies demonstrating the capability of enhanced LLMs to perform cross-language code-to-code search. Our evaluation demonstrates that the effectiveness of our approach is consistent across various model architectures and programming languages. We outperform the state-of-the-art cross-language search tool by up to 44.7\%. Moreover, our ablation studies reveal that even a single positive and negative reference sample in the training process results in substantial performance improvements demonstrating both similar and dissimilar references are important parts of code search. Importantly, we show that enhanced well-crafted, fine-tuned models consistently outperform enhanced larger modern LLMs without fine tuning, even when enhancing the largest available LLMs highlighting the importance for open-sourced models. To ensure the reproducibility and extensibility of our research, we present an open-sourced implementation of our tool and training procedures called REINFOREST.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。