Build a Dataset of Query-Code Pairs Based on CodeSearchNet for Code Search (S)
CodeSearchNet is a widely used dataset of commentcode pairs for training code search models.However, code search models trained on the datasets of comment-code pairs usually have lower performance in real-world applications because of the semantic gap between comments and real queries.The existing datasets of query-code pairs are smaller in size and lower in quality than CodeSearchNet for code search research.In this paper, we build a Python dataset of query-code pairs, named QCSN, from CodeSearchNet using a text generator.We train the text generator by fine-tuning the pre-trained model PLBART on StaQC's query-code pairs.To address the issue of domain shift between StaQC and CodeSearchNet, we exploit a deep adversarial neural network that trains a feature extractor to extract domain-invariant features.The experimental results show that the MRR of the typical code search model trained on QCSN improves by over 18.5%.The ablation study indicates that the deep adversarial neural network module improves the quality of the generated dataset.Further evaluations reveal that the generated queries closely match the real queries in terms of lexical overlap and semantic similarity, accurately expressing the functionality of the source code.
Authors
- Yang Xu (ORCID: https://orcid.org/0009-0008-6473-8529)
- Chao‐Wei Chen (ORCID: https://orcid.org/0009-0005-8864-8067)
Publication Details
- Journal
- Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering
- Published
- 2024-10-28
- DOI
- https://doi.org/10.18293/seke2024-094
- Primary Topic
- Software Testing and Debugging Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00