Adversarial Training for Code Retrieval with Question-Description Relevance Regularization

Adversarial Training for Code Retrieval with Question-Description Relevance Regularization
复制标题

DOI:
10.18653/v1/2020.findings-emnlp.361
复制
发表时间:
2020-10
期刊:
--
影响因子:
--
通讯作者:
Jie Zhao;Huan Sun
Jie Zhao;Huan Sun
中科院分区:
其他
文献类型:
--
作者:
Jie Zhao;Huan Sun

文献摘要

相似文献

代码检索是实现自然语言和程序语言匹配的关键任务。在这项工作中,我们提出了用于代码检索的对抗学习,即通过问题描述相关性进行正则化。首先,我们采用了一种简单的对抗性学习技术,在给定输入问题的情况下生成困难的代码片段,这可以帮助学习面临双模态和数据稀缺挑战的代码检索。其次,我们建议利用问题描述相关性来规范对抗学习,这样生成的代码片段应该对代码检索训练损失做出更多贡献,只有当其配对的自然语言描述被预测为与用户给定的问题不太相关时。在两种编程语言的大规模代码检索数据集上的实验表明,我们的对抗性学习方法能够提高最先进模型的性能。此外,使用额外的重复问题检测模型来正则化对抗学习进一步提高了性能,这比在强多任务学习基线中使用重复问题更有效。
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.