Teaching Code LLMs to Use Autocompletion Tools in Repository-Level Code Generation
Not on the map. Why?
Abstract (arXiv)
Code large language models (LLMs) face limitations in repository-level code generation due to their lack of awareness of repository-level dependencies (e.g., user-defined attributes), resulting in dependency errors such as undefined-variable and no-member errors. In this work, we introduce ToolGen, an approach that integrates autocompletion tools into the code LLM generation process to address these dependencies. ToolGen comprises two main phases: Trigger Insertion and Model Fine-tuning (Offline), and Tool-integrated Code Generation (Online). During the offline phase, ToolGen augments functions within a given code corpus with a special mark token, indicating positions to trigger autocompletion tools. These augmented functions, along with their corresponding docstrings, are then used to fine-tune a selected code LLM. In the online phase, ToolGen iteratively generates functions by predicting tokens step-by-step using the fine-tuned LLM. Whenever a mark token is encountered, ToolGen invokes the autocompletion tool to suggest code completions and selects the most appropriate one. We conduct comprehensive experiments to evaluate ToolGen's effectiveness in repository-level code generation. To facilitate this evaluation, we create a benchmark comprising 671 real-world code repositories and introduce two new dependency-based metrics: Dependency Coverage and Static Validity Rate. The results demonstrate that ToolGen significantly improves Dependency Coverage by 31.4% to 39.1% and Static Validity Rate by 44.9% to 57.7% across the three LLMs, while maintaining competitive or improved performance in widely recognized similarity metrics such as BLEU-4, CodeBLEU, Edit Similarity, and Exact Match. On the CoderEval dataset, ToolGen achieves improvements of 40.0% and 25.0% in Pass@1 for CodeT5 and CodeLlama, respectively.
Key facts. Cited by 30 papers in the map (data through 7 Oct 2026). First posted on arXiv 12 Jan 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 9; 2025: 16; 2026: 5.
30 papers.
Sort:
By area:
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2024Large Language Model-Based Agents for Software Engineering: A Surveycited by 173
- 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 92
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024HelloBench: Evaluating Long Text Generation Capabilities of Large Language Modelscited by 42
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2025Uncertainty-Guided Chain-of-Thought for Code Generation with LLMscited by 30
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2024Beyond pip install: Evaluating LLM Agents for the Automated Installation of Python Projectscited by 21
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generationcited by 16
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generationcited by 16
18 more
- 2025How Far Are AI Scientists from Changing the World?cited by 15
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Codecited by 7
- 2026LLM-Based Agentic Systems for Software Engineering: Challenges and Opportunitiescited by 7
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Informationcited by 5
- 2026RepoReasoner: Evaluating Repository-Level Code Reasoning Ability of Long-Context Language Modelscited by 5
- 2025SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM Prefillingcited by 3
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Modelscited by 1
- 2025From LLMs to Agents: A Comparative Evaluation of LLMs and LLM-based Agents in Security Patch Detectioncited by 1
- 2025BabelCoder: Agentic Code Translation with Specification Alignmentcited by 1
- 2026How to Ask the AI: A User Perspective Survey for Large Language Model Promptingcited by 1
- 2025EduBot -- Can LLMs Solve Personalized Learning and Programming Assignments?cited by 0
- 2025What a diff makes: automating code migration with large language modelscited by 0
- 2026Design-Specification Tiling for ICL-based CAD Code Generationcited by 0
- 2026RepoReasoner: Evaluating Repository-Level Code Reasoning Ability of Long-Context Language Models28 Jul 2026
- 2026How to Ask the AI: A User Perspective Survey for Large Language Model Prompting17 Jun 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2026LLM-Based Agentic Systems for Software Engineering: Challenges and Opportunities14 Jan 2026
- 2025BabelCoder: Agentic Code Translation with Specification Alignment7 Dec 2025
- 2025From LLMs to Agents: A Comparative Evaluation of LLMs and LLM-based Agents in Security Patch Detection11 Nov 2025
- 2025What a diff makes: automating code migration with large language models31 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generation14 Sep 2025
- 2025How Far Are AI Scientists from Changing the World?31 Jul 2025
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Information28 Jul 2025
18 more
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul 2025
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Models14 Jul 2025
- 2025SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM Prefilling30 May 2025
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges29 Apr 2025
- 2025EduBot -- Can LLMs Solve Personalized Learning and Programming Assignments?23 Apr 2025
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2025Uncertainty-Guided Chain-of-Thought for Code Generation with LLMs19 Mar 2025
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications3 Mar 2025
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Code26 Feb 2025
- 2024Beyond pip install: Evaluating LLM Agents for the Automated Installation of Python Projects9 Dec 2024
- 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigation30 Sep 2024
- 2024HelloBench: Evaluating Long Text Generation Capabilities of Large Language Models24 Sep 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Large Language Model-Based Agents for Software Engineering: A Survey4 Sep 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 Survey on Large Language Models for Code Generation1 Jun 2024
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May 2024
- 2024Large Language Model-Based Agents for Software Engineering: A Surveycited by 173
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024Beyond pip install: Evaluating LLM Agents for the Automated Installation of Python Projectscited by 21
- 2026LLM-Based Agentic Systems for Software Engineering: Challenges and Opportunitiescited by 7
- 2025From LLMs to Agents: A Comparative Evaluation of LLMs and LLM-based Agents in Security Patch Detectioncited by 1
- 2025BabelCoder: Agentic Code Translation with Specification Alignmentcited by 1
- 2026LLM-Based Agentic Systems for Software Engineering: Challenges and Opportunities14 Jan 2026
- 2025BabelCoder: Agentic Code Translation with Specification Alignment7 Dec 2025
- 2025From LLMs to Agents: A Comparative Evaluation of LLMs and LLM-based Agents in Security Patch Detection11 Nov 2025
- 2024Beyond pip install: Evaluating LLM Agents for the Automated Installation of Python Projects9 Dec 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Large Language Model-Based Agents for Software Engineering: A Survey4 Sep 2024
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generationcited by 16
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Modelscited by 1
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul 2025
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Models14 Jul 2025
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May 2024
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 92
- 2024HelloBench: Evaluating Long Text Generation Capabilities of Large Language Modelscited by 42
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generationcited by 16
- 2025How Far Are AI Scientists from Changing the World?cited by 15
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Informationcited by 5
12 most cited of 17 All 17 (JSON)
- 2026How to Ask the AI: A User Perspective Survey for Large Language Model Prompting17 Jun 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2025What a diff makes: automating code migration with large language models31 Oct 2025
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generation14 Sep 2025
- 2025How Far Are AI Scientists from Changing the World?31 Jul 2025
- 2025Enhancing Project-Specific Code Completion by Inferring Internal API Information28 Jul 2025
- 2025SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM Prefilling30 May 2025
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges29 Apr 2025
- 2025EduBot -- Can LLMs Solve Personalized Learning and Programming Assignments?23 Apr 2025
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications3 Mar 2025
12 newest of 17 All 17 (JSON)