ConcernBERT: Learning Responsibilities Using Class Membership

📅 2026-06-19
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Reliably identifying highly cohesive groups of program entities that share common responsibilities is a key challenge in supporting software engineering tasks such as class splitting, refactoring, and cohesion measurement. This work proposes ConcernBERT, a BERT-based entity-level embedding model that, for the first time, incorporates class membership as a supervisory signal into a pretrained language model. By optimizing the relative positions of attributes in the embedding space using triplet loss, ConcernBERT explicitly models semantic software concerns. Experimental results on a large-scale Java dataset demonstrate that ConcernBERT significantly outperforms existing approaches in the task of recovering merged class methods, effectively capturing concern-level semantics and providing an actionable semantic foundation for downstream tasks such as architecture recovery and refactoring.
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

separation of concerns
cohesion
single responsibility
class decomposition
program entities
Innovation

Methods, ideas, or system contributions that make the work stand out.

ConcernBERT
triplet loss
class membership
software concerns
entity-level embedding
🔎 Similar Papers
No similar papers found.