Automatic Code Summarization via ChatGPT: How Far Are We?
Not on the map. Why?
Abstract (arXiv)
To support software developers in understanding and maintaining programs, various automatic code summarization techniques have been proposed to generate a concise natural language comment for a given code snippet. Recently, the emergence of large language models (LLMs) has led to a great boost in the performance of natural language processing tasks. Among them, ChatGPT is the most popular one which has attracted wide attention from the software engineering community. However, it still remains unclear how ChatGPT performs in (automatic) code summarization. Therefore, in this paper, we focus on evaluating ChatGPT on a widely-used Python dataset called CSN-Python and comparing it with several state-of-the-art (SOTA) code summarization models. Specifically, we first explore an appropriate prompt to guide ChatGPT to generate in-distribution comments. Then, we use such a prompt to ask ChatGPT to generate comments for all code snippets in the CSN-Python test set. We adopt three widely-used metrics (including BLEU, METEOR, and ROUGE-L) to measure the quality of the comments generated by ChatGPT and SOTA models (including NCS, CodeBERT, and CodeT5). The experimental results show that in terms of BLEU and ROUGE-L, ChatGPT's code summarization performance is significantly worse than all three SOTA models. We also present some cases and discuss the advantages and disadvantages of ChatGPT in code summarization. Based on the findings, we outline several open challenges and opportunities in ChatGPT-based code summarization.
Key facts. Cited by 34 papers in the map (data through 7 Oct 2026). Builds on 35 of its 68 references that are in the map. First posted on arXiv 22 May 2023.
Builds on
35 of 68 references.
References · 35
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2017Deep reinforcement learning from human preferencescited by 3,846
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2017Get To The Point: Summarization with Pointer-Generator Networkscited by 1,281
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2023A Multitask, Multilingual, Multimodal Evaluation of ChatGPT on Reasoning, Hallucination, and Interactivitycited by 888
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2023Is ChatGPT a General-Purpose Natural Language Processing Task Solver?cited by 486
23 more
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2023Self-collaboration Code Generation via ChatGPTcited by 255
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2020A Transformer-based Approach for Source Code Summarizationcited by 129
- 2023Exploring the Limits of ChatGPT for Query or Aspect-based Text Summarizationcited by 122
- 2023An Analysis of the Automatic Bug Fixing Performance of ChatGPTcited by 108
- 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 99
- 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 76
- 2023Is ChatGPT the Ultimate Programming Assistant -- How far is it?cited by 72
- 2021On the Evaluation of Neural Code Summarizationcited by 47
- 2019Retrieve and Refine: Exemplar-based Neural Comment Generationcited by 36
- 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
- 2020Code Summarization with Structure-induced Transformercited by 29
- 2019Automatic Source Code Summarization with Extended Tree-LSTMcited by 28
- 2020Code to Comment "Translation": Data, Metrics, Baselining & Evaluationcited by 28
- 2023A study on Prompt Design, Advantages and Limitations of ChatGPT for Deep Learning Program Repaircited by 26
- 2021Project-Level Encoding for Neural Source Code Summarization of Subroutinescited by 24
- 2021CoCoSum: Contextual Code Summarization with Multi-Relational Graph Neural Networkcited by 22
- 2021Improving Code Summarization with Block-wise Abstract Syntax Tree Splittingcited by 19
- 2021A Multi-Modal Transformer-based Code Summarization Approach for Smart Contractscited by 16
- 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 15
- 2022Source Code Summarization with Structural Relative Position Guided Transformercited by 14
- 2021API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentationscited by 10
Built on by
Citing papers per year: 2023: 8; 2024: 14; 2025: 8; 2026: 4.
34 papers.
Sort:
By area:
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024A Systematic Survey of Text Summarization: From Statistical Methods to Large Language Modelscited by 52
- 2023CodeScope: An Execution-based Multilingual Multitask Multidimensional Benchmark for Evaluating LLMs on Code Understanding and Generationcited by 39
- 2023Distilled GPT for Source Code Summarizationcited by 30
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2023The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Modelscited by 18
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMscited by 18
- 2023The potential of LLMs for coding with low-resource and domain-specific programming languagescited by 11
- 2024Compositional API Recommendation for Library-Oriented Code Generationcited by 10
- 2023A Prompt Learning Framework for Source Code Summarizationcited by 9
- 2023Just-in-Time Detection of Silent Security Patchescited by 7
22 more
- 2024Can Developers Prompt? A Controlled Experiment for Code Documentation Generationcited by 7
- 2024Can GPT-O1 Kill All Bugs? An Evaluation of GPT-Family LLMs on QuixBugscited by 7
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2023Semantic Similarity Loss for Neural Source Code Summarizationcited by 5
- 2024Curriculum Demonstration Selection for In-Context Learningcited by 5
- 2024Testing the Effect of Code Documentation on Large Language Model Code Understandingcited by 4
- 2024CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistantscited by 3
- 2025Commenting Higher-level Code Unit: Full Code, Reduced Code, or Hierarchical Code Summarizationcited by 3
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
- 2024MESIA: Understanding and Leveraging Supplementary Nature of Method-level Comments for Automatic Comment Generationcited by 2
- 2025Zero-Shot Cross-Domain Code Search without Fine-Tuningcited by 2
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Modelcited by 2
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Modelscited by 1
- 2025SIExVulTS: Sensitive Information Exposure Vulnerability Detection System using Transformer Models and Static Analysiscited by 1
- 2026Agent4cs: A Multi-agent System for Code Summarization in Large Hierarchical Codebasescited by 1
- 2024Unlocking Insights: Semantic Search in Jupyter Notebookscited by 0
- 2024Can OpenSource beat ChatGPT? -- A Comparative Study of Large Language Models for Text-to-Code Generationcited by 0
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generationcited by 0
- 2025ReDef: Do Code Language Models Truly Understand Code Changes for Just-in-Time Software Defect Prediction?cited by 0
- 2025Assertion-Aware Test Code Summarization with Large Language Modelscited by 0
- 2026Prompt-Driven Code Summarization: A Systematic Literature Reviewcited by 0
- 2026Compact Documentation for Coding Agents: A Benchmark, an Optimizer, and Why It Does Not Transfercited by 0
- 2026Compact Documentation for Coding Agents: A Benchmark, an Optimizer, and Why It Does Not Transfer25 Sep 2026
- 2026Agent4cs: A Multi-agent System for Code Summarization in Large Hierarchical Codebases1 Jul 2026
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generation14 Jan 2026
- 2025Assertion-Aware Test Code Summarization with Large Language Models9 Nov 2025
- 2025ReDef: Do Code Language Models Truly Understand Code Changes for Just-in-Time Software Defect Prediction?11 Sep 2025
- 2025SIExVulTS: Sensitive Information Exposure Vulnerability Detection System using Transformer Models and Static Analysis26 Aug 2025
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Models14 Jul 2025
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generation17 Jun 2025
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Model24 Apr 2025
- 2025Zero-Shot Cross-Domain Code Search without Fine-Tuning10 Apr 2025
- 2025Commenting Higher-level Code Unit: Full Code, Reduced Code, or Hierarchical Code Summarization13 Mar 2025
22 more
- 2024Curriculum Demonstration Selection for In-Context Learning27 Nov 2024
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs2 Oct 2024
- 2024Can GPT-O1 Kill All Bugs? An Evaluation of GPT-Family LLMs on QuixBugs16 Sep 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Can OpenSource beat ChatGPT? -- A Comparative Study of Large Language Models for Text-to-Code Generation6 Sep 2024
- 2024Can Developers Prompt? A Controlled Experiment for Code Documentation Generation1 Aug 2024
- 2024Source Code Summarization in the Era of Large Language Models9 Jul 2024
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization1 Jul 2024
- 2024A Systematic Survey of Text Summarization: From Statistical Methods to Large Language Models17 Jun 2024
- 2024CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistants13 Apr 2024
- 2024Testing the Effect of Code Documentation on Large Language Model Code Understanding3 Apr 2024
- 2024MESIA: Understanding and Leveraging Supplementary Nature of Method-level Comments for Automatic Comment Generation26 Mar 2024
- 2024Compositional API Recommendation for Library-Oriented Code Generation29 Feb 2024
- 2024Unlocking Insights: Semantic Search in Jupyter Notebooks20 Feb 2024
- 2023A Prompt Learning Framework for Source Code Summarization26 Dec 2023
- 2023Just-in-Time Detection of Silent Security Patches2 Dec 2023
- 2023CodeScope: An Execution-based Multilingual Multitask Multidimensional Benchmark for Evaluating LLMs on Code Understanding and Generation14 Nov 2023
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Code14 Nov 2023
- 2023Distilled GPT for Source Code Summarization28 Aug 2023
- 2023Semantic Similarity Loss for Neural Source Code Summarization14 Aug 2023
- 2023The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Models1 Aug 2023
- 2023The potential of LLMs for coding with low-resource and domain-specific programming languages24 Jul 2023
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024A Systematic Survey of Text Summarization: From Statistical Methods to Large Language Modelscited by 52
- 2023CodeScope: An Execution-based Multilingual Multitask Multidimensional Benchmark for Evaluating LLMs on Code Understanding and Generationcited by 39
- 2023Distilled GPT for Source Code Summarizationcited by 30
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2023The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Modelscited by 18
- 2023The potential of LLMs for coding with low-resource and domain-specific programming languagescited by 11
- 2024Compositional API Recommendation for Library-Oriented Code Generationcited by 10
- 2023A Prompt Learning Framework for Source Code Summarizationcited by 9
- 2023Just-in-Time Detection of Silent Security Patchescited by 7
- 2024Can Developers Prompt? A Controlled Experiment for Code Documentation Generationcited by 7
- 2024Can GPT-O1 Kill All Bugs? An Evaluation of GPT-Family LLMs on QuixBugscited by 7
12 most cited of 27 All 27 (JSON)
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2025Assertion-Aware Test Code Summarization with Large Language Models9 Nov 2025
- 2025ReDef: Do Code Language Models Truly Understand Code Changes for Just-in-Time Software Defect Prediction?11 Sep 2025
- 2025SIExVulTS: Sensitive Information Exposure Vulnerability Detection System using Transformer Models and Static Analysis26 Aug 2025
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Model24 Apr 2025
- 2025Zero-Shot Cross-Domain Code Search without Fine-Tuning10 Apr 2025
- 2025Commenting Higher-level Code Unit: Full Code, Reduced Code, or Hierarchical Code Summarization13 Mar 2025
- 2024Curriculum Demonstration Selection for In-Context Learning27 Nov 2024
- 2024Can GPT-O1 Kill All Bugs? An Evaluation of GPT-Family LLMs on QuixBugs16 Sep 2024
- 2024Can OpenSource beat ChatGPT? -- A Comparative Study of Large Language Models for Text-to-Code Generation6 Sep 2024
- 2024Can Developers Prompt? A Controlled Experiment for Code Documentation Generation1 Aug 2024
- 2024Source Code Summarization in the Era of Large Language Models9 Jul 2024
12 newest of 27 All 27 (JSON)