用于代码搜索的自监督查询重构
Self-Supervised Query Reformulation for Code Search
AI总结:
针对代码搜索中查询重构依赖未公开平行语料库的问题,提出自监督方法 SSQR,通过扩展 T5 并引入损坏查询补全预训练目标,在无标注语料上学习扩展查询,显著优于无监督基线并媲美有监督方法。
摘要:
自动查询重构是一项广泛使用的技术,用于丰富用户需求并提升代码搜索的结果。它可以被概念化为一个机器翻译任务,其目标是将给定的查询重述为一个更全面的替代查询。虽然该方法展现出了令人鼓舞的结果,但训练此类模型通常需要一个庞大的查询对平行语料库(即原始查询和重构后的查询),而这些语料库属于机密且未被在线代码搜索引擎公开。这限制了它在软件开发过程中的实用性。在本文中,我们提出了 SSQR,这是一种不依赖任何平行查询语料库的自监督查询重构方法。受预训练模型启发,SSQR 将查询重构视为在大量无标注查询语料库上执行的掩码语言建模任务。SSQR 扩展了 T5(一种基于 Transformer 的序列到序列模型),引入了名为损坏查询补全(CQC)的新预训练目标,该目标会随机掩码完整查询中的词,并训练 T5 预测被掩码的内容。随后,对于给定的待重构查询,SSQR 识别适合扩展的潜在位置,并利用预训练的 T5 模型生成适当的内容来填补这些空白。扩展的选择随后基于与每个候选相关的信息增益。评估结果表明,SSQR 显著优于无监督基线方法,并且与有监督方法相比取得了具有竞争力的性能。
英文摘要:
Automatic query reformulation is a widely utilized technology for enriching user requirements and enhancing the outcomes of code search. It can be conceptualized as a machine translation task, wherein the objective is to rephrase a given query into a more comprehensive alternative. While showing promising results, training such a model typically requires a large parallel corpus of query pairs (i.e., the original query and a reformulated query) that are confidential and unpublished by online code search engines. This restricts its practicality in software development processes. In this paper, we propose SSQR, a self-supervised query reformulation method that does not rely on any parallel query corpus. Inspired by pre-trained models, SSQR treats query reformulation as a masked language modeling task conducted on an extensive unannotated corpus of queries. SSQR extends T5 (a sequence-to-sequence model based on Transformer) with a new pre-training objective named corrupted query completion (CQC), which randomly masks words within a complete query and trains T5 to predict the masked content. Subsequently, for a given query to be reformulated, SSQR identifies potential locations for expansion and leverages the pre-trained T5 model to generate appropriate content to fill these gaps. The selection of expansions is then based on the information gain associated with each candidate. Evaluation results demonstrate that SSQR outperforms unsupervised baselines significantly and achieves competitive performance compared to supervised methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。