arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2606.21647cs.SE
收藏

ConcernBERT: 利用类成员关系学习职责

ConcernBERT: Learning Responsibilities Using Class Membership

J. Lefever, J. Xu, Y. Cai, R. Kazman, E. Pisch

AI总结:

提出ConcernBERT模型,基于BERT和三元组损失,利用类成员上下文学习实体嵌入,以识别共同职责的实体组,在类成员恢复任务上显著优于现有模型。

摘要:

关注分离、高内聚和单一职责原则是软件设计中最著名的原则之一。然而,它们的应用往往停留在哲学层面而非可操作层面,严重依赖开发者的直觉和经验。许多软件任务,如上帝类分解、提取类重构和内聚度量,都依赖于识别程序实体内聚组的技术,即共同履行某一职责的实体组。然而,可靠地识别这些组仍然是一个挑战。在本文中,我们提出了ConcernBERT,一个基于BERT的实体级嵌入模型,使用三元组损失直接优化方法和属性在嵌入空间中的相对位置,并利用类成员上下文来学习职责和关注点。我们还贡献了一个用于训练和评估的大规模复制数据集。我们的数据集涵盖超过六千个仓库中的两百万个Java文件。为了评估ConcernBERT,我们将两个或多个类的方法合并到未标记的组中,并测试模型恢复原始类成员关系的能力。ConcernBERT的性能显著高于现有模型,证明了其在编码关注点级语义方面的有效性,并为架构恢复、提取类重构和内聚度量等下游任务奠定了坚实基础。

英文摘要:

The principles of separation of concerns, high cohesion, and single responsibility are among the most well-known in software design. However, their application often remains philosophical rather than actionable, relying heavily on developers' intuition and experience. Many software tasks, such as god class decomposition, extract class refactoring, and cohesion measurement, depend on techniques for identifying cohesive groups of program entities, that is, entities that collectively fulfill a common responsibility. Yet reliably identifying such groups remains a challenge. In this paper, we propose ConcernBERT, a BERT-based embedding model trained at the entity level that uses triplet loss to directly optimize the relative positioning of methods and attributes in the embedding space, and uses class-membership context to learn responsibilities and concerns. We also contribute a large-scale replication dataset for training and evaluation. Our dataset spans over two million Java files across more than six thousand repositories. To evaluate ConcernBERT, we merge methods from two or more classes into unlabeled groups and test the model's ability to recover the original class memberships. ConcernBERT achieves significantly higher performance than existing models, demonstrating its effectiveness at encoding concern-level semantics and establishing a strong foundation for downstream tasks such as architecture recovery, extract class refactoring, and cohesion measurement.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑