Abstract
The semantic code search is to find code snippets from the collection of candidate code snippets with respect to a user query that describes functionality. Recent work on code search proposes data augmentation of queries for contrastive learning. This data augmentation approach modifies random words in queries. When a user web query for searching code snippet is too brief, the important word that represents the search intent of the query could be undesirably modified. A code snippet has informative components such as function name and documentation that describe its functionality. We propose to utilize these code components to identify important words and preserve them in the data augmentation step. We present KeyDAC (Keyword-based Data Augmentation for Contrastive learning) that identifies important words for code search from queries and code components based on term matching. KeyDAC augments query-code pairs while preserving keywords, and then leverages generated training instances for contrastive learning. We use KeyDAC to fine-tune various pre-trained language models and evaluate the performance of code search and code question answering via CoSQA and WebQueryTest. The experimental results confirm that KeyDAC substantially outperforms the current state-of-the-art performance, and achieves the new state-of-the-arts for both tasks.
Original language | English |
---|---|
Title of host publication | EACL 2023 - 17th Conference of the European Chapter of the Association for Computational Linguistics, Proceedings of the Conference |
Publisher | Association for Computational Linguistics (ACL) |
Pages | 3591-3601 |
Number of pages | 11 |
ISBN (Electronic) | 9781959429449 |
Publication status | Published - 2023 |
Event | 17th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2023 - Dubrovnik, Croatia Duration: 2023 May 2 → 2023 May 6 |
Publication series
Name | EACL 2023 - 17th Conference of the European Chapter of the Association for Computational Linguistics, Proceedings of the Conference |
---|
Conference
Conference | 17th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2023 |
---|---|
Country/Territory | Croatia |
City | Dubrovnik |
Period | 23/5/2 → 23/5/6 |
Bibliographical note
Publisher Copyright:© 2023 Association for Computational Linguistics.
All Science Journal Classification (ASJC) codes
- Computational Theory and Mathematics
- Software
- Linguistics and Language