一句话:提出 BVAE,用两个联合训练的 VAE 在代码与自然语言间建立双向映射,以改进代码检索和摘要。
代码检索与摘要可帮助开发者复用散布于在线仓库中的代码,但源代码与自然语言描述之间存在语义鸿沟。本文提出神经框架 BVAE,通过两个变分自编码器 C-VAE 和 L-VAE 分别建模代码与自然语言,并联合训练以在尽可能重构输入的同时施加正则,使代码与描述的隐变量相互靠近,从而学习双向映射和语义向量表示,甚至为任意代码片段生成全新描述。作者针对检索和摘要分别设计 BVAE 的实例模型,在同时包含 C# 和 SQL 的基准上评估。实验表明 BVAE 在这两项任务上具有潜力。
Code retrieval and summarization are two tasks often employed by software developers to reuse code that spreads over online repositories. In this paper, we present a neural framework that allows bidirectional mapping between source code and natural language to improve these two tasks. Our framework, BVAE, is designed to have two Variational AutoEncoders (VAEs) to model bimodal data: C-VAE for source code and L-VAE for natural language. Both VAEs are trained jointly to reconstruct their input as much as possible with regularization that captures the closeness between the latent variables of code and description. BVAE could learn semantic vector representations for both code and description and generate completely new descriptions for arbitrary code snippets. We design two instance models of BVAE for retrieval and summarization tasks respectively and evaluate their performance on a benchmark which involves two programming languages: C# and SQL. Experiments demonstrate BVAE’s potential on the two tasks.
DOI 原文 ·
@inproceedings{paperbot4714,
title = {A neural framework for retrieval and summarization of source code},
author = {Qingying Chen and Minghui Zhou},
booktitle = {ASE},
year = {2018},
doi = {10.1145/3238147.3240471}
}