What to Retrieve? Investigating Effective Call Information in Repository-level Code Generation
Open Access
- 5 November 2026
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Software Engineering and Methodology
Abstract
Retrieval-Augmented Generation (RAG) emerges as a widely adopted solution in repository-level code generation by retrieving functions for direct reuse or learning similar usage patterns. Nevertheless, it remains unexplored which types of contexts effectively assist LLMs. In this paper, we categorize the context of function calls and empirically analyze the performance of LLMs. Specifically, we define call information along two dimensions: call depth , including direct-level , inward expansion (to callees), and outward expansion (to callers), as well as call granularity , including function-level , module-level , and file-level . We investigate the utility of the context in two distinct scenarios: precision-oriented call extraction and relevance-oriented call retrieval , targeting precise call information and relevant call information , respectively. We conduct comprehensive experiments with three mainstream LLMs on two widely used benchmarks, CoderEval and DevEval. When precise call information is provided, the additional inclusion of inward expansion, outward expansion, module-level, and file-level context enhances the average Pass@1 of the studied LLMs by 2.11%, 79.59%, 37.54%, and 82.54%, respectively. When the relevant call information is provided, incorporating the same set of strategies leads to improvements of 18.00%, 4.77%, 26.07%, and 44.60% in average Pass@1, respectively. This empirical study offers practical insights for optimizing RAG strategies in repository-level code generation.Keywords
This publication has 16 references indexed in Scilit:
- Hierarchical Context Pruning: Optimizing Real-World Code Completion with Repository-Level Pretrained Code LLMsProceedings of the AAAI Conference on Artificial Intelligence, 2025
- GraphCoder: Enhancing Repository-Level Code Completion via Coarse-to-fine Retrieval Based on Code Context Graph2024
- A3-CodGen: A Repository-Level Code Generation Framework for Code Reuse With Local-Aware, Global-Aware, and Third-Party-Library-AwareIEEE Transactions on Software Engineering, 2024
- CodePlan: Repository-Level Coding using LLMs and PlanningProceedings of the ACM on Software Engineering, 2024
- Frankenstein: fast and lightweight call graph generation for software buildsEmpirical Software Engineering, 2023
- CodeEditor : Learning to Edit Source Code with Pre-trained ModelsACM Transactions on Software Engineering and Methodology, 2023
- SkCoder: A Sketch-based Approach for Automatic Code Generation2023
- ReACC: A Retrieval-Augmented Code Completion Framework2022
- Language Server Protocol and Implementation2022
- Learning to mine aligned code and natural language pairs from stack overflow2018