mlsanityData to 14 Oct 2026

Semantic Similarity Loss for Neural Source Code Summarization

arXiv 2308.07429 ↗First posted 14 Aug 2023cs.SE cs.AIcited by 5

Not on the map. Why?

Abstract (arXiv)

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 to show a procedure for using semantic similarity as a loss function to alleviate this problem, and we evaluate this procedure in several settings in both metrics-driven and human studies. In essence, we propose to use a semantic similarity metric to calculate loss over the whole output sentence prediction per training batch, rather than just loss for each word. We also propose to combine our loss with CCE for each word, which streamlines the training process compared to baselines. We evaluate our approach over several baselines and report improvement in the vast majority of conditions.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 40 of its 81 references that are in the map. First posted on arXiv 14 Aug 2023.

Builds on

40 of 81 references.

References · 40

  1. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  2. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  3. 2016Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translationcited by 1,475
  4. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  5. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  6. 2015Sequence Level Training with Recurrent Neural Networkscited by 576
  7. 2018Universal Sentence Encodercited by 489
  8. 2022A Systematic Evaluation of Large Language Models of Codecited by 363
  9. 2018code2vec: Learning Distributed Representations of Codecited by 250
  10. 2023Pretraining Language Models with Human Preferencescited by 247
  11. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
  12. 2020A Transformer-based Approach for Source Code Summarizationcited by 133
28 more
  1. 2022Few-shot training LLMs for project-specific code-summarizationcited by 129
  2. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
  3. 2023The Programmer's Assistant: Conversational Interaction with a Large Language Model for Software Developmentcited by 96
  4. 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNNcited by 89
  5. 2019Beyond BLEU: Training Neural Machine Translation with Semantic Similaritycited by 84
  6. 2022Experiences from Using Code Explanations Generated by Large Language Models in a Web Software Development E-Bookcited by 84
  7. 2020Improved Code Summarization via a Graph Neural Networkcited by 79
  8. 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 77
  9. 2018Multi-Reward Reinforced Summarization with Saliency and Entailmentcited by 73
  10. 2023Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learningcited by 72
  11. 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
  12. 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
  13. 2019Recommendations for Datasets for Source Code Summarizationcited by 46
  14. 2017ParaNMT-50M: Pushing the Limits of Paraphrastic Sentence Embeddings with Millions of Machine Translationscited by 44
  15. 2022Automatic Code Documentation Generation Using GPT-3cited by 37
  16. 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
  17. 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
  18. 2021Code Structure Guided Transformer for Source Code Summarizationcited by 30
  19. 2021Project-Level Encoding for Neural Source Code Summarization of Subroutinescited by 24
  20. 2022Are We Building on the Rock? On the Importance of Data Preprocessing for Code Summarizationcited by 22
  21. 2020A Multi-Perspective Architecture for Semantic Code Searchcited by 20
  22. 2022Assemble Foundation Models for Automatic Code Summarizationcited by 17
  23. 2019A Survey of Automatic Generation of Source Code Comments: Algorithms and Techniquescited by 15
  24. 2022Semantic Similarity Metrics for Evaluating Source Code Summarizationcited by 14
  25. 2021Action Word Prediction for Neural Source Code Summarizationcited by 11
  26. 2023A Language Model of Java Methods with Train/Test Deduplicationcited by 7
  27. 2022A Decade of Code Comment Quality Assessment: A Systematic Literature Reviewcited by 5
  28. 2023Autonomy Is An Acquired Taste: Exploring Developer Preferences for GitHub Botscited by 4

Built on by

Cited by year

Citing papers per year: 2023: 2; 2024: 0; 2025: 3.

5 papers.