一句话:提出元迁移学习方法,将轻量微调融入元学习,用于低资源项目特定代码摘要生成。
代码摘要旨在为代码片段生成自然语言描述,帮助开发者理解代码并减轻文档负担。现有神经模型多在大规模多项目独立代码-摘要对上训练和评估,在具体项目上的效果鲜有探索。实际中开发者更关心自己项目的摘要质量,但项目往往缺乏文档和历史代码-摘要对。为此,论文研究低资源项目特定代码摘要任务。为在有限训练样本下刻画项目特定知识,提出一种元迁移学习方法,将轻量微调机制融入元学习框架。在九个真实项目上的实验验证了该方法优于其他方法,并揭示了项目特定知识的学习方式。
Code summarization generates brief natural language descriptions of source code pieces, which can assist developers in understanding code and reduce documentation workload. Recent neural models on code summarization are trained and evaluated on large-scale multi-project datasets consisting of independent code-summary pairs. Despite the technical advances, their effectiveness on a specific project is rarely explored. In practical scenarios, however, developers are more concerned with generating high-quality summaries for their working projects. And these projects may not maintain sufficient documentation, hence having few historical code-summary pairs. To this end, we investigate low-resource project-specific code summarization, a novel task more consistent with the developers’ requirements. To better characterize project-specific knowledge with limited training samples, we propose a meta transfer learning method by incorporating a lightweight fine-tuning mechanism into a meta-learning framework. Experimental results on nine real-world projects verify the superiority of our method over alternative ones and reveal how the project-specific knowledge is learned.