mlsanityData to 7 Oct 2026

Hierarchical Context Pruning: Optimizing Real-World Code Completion with Repository-Level Pretrained Code LLMs

arXiv 2406.18294 ↗First posted 26 Jun 2024cs.CLcited by 13

Not on the map. Why?

Abstract (arXiv)

Some recently developed code large language models (Code LLMs) have been pre-trained on repository-level code data (Repo-Code LLMs), enabling these models to recognize repository structures and utilize cross-file information for code completion. However, in real-world development scenarios, simply concatenating the entire code repository often exceeds the context window limits of these Repo-Code LLMs, leading to significant performance degradation. In this study, we conducted extensive preliminary experiments and analyses on six Repo-Code LLMs. The results indicate that maintaining the topological dependencies of files and increasing the code file content in the completion prompts can improve completion accuracy; pruning the specific implementations of functions in all dependent files does not significantly reduce the accuracy of completions. Based on these findings, we proposed a strategy named Hierarchical Context Pruning (HCP) to construct completion prompts with high informational code content. The HCP models the code repository at the function level, maintaining the topological dependencies between code files while removing a large amount of irrelevant code content, significantly reduces the input length for repository-level code completion. We applied the HCP strategy in experiments with six Repo-Code LLMs, and the results demonstrate that our proposed method can significantly enhance completion accuracy while substantially reducing the length of input. Our code and data are available at https://github.com/Hambaobao/HCP-Coder.

Key facts. Cited by 13 papers in the map (data through 7 Oct 2026). Builds on 37 of its 48 references that are in the map. First posted on arXiv 26 Jun 2024.

Builds on

37 of 48 references.

References · 37

  1. 2022Training language models to follow instructions with human feedbackcited by 15,712
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2021Program Synthesis with Large Language Modelscited by 3,509
  4. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  5. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  7. 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,628
  8. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  9. 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
  10. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  11. 2021Measuring Coding Challenge Competence With APPScited by 879
  12. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
25 more
  1. 2023StarCoder: may the source be with you!cited by 790
  2. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  3. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  4. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  5. 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
  6. 2023How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resourcescited by 405
  7. 2024∞Bench: Extending Long Context Evaluation Beyond 100K Tokenscited by 360
  8. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  9. 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
  10. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 302
  11. 2022Efficient Training of Language Models to Fill in the Middlecited by 248
  12. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
  13. 2023InterCode: Standardizing and Benchmarking Interactive Coding with Execution Feedbackcited by 229
  14. 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
  15. 2023Self-Taught Optimizer (STOP): Recursively Self-Improving Code Generationcited by 128
  16. 2024LLM Agents can Autonomously Hack Websitescited by 108
  17. 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
  18. 2022Execution-Based Evaluation for Open-Domain Code Generationcited by 89
  19. 2023An In-Context Learning Agent for Formal Theorem-Provingcited by 78
  20. 2023Lemur: Harmonizing Natural Language and Code for Language Agentscited by 71
  21. 2024EvoCodeBench: An Evolving Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 71
  22. 2024Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedbackcited by 45
  23. 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Contextcited by 32
  24. 2023L2MAC: Large Language Model Automatic Computer for Extensive Code Generationcited by 30
  25. 2023CoderEval: A Benchmark of Pragmatic Code Generation with Generative Pre-trained Modelscited by 28

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 1; 2025: 7; 2026: 5.

13 papers.

Sort:

By area: