要約
コード検索は、自然言語クエリの意味的に関連するコードスニペットを取得することを目的としています。
事前に訓練された言語モデル(PLMS)はこのタスクで顕著なパフォーマンスを示していますが、クロスドメインのシナリオで苦労しており、多くの場合、ゼロショット設定でコストのかかる微調整または向上パフォーマンスの低下が必要です。
モデル微調整の合成データを生成するRapidは、現在、ゼロショットクロスドメインコード検索の唯一の効果的な方法です。
その有効性にもかかわらず、迅速な要求は微調整にかなりの計算リソースを要求し、各ドメインの特殊なモデルを維持する必要があります。
ゼロショットクロスドメインコード検索に取り組むための鍵は、ドメイン間のギャップを埋めることにあります。
この作業では、クエリコード検索のクエリコードマッチングプロセスを2つの簡単なタスクに分割することを提案します:クエリコームメントマッチングとコードコードマッチング。
私たちの経験的研究は、ゼロショットクロスドメイン設定の3つのマッチングスキーマの間の強い相補性、つまりクエリコード、クエリコメント、およびコードコードマッチングを明らかにしています。
調査結果に基づいて、クロスドメインコード検索のためのゼロショットで微調整されていないアプローチであるCodeBridgeを提案します。
具体的には、CodeBridgeは大規模な言語モデル(LLM)を使用してコメントと擬似コードを生成し、PLMベースの類似性スコアリングとサンプリングベースの融合を介してクエリコード、クエリコメント、およびコードコードマッチングを組み合わせます。
実験結果は、私たちのアプローチが、最先端のPLMベースのコード検索アプローチ、つまりCocosodaとUnixCoderをそれぞれ3つのデータセットで平均21.4%および24.9%上回ることを示しています。
また、私たちのアプローチは、コストのかかる微調整が必要なゼロショットクロスドメインコード検索アプローチの結果よりも優れている、または等しい結果と同等の結果をもたらします。
要約(オリジナル)
Code search aims to retrieve semantically relevant code snippets for natural language queries. While pre-trained language models (PLMs) have shown remarkable performance in this task, they struggle in cross-domain scenarios, often requiring costly fine-tuning or facing performance drops in zero-shot settings. RAPID, which generates synthetic data for model fine-tuning, is currently the only effective method for zero-shot cross-domain code search. Despite its effectiveness, RAPID demands substantial computational resources for fine-tuning and needs to maintain specialized models for each domain, underscoring the need for a zero-shot, fine-tuning-free approach for cross-domain code search. The key to tackling zero-shot cross-domain code search lies in bridging the gaps among domains. In this work, we propose to break the query-code matching process of code search into two simpler tasks: query-comment matching and code-code matching. Our empirical study reveals the strong complementarity among the three matching schemas in zero-shot cross-domain settings, i.e., query-code, query-comment, and code-code matching. Based on the findings, we propose CodeBridge, a zero-shot, fine-tuning-free approach for cross-domain code search. Specifically, CodeBridge uses Large Language Models (LLMs) to generate comments and pseudo-code, then combines query-code, query-comment, and code-code matching via PLM-based similarity scoring and sampling-based fusion. Experimental results show that our approach outperforms the state-of-the-art PLM-based code search approaches, i.e., CoCoSoDa and UniXcoder, by an average of 21.4% and 24.9% in MRR, respectively, across three datasets. Our approach also yields results that are better than or comparable to those of the zero-shot cross-domain code search approach RAPID, which requires costly fine-tuning.
arxiv情報
著者 | Keyu Liang,Zhongxin Liu,Chao Liu,Zhiyuan Wan,David Lo,Xiaohu Yang |
発行日 | 2025-04-10 13:36:37+00:00 |
arxivサイト | arxiv_id(pdf) |
提供元, 利用サービス
arxiv.jp, Google