GRAPHiC: Utilizing Graph Structures and Class Weights in Code Comment Classification with Pretrained BERT Models

Pir Sami Ullah Shah, Shahela Saif, Muhammad Haris Athar, Muhammad Riyaan Tariq, Abdur Rehman Afzal · 2025

Source code comments are an essential part of the software development process, and the classification of these comments into relevant categories is crucial for code mainte-nance. For this problem, we present GRAPHiC, a set of classifiers designed for multi-label classification of source code comments in Java, Python, and Pharo. As part of GRAPHiC, we train three separate classifiers on the NLBSE Code Comment Classification dataset, using GraphCodeBERT and incorporate class weights to address dataset imbalance. The classifiers achieve an average F1 score of 0.71, outperforming the SetFit baseline score of 0.63 by 12%. This paper highlights the effectiveness of GraphCodeBERT for code comment classification and explores areas for further research. The models and training code are publicly available to facilitate replication and further experimentation.

Read the paper · More papers on PaperTik