Alessandro Manera
AI-based Automatic Generated Comments of Source Code.
Rel. Antonio Vetro', Giacomo Fantino. Politecnico di Torino, Master of science program in Computer Engineering, 2025
|
Preview |
PDF (Tesi_di_laurea)
- Thesis
Licence: Creative Commons Attribution Non-commercial No Derivatives. Download (4MB) | Preview |
Abstract
Automatic code comment generation aims to produce concise natural language summaries that describe the functionality and intent of source code. Recent transformer-based models such as CodeBERT have demonstrated strong performance on this task through large-scale pretraining on code–text pairs. However, traditional supervised fine-tuning often fails to capture deeper semantic relationships within source code, leading to comments that are grammatically correct but semantically shallow. The study investigates whether contrastive fine-tuning of the CodeBERT encoder can enhance its downstream capability for comment generation. Two contrastive strategies are explored: a code–code alignment, based on semantically equivalent code snippets, and a code–diff alignment, based on fine-grained code edits from version control systems.
The resulting encoders are integrated into encoder–decoder architectures and trained on Python data from the CodeSearchNet and Python State Changes datasets
Relators
Academic year
Publication type
Number of Pages
Course of studies
Classe di laurea
Aziende collaboratrici
URI
![]() |
Modify record (reserved for operators) |
