Semantic similarity metrics for evaluating source code summarization
Open accessThe DOI matches its Crossref record; 59 of the 59 references it cites were found in a registry or an index.
Abstract
Source code summarization involves creating brief descriptions of source code in natural language. These descriptions are a key component of software documentation such as JavaDocs. Automatic code summarization is a prized target of software engineering research, due to the high value summaries have to programmers and the simultaneously high cost of writing and maintaining documentation by hand. Current work is almost all based on machine models trained via big data input. Large datasets of examples of code and summaries of that code are used to train an e.g. encoder-decoder neural model. Then the output predictions of the model are evaluated against a set of reference summaries. The input is code not seen by the model, and the prediction is compared to a reference. The means by which a prediction is compared to a reference is essentially word overlap, calculated via a metric such as BLEU or ROUGE. The problem with using word overlap is that not all words in a sentence have the same importance, and many words have synonyms. The result is that calculated similarity may not match the perceived similarity by human readers. In this paper, we conduct an experiment to measure the degree to which various word overlap metrics correlate to human-rated similarity of predicted and reference summaries. We evaluate alternatives based on current work in semantic similarity metrics and propose recommendations for evaluation of source code summarization.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
In the citing paper
“Other proposed metrics such as BERTScore [28,70], BLEURT [58], NU-BIA [37], are computationally expensive, not widely used and thus not readily comparable with prior work for benchmarking.”
From Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization) (2024) · cites this paper as [28]
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017) · arXiv · doi:10.48550/arxiv.1706.03762 · Cited by 120,404 · cited 1×
“Universal sentence encoder [65] encodes text into high dimensional vectors using transformers [66].”
BackgroundBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2018) · arXiv · doi:10.48550/arxiv.1810.04805 · Cited by 73,173 · cited 7×
“Similar to the model we use in BertScore, SentenceBert uses RoBERTa to generate embeddings for the words in a sentence.”
MethodInfluentialThree Approaches to Qualitative Content Analysis
Hsieh, H.-F., & Shannon, S. E. (2005) · Qualitative Health Research · doi:10.1177/1049732305276687 · Cited by 44,601 · cited 1×
“Usually the term “reliability” refers to how consistent the ratings given by different people are [42, 43].”
BackgroundGlove: Global Vectors for Word Representation
Pennington, J., Socher, R., & Manning, C. (2014) · Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) · doi:10.3115/v1/d14-1162 · Cited by 34,071 · cited 2×
“A word embedding is a fixed-length representation of words in a vector space [57] [58].”
BackgroundMethodEfficient Estimation of Word Representations in Vector Space
Mikolov, T., Chen, K., Corrado, G., & Dean, J. (2013) · arXiv · doi:10.48550/arxiv.1301.3781 · Cited by 26,568 · cited 2×
“A word embedding is a fixed-length representation of words in a vector space [57] [58].”
BackgroundLearning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation
Cho, K., van Merrienboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., & Bengio, Y. (2014) · Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) · doi:10.3115/v1/d14-1179 · Cited by 25,545 · cited 3×
“Both the encoder and decoder layers of the at-tendgru model uses a GRU [68] to encode the text.”
MethodInfluentialBLEU: a method for automatic evaluation of machine translation
Papineni, K., Roukos, S., Ward, T., & Zhu, W.-J. (2001) · Proceedings of the 40th Annual Meeting on Association for Computational Linguistics - ACL '02 · doi:10.3115/1073083.1073135 · Cited by 21,344 · cited 3×
“By far the most popular metric for measuring word overlap in source code summarization research is BLEU [8].”
BackgroundRoBERTa: A Robustly Optimized BERT Pretraining Approach
Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., & Stoyanov, V. (2019) · arXiv · doi:10.48550/arxiv.1907.11692 · Cited by 16,515 · cited 2×
“For our experiment, we use the stsb-roberta-large pre-trained model [62].”
MethodSentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Reimers, N., & Gurevych, I. (2019) · Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP) · doi:10.18653/v1/d19-1410 · Cited by 12,778 · cited 2×
“Results from our experiments showed that the Sentence Bert Encoder (SentenceBert) [14] produced vectorized representations of the summaries that have the highest correlation to perceived similarity by the human experts in our experiment.”
MethodTerm-weighting approaches in automatic text retrieval
Salton, G., & Buckley, C. (1988) · Information Processing & Management · doi:10.1016/0306-4573(88)90021-0 · Cited by 9,740 · cited 1×
“Term frequency-inverse document frequency (tf-idf) reflects the importance of a word to the entire document [63] [64].”
Background
Research works printed but not linked: 11
- [3] D. Kramer, 'Api documentation from source code comments: a case study of javadoc,' in Proceedings of the 17th annual international conference on Computer documentation . ACM, 1999, pp. 147-153. -
- [4] A. Forward and T. C. Lethbridge, 'The relevance of software documentation, tools and technologies: a survey,' in Proceedings of the 2002 ACM symposium on Document engineering . ACM, 2002, pp. 26-33. -
- [13] D. Gros, H. Sezhiyan, P. Devanbu, and Z. Yu, 'Code to comment 'translation': Data, metrics, baselining evaluation,' in 2020 35th IEEE/ACM International Conference on Automated Software Engineering (ASE) , 2020, pp. 746-757. -
- [21] P. Rodeghero, C. McMillan, P. W. McBurney, N. Bosch, and S. D'Mello, 'Improving automated source code summarization via an eye-tracking study of programmers,' in Proceedings of the 36th international conference on Software engineering . ACM, 2014, pp. 390-401. -
- [22] S. Iyer, I. Konstas, A. Cheung, and L. Zettlemoyer, 'Summarizing source code using a neural attention model,' in Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) , 2016, pp. 2073-2083. -
- [25] U. Alon, S. Brody, O. Levy, and E. Yahav, 'code2seq: Generating sequences from structured representations of code,' International Conference on Learning Representations , 2019. -
- [26] U. Alon, M. Zilberstein, O. Levy, and E. Yahav, 'code2vec: Learning distributed representations of code,' Proceedings of the ACM on Programming Languages , vol. 3, no. POPL, pp. 1-29, 2019. -
- [34] E. Clark, A. Celikyilmaz, and N. A. Smith, 'Sentence mover's similarity: Automatic evaluation for multi-sentence texts,' in Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics , 2019, pp. 2748-2760. -
- [44] H. C. Kraemer, 'Kappa coefficient,' Wiley StatsRef: Statistics Reference Online , pp. 1-4, 2014. -
- [54] Y. Li, D. McLean, Z. A. Bandar, J. D. O'shea, and K. Crockett, 'Sentence similarity based on semantic nets and corpus statistics,' IEEE transactions on knowledge and data engineering , vol. 18, no. 8, pp. 1138-1150, 2006. -
- [70] C. P. Dancey and J. Reidy, Statistics without maths for psychology . Pearson education, 2007.
Cited by
Automated Grading and Feedback Tools for Programming Education: A Systematic Review
Messer, M., Brown, N. C. C., Kölling, M., & Shi, M. (2024) · ACM Transactions on Computing Education · doi:10.1145/3636515 · Cited by 262
Lee, J., Ahn, S., Kim, D., & Kim, D. (2024) · Automation in Construction · doi:10.1016/j.autcon.2024.105846 · Cited by 186
Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Models
Ahmed, T., Ghosh, S., Bansal, C., Zimmermann, T., Zhang, X., & Rajmohan, S. (2023) · 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE) · doi:10.1109/icse48619.2023.00149 · Cited by 148
Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)
Ahmed, T., Pai, K. S., Devanbu, P., & Barr, E. (2024) · Proceedings of the IEEE/ACM 46th International Conference on Software Engineering · doi:10.1145/3597503.3639183 · Cited by 112
“However, for up to 2% of the randomly chosen samples in each experiment, we didn’t get good results; either the prompt didn’t fit into the model’s 5 Please see Section 7 for the rationale. window, or the model mysteriously generated an empty string.”
BackgroundResultAnalysis of customer reviews with an improved VADER lexicon classifier
Barik, K., & Misra, S. (2024) · Journal Of Big Data · doi:10.1186/s40537-023-00861-x · Cited by 92
“The methods of computing the semantic similarity between two sentences used in this study are a) word vector similarity [46], b) WordNet similarity [46], and c) Word order similarity [47].”
Method
Metadata
- Authors
- Haque, S., Eberhart, Z., Bansal, A., & McMillan, C.
- Affiliations
- University of Notre Dame (US)
- Venue
- Proceedings of the 30th IEEE/ACM International Conference on Program Comprehension
- Publisher
- ACM
- Published
- 2022-05-16
- Pages
- 36-47
- OpenAlex
- W4313185449
- Cited by
- 116
- References
- 59
- Citations by year
- 2026: 13 · 2025: 42 · 2024: 40 · 2023: 20 · 2022: 1
- FWCI
- 23.02
- Type
- conference paper
- Language
- en
- Open access
- green
- arxiv.org
- Locations
- IEEE International Conference on Program Comprehension (ICPC) (publishedVersion)
- arXiv (Cornell University) (submittedVersion)
- arXiv (Cornell University)
- Funders
- NSF (CCF-2100035)
- Topics
- Physical Sciences › Computer Science › Information Systems › Software Engineering Research
- Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
- Physical Sciences › Computer Science › Artificial Intelligence › Natural Language Processing Techniques
- Keywords
- source code summarization, semantic similarity metrics, BLEU, ROUGE, synonymy (linguistics), software documentation
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
How to cite
Cite CoChat for the checks on this page, and the paper for its own findings.
- This page
- CoChat. (2026). Citation check: Semantic similarity metrics for evaluating source code summarization. https://app.cochat.ai/papers/10.1145/3524610.3527909
- The paper
- Haque, S., Eberhart, Z., Bansal, A., & McMillan, C. (2022). Semantic similarity metrics for evaluating source code summarization. Proceedings of the 30th IEEE/ACM International Conference on Program Comprehension. https://doi.org/10.1145/3524610.3527909
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.