Optimizing Deep Learning Models to Address Class Imbalance in Code Comment Classification
Moritz Mock, Thomas Borsani, Giuseppe Di Fatta, Barbara Russo

TL;DR
This paper improves code comment classification by fine-tuning RoBERTa models with loss weighting strategies to handle class imbalance, achieving significant performance gains over baseline methods.
Contribution
It introduces loss weighting strategies in transformer fine-tuning to effectively address class imbalance in code comment classification tasks.
Findings
Outperforms baseline by 8.9% in F1 score
Achieves improvements in 17 out of 19 cases
Demonstrates effectiveness of loss weighting strategies
Abstract
Developers rely on code comments to document their work, track issues, and understand the source code. As such, comments provide valuable insights into developers' understanding of their code and describe their various intentions in writing the surrounding code. Recent research leverages natural language processing and deep learning to classify comments based on developers' intentions. However, such labelled data are often imbalanced, causing learning models to perform poorly. This work investigates the use of different weighting strategies of the loss function to mitigate the scarcity of certain classes in the dataset. In particular, various RoBERTa-based transformer models are fine-tuned by means of a hyperparameter search to identify their optimal parameter configurations. Additionally, we fine-tuned the transformers with different weighting strategies for the loss function to…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsWeb Application Security Vulnerabilities · Natural Language Processing Techniques
