Retrieval based code summarisation using code pre-trained models

Automatic code summarization has emerged as a valuable tool for enhancing software development speed and comprehension. In the context of source code summarization, where the goal is to generate concise and meaningful natural language summaries for given code snippets, pre-trained models have shown...

Full description

Saved in:
Bibliographic Details
Main Author: Gupta, Sahaj
Other Authors: Liu Yang
Format: Final Year Project
Language:English
Published: Nanyang Technological University 2024
Subjects:
Online Access:https://hdl.handle.net/10356/175679
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Nanyang Technological University
Language: English
Description
Summary:Automatic code summarization has emerged as a valuable tool for enhancing software development speed and comprehension. In the context of source code summarization, where the goal is to generate concise and meaningful natural language summaries for given code snippets, pre-trained models have shown significant promise. This task involves understanding the semantics of code and generating human-readable descriptions, making it particularly challenging. Attention mechanisms, inherent in many pre-trained models, have shown to be particularly useful for source code summarization. They allow models to focus on relevant parts of the code when generating summaries, improving the coherence and informativeness of the generated text. This project delves into the effectiveness of different code pre-trained language models for generating concise and informative summaries of source code. We focus on comparing our proposed retrieval-based framework against state-of-the- art models and baselines in CodeXGLUE. We fine-tune and evaluate CodeBERT, an encoder-only model pre-trained on massive code repositories, using our proposed method. We evaluate the performance of these models on benchmark datasets, considering metrics like BLEU-4 and perplexity to assess the quality of generated summaries compared to human references. Further, we also perform a token level analysis of the input data. We observe a comparable performance to the baseline models and an improvement of 0.81, 0.13 and 0.24 in BLEU-4 scores for the Javascript, Java and Go programming languages highlighting the effectiveness of our approach.