Adversarial Training for Code Retrieval with Question-Description Relevance Regularization

Jie Zhao, Huan Sun


Abstract
Code retrieval is a key task aiming to match natural and programming languages. In this work, we propose adversarial learning for code retrieval, that is regularized by question-description relevance. First, we adapt a simple adversarial learning technique to generate difficult code snippets given the input question, which can help the learning of code retrieval that faces bi-modal and data-scarce challenges. Second, we propose to leverage question-description relevance to regularize adversarial learning, such that a generated code snippet should contribute more to the code retrieval training loss, only if its paired natural language description is predicted to be less relevant to the user given question. Experiments on large-scale code retrieval datasets of two programming languages show that our adversarial learning method is able to improve the performance of state-of-the-art models. Moreover, using an additional duplicated question detection model to regularize adversarial learning further improves the performance, and this is more effective than using the duplicated questions in strong multi-task learning baselines.
Anthology ID:
2020.findings-emnlp.361
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2020
Month:
November
Year:
2020
Address:
Online
Editors:
Trevor Cohn, Yulan He, Yang Liu
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
4049–4059
Language:
URL:
https://aclanthology.org/2020.findings-emnlp.361
DOI:
10.18653/v1/2020.findings-emnlp.361
Bibkey:
Cite (ACL):
Jie Zhao and Huan Sun. 2020. Adversarial Training for Code Retrieval with Question-Description Relevance Regularization. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 4049–4059, Online. Association for Computational Linguistics.
Cite (Informal):
Adversarial Training for Code Retrieval with Question-Description Relevance Regularization (Zhao & Sun, Findings 2020)
Copy Citation:
PDF:
https://aclanthology.org/2020.findings-emnlp.361.pdf
Code
 jiez-osu/QQC