一句话:提出首个面向代码搜索数据集的语义查询清洗框架,用规则与模型双重过滤数据,显著提升神经代码搜索性能。
神经代码搜索模型的性能严重依赖训练数据质量,但高质量“自然语言查询-代码”对稀缺,常用数据集多以代码注释等替代真实查询。作者对知名代码搜索数据集的实证分析发现,超过三分之一的查询含噪声,与真实用户查询语义偏离,导致模型在实际场景中性能下降。为此,论文提出一个数据清洗框架,包含基于规则的句法过滤器和基于模型的语义过滤器,据称是首个将语义查询清洗应用于代码搜索数据集的工作。实验在两种常用代码搜索模型和三个人工标注检索基准上评估;用过滤后数据训练 DeepCS 模型,在三个验证基准上平均提升 19.2% MRR 和 21.3% Answer@1。
The performance of neural code search is significantly influenced by the quality of the training data from which the neural models are derived. A large corpus of high-quality query and code pairs is demanded to establish a precise mapping from the natural language to the programming language. Due to the limited availability, most widely-used code search datasets are established with compromise, such as using code comments as a replacement of queries. Our empirical study on a famous code search dataset reveals that over one-third of its queries contain noises that make them deviate from natural user queries. Models trained through noisy data are faced with severe performance degradation when applied in real-world scenarios. To improve the dataset quality and make the queries of its samples semantically identical to real user queries is critical for the practical usability of neural code search. In this paper, we propose a data cleaning framework consisting of two subsequent filters: a rule-based syntactic filter and a model-based semantic filter. This is the first framework that applies semantic query cleaning to code search datasets. Experimentally, we evaluated the effectiveness of our framework on two widely-used code search models and three manually-annotated code retrieval benchmarks. Training the popular DeepCS model with the filtered dataset from our framework improves its performance by 19.2% MRR and 21.3% Answer@l, on average with the three validation benchmarks.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2202-06649,
title = {On the importance of building high-quality training datasets for neural code search},
author = {Zhensu Sun and Li Li and Yan Liu and Xiaoning Du and Li Li},
booktitle = {ICSE},
year = {2022},
doi = {10.1145/3510003.3510160}
}