Revisiting File Context for Source Code Summarization
Not on the map. Why?
Abstract (arXiv)
Source code summarization is the task of writing natural language descriptions of source code. A typical use case is generating short summaries of subroutines for use in API documentation. The heart of almost all current research into code summarization is the encoder-decoder neural architecture, and the encoder input is almost always a single subroutine or other short code snippet. The problem with this setup is that the information needed to describe the code is often not present in the code itself -- that information often resides in other nearby code. In this paper, we revisit the idea of ``file context'' for code summarization. File context is the idea of encoding select information from other subroutines in the same file. We propose a novel modification of the Transformer architecture that is purpose-built to encode file context and demonstrate its improvement over several baselines. We find that file context helps on a subset of challenging examples where traditional approaches struggle.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 31 of its 53 references that are in the map. First posted on arXiv 5 Sep 2023.
Builds on
31 of 53 references.
References · 31
- 2017Attention Is All You Needcited by 60,361
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2014Sequence to Sequence Learning with Neural Networkscited by 2,986
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021Unified Pre-training for Program Understanding and Generationcited by 366
- 2018code2vec: Learning Distributed Representations of Codecited by 250
- 2020A Transformer-based Approach for Source Code Summarizationcited by 133
- 2022Few-shot training LLMs for project-specific code-summarizationcited by 129
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
- 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 100
- 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNNcited by 89
19 more
- 2020Improved Code Summarization via a Graph Neural Networkcited by 79
- 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 77
- 2020Improve Transformer Models with Better Relative Position Embeddingscited by 73
- 2022CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Contextcited by 65
- 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
- 2019Code Generation as a Dual Task of Code Summarizationcited by 62
- 2019Recommendations for Datasets for Source Code Summarizationcited by 46
- 2019Retrieve and Refine: Exemplar-based Neural Comment Generationcited by 36
- 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
- 2021Project-Level Encoding for Neural Source Code Summarization of Subroutinescited by 24
- 2022Are We Building on the Rock? On the Importance of Data Preprocessing for Code Summarizationcited by 22
- 2020A Multi-Perspective Architecture for Semantic Code Searchcited by 20
- 2018Automatic Generation of Text Descriptive Comments for Code Blockscited by 18
- 2022Semantic Similarity Metrics for Evaluating Source Code Summarizationcited by 14
- 2021Action Word Prediction for Neural Source Code Summarizationcited by 11
- 2021Named Tensor Notationcited by 11
- 2020Retrieve and Refine: Exemplar-based Neural Comment Generationcited by 10
- 2023Towards Modeling Human Attention from Eye Movements for Neural Source Code Summarizationcited by 8
- 2021A Context-based Automated Approach for Method Name Consistency Checking and Suggestioncited by 5
Built on by
Citing papers per year: 2025: 3.
3 papers.
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2025Code Summarization Beyond Function Levelcited by 8
- 2025Enhancing Code LLM Training with Programmer Attentioncited by 0
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2025Enhancing Code LLM Training with Programmer Attention19 Mar 2025
- 2025Code Summarization Beyond Function Level23 Feb 2025