mlsanityData to 7 Oct 2026

Commenting Higher-level Code Unit: Full Code, Reduced Code, or Hierarchical Code Summarization

arXiv 2503.10737 ↗First posted 13 Mar 2025cs.SE cs.AIcited by 3

Not on the map. Why?

Abstract (arXiv)

Commenting code is a crucial activity in software development, as it aids in facilitating future maintenance and updates. To enhance the efficiency of writing comments and reduce developers' workload, researchers has proposed various automated code summarization (ACS) techniques to automatically generate comments/summaries for given code units. However, these ACS techniques primarily focus on generating summaries for code units at the method level. There is a significant lack of research on summarizing higher-level code units, such as file-level and module-level code units, despite the fact that summaries of these higher-level code units are highly useful for quickly gaining a macro-level understanding of software components and architecture. To fill this gap, in this paper, we conduct a systematic study on how to use LLMs for commenting higher-level code units, including file level and module level. These higher-level units are significantly larger than method-level ones, which poses challenges in handling long code inputs within LLM constraints and maintaining efficiency. To address these issues, we explore various summarization strategies for ACS of higher-level code units, which can be divided into three types: full code summarization, reduced code summarization, and hierarchical code summarization. The experimental results suggest that for summarizing file-level code units, using the full code is the most effective approach, with reduced code serving as a cost-efficient alternative. However, for summarizing module-level code units, hierarchical code summarization becomes the most promising strategy. In addition, inspired by the research on method-level ACS, we also investigate using the LLM as an evaluator to evaluate the quality of summaries of higher-level code units. The experimental results demonstrate that the LLM's evaluation results strongly correlate with human evaluations.

Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 19 of its 41 references that are in the map. First posted on arXiv 13 Mar 2025.

Builds on

19 of 41 references.

References · 19

  1. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  2. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  3. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  4. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  5. 2023Using an LLM to Help With Code Understandingcited by 222
  6. 2024CodeGemma: Open Code Models Based on Gemmacited by 145
  7. 2022Few-shot training LLMs for project-specific code-summarizationcited by 128
  8. 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 99
  9. 2020Improved Code Summarization via a Graph Neural Networkcited by 79
  10. 2023Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learningcited by 71
  11. 2021On the Evaluation of Neural Code Summarizationcited by 47
  12. 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
7 more
  1. 2023Distilled GPT for Source Code Summarizationcited by 30
  2. 2022Are We Building on the Rock? On the Importance of Data Preprocessing for Code Summarizationcited by 22
  3. 2023Evaluating Code Summarization Techniques: A New Metric and an Empirical Characterizationcited by 21
  4. 2019A Survey of Automatic Generation of Source Code Comments: Algorithms and Techniquescited by 15
  5. 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 15
  6. 2024SparseCoder: Identifier-Aware Sparse Transformer for File-Level Code Summarizationcited by 11
  7. 2023A Prompt Learning Framework for Source Code Summarizationcited by 9

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 2; 2026: 1.

3 papers.