Semantic Similarity Loss for Neural Source Code Summarization
Chia-Yi Su, Collin McMillan

TL;DR
This paper introduces a semantic similarity-based loss function for neural source code summarization, improving over traditional word-level loss by evaluating entire sentence similarity and combining it with cross-entropy.
Contribution
It proposes a novel semantic similarity loss function for code summarization that considers whole sentence meaning and enhances training effectiveness.
Findings
Improved summary quality in most evaluation settings.
Semantic similarity loss outperforms traditional cross-entropy loss.
Combining semantic similarity with cross-entropy streamlines training.
Abstract
This paper presents a procedure for and evaluation of using a semantic similarity metric as a loss function for neural source code summarization. Code summarization is the task of writing natural language descriptions of source code. Neural code summarization refers to automated techniques for generating these descriptions using neural networks. Almost all current approaches involve neural networks as either standalone models or as part of a pretrained large language models e.g., GPT, Codex, LLaMA. Yet almost all also use a categorical cross-entropy (CCE) loss function for network optimization. Two problems with CCE are that 1) it computes loss over each word prediction one-at-a-time, rather than evaluating a whole sentence, and 2) it requires a perfect prediction, leaving no room for partial credit for synonyms. In this paper, we extend our previous work on semantic similarity metrics…
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
TopicsTopic Modeling · Natural Language Processing Techniques · Computational Physics and Python Applications
MethodsRefunds@Expedia|||How do I get a full refund from Expedia? · Multi-Head Attention · Attention Is All You Need · Discriminative Fine-Tuning · Adam · Softmax · Cosine Annealing · Layer Normalization · Linear Layer · Residual Connection
