Alessandro Manera
AI-based Automatic Generated Comments of Source Code.
Rel. Antonio Vetro', Giacomo Fantino. Politecnico di Torino, Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering), 2025
|
PDF (Tesi_di_laurea)
- Tesi
Licenza: 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. The objective is to improve the semantic fidelity and expressiveness of generated comments, demonstrating how contrastive representation learning can refine pretrained models for real-world software documentation tasks. |
|---|---|
| Relatori: | Antonio Vetro', Giacomo Fantino |
| Anno accademico: | 2025/26 |
| Tipo di pubblicazione: | Elettronica |
| Numero di pagine: | 39 |
| Soggetti: | |
| Corso di laurea: | Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering) |
| Classe di laurea: | Nuovo ordinamento > Laurea magistrale > LM-32 - INGEGNERIA INFORMATICA |
| Aziende collaboratrici: | Blue Reply Srl |
| URI: | http://webthesis.biblio.polito.it/id/eprint/38623 |
![]() |
Modifica (riservato agli operatori) |



Licenza Creative Commons - Attribuzione 3.0 Italia