变分前缀调优用于基于预训练语言模型的多样且准确的代码摘要生成
Variational Prefix Tuning for Diverse and Accurate Code Summarization Using Pre-trained Language Models
AI总结:
提出变分前缀调优(VPT),结合条件变分自编码器与预训练模型,参数高效地生成多样且准确的代码摘要集,并通过双准则重排序优化选项,提升用户选择灵活性。
摘要:
近年来,源代码摘要生成领域的进展利用了基于Transformer的预训练模型,包括代码大语言模型(LLMCs),以自动化和改进代码摘要的生成。然而,现有方法通常侧重于为给定源代码生成单一高质量摘要,忽略了生成的摘要可能不充分且需要替代方案的情况。在本文中,我们引入了变分前缀调优(VPT),一种新颖的方法,增强预训练模型生成多样且准确摘要集的能力,允许用户为给定源代码选择最合适的摘要。我们的方法将条件变分自编码器(CVAE)框架作为模块化组件集成到预训练模型中,使我们能够对观察到的目标摘要分布进行建模,并采样连续嵌入作为前缀,以在解码过程中引导多样输出的生成。重要的是,我们以参数高效的方式构建我们的方法,消除了昂贵模型重训练的需要,尤其是在使用LLMCs时。此外,我们采用双准则重排序方法选择生成的摘要子集,优化提供给用户的选项的多样性和准确性。我们使用广泛使用的数据集和当前最先进的预训练代码摘要模型进行了广泛的实验评估,以证明我们方法的有效性及其在不同模型间的适应性。
英文摘要:
Recent advancements in source code summarization have leveraged transformer-based pre-trained models, including Large Language Models of Code (LLMCs), to automate and improve the generation of code summaries. However, existing methods often focus on generating a single high-quality summary for a given source code, neglecting scenarios where the generated summary might be inadequate and alternative options are needed. In this paper, we introduce Variational Prefix Tuning (VPT), a novel approach that enhances pre-trained models' ability to generate diverse yet accurate sets of summaries, allowing the user to choose the most suitable one for the given source code. Our method integrates a Conditional Variational Autoencoder (CVAE) framework as a modular component into pre-trained models, enabling us to model the distribution of observed target summaries and sample continuous embeddings to be used as prefixes to steer the generation of diverse outputs during decoding. Importantly, we construct our method in a parameter-efficient manner, eliminating the need for expensive model retraining, especially when using LLMCs. Furthermore, we employ a bi-criteria reranking method to select a subset of generated summaries, optimizing both the diversity and the accuracy of the options presented to users. We present extensive experimental evaluations using widely used datasets and current state-of-the-art pre-trained code summarization models to demonstrate the effectiveness of our approach and its adaptability across models.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。