利用对比学习增强提交分类
Boosting Commit Classification with Contrastive Learning
AI总结:
针对少样本提交分类依赖标注数据且忽视句子级语义的问题,提出基于伪标签增强和句子嵌入对比学习的CommitFit框架,在两个公开数据集上达到SOTA性能。
摘要:
提交分类(Commit Classification,CC)是软件维护中的一项重要任务,它帮助软件开发人员根据代码变更的性质和目的将其分类为不同类型。它使开发人员能够更好地了解开发工作的进展情况,识别需要改进的领域,并就是何时以及如何发布新软件版本做出明智决策。然而,现有模型在微调过程中需要大量人工标注数据,并且忽略了句子级语义信息,而这类信息通常对于发现不同提交之间的差异至关重要。因此,在少样本场景下解决CC问题仍然具有挑战性。为解决上述问题,我们提出了一种基于对比学习的提交分类框架。首先,我们根据数据集标签生成K个句子和伪标签,旨在增强数据集。其次,我们将增强数据随机分组N次,以比较它们与正样本T_p^{|C|}和负样本T_n^{|C|}的相似性。我们利用独立的预训练句子转换器(sentence transformers,ST)分别高效地从不同特征中获取句子级嵌入。最后,我们采用余弦相似度函数约束向量分布,使相似向量更加邻近。随后,将轻量微调模型应用于新到提交的标签预测。在两个公开可用数据集上进行的大量实验表明,我们的框架能够在少样本场景下简单而有效地解决CC问题,同时达到最先进(SOTA)性能,并在不需要大量训练样本进行微调的情况下提升模型的适应性。代码、数据和经过训练的模型可在https://github.com/AppleMax1992/CommitFit获取。
英文摘要:
Commit Classification (CC) is an important task in software maintenance, which helps software developers classify code changes into different types according to their nature and purpose. It allows developers to understand better how their development efforts are progressing, identify areas where they need improvement, and make informed decisions about when and how to release new software versions. However, existing models need lots of manually labeled data for fine-tuning processes, and ignore sentence-level semantic information, which is often essential for discovering the difference between diverse commits. Therefore, it is still challenging to solve CC in fewshot scenario. To solve the above problems, we propose a contrastive learning-based commit classification framework. Firstly, we generate $K$ sentences and pseudo-labels according to the labels of the dataset, which aims to enhance the dataset. Secondly, we randomly group the augmented data $N$ times to compare their similarity with the positive $T_p^{|C|}$ and negative $T_n^{|C|}$ samples. We utilize individual pretrained sentence transformers (ST)s to efficiently obtain the sentence-level embeddings from different features respectively. Finally, we adopt the cosine similarity function to limit the distribution of vectors, similar vectors are more adjacent. The light fine-tuned model is then applied to the label prediction of incoming commits. Extensive experiments on two open available datasets demonstrate that our framework can solve the CC problem simply but effectively in fewshot scenarios, while achieving state-of-the-art(SOTA) performance and improving the adaptability of the model without requiring a large number of training samples for fine-tuning. The code, data, and trained models are available at https://github.com/AppleMax1992/CommitFit.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。