mlsanityData to 14 Oct 2026

From Context to Intent: Reasoning-Guided Function-Level Code Completion

arXiv 2508.09537 ↗First posted 13 Aug 2025cs.SE cs.AIcited by 1

On the map: LLM reasoning → Reasoning for agents, planning and code

Abstract (arXiv)

The growing capabilities of Large Language Models (LLMs) have led to their widespread adoption for function completion within code repositories. Recent studies on such tasks show promising results when explicit instructions, often in the form of docstrings, are available to guide the completion. However, in real-world scenarios, clear docstrings are frequently absent. Under such conditions, LLMs typically fail to produce accurate completions. To enable more automated and accurate function completion in such settings, we aim to enable LLMs to accurately infer the developer's intent prior to code completion. Our key insight is that the preceding code, namely the code context before the function to be completed, often contains valuable cues that help the model understand the intended functionality. However, inferring intent from such implicit context is non-trivial and constitutes a core challenge in function-level code completion. To tackle this challenge, inspired by how humans interpret context, we propose a reasoning-based prompting framework that guides LLMs to utilize these contextual cues to infer intent step by step. To incentivize LLMs to reason through the preceding code and infer intent, we further curate a dataset of 40k examples, each annotated with intermediate reasoning traces and corresponding docstrings. Extensive experiments on DevEval and ComplexCodeEval demonstrate consistent performance improvements across multiple models, achieving over 25% relative gains in pass@1 for both DeepSeekCoder and CodeLLaMA families. Building upon our framework, we further develop an intent-interactive platform that supports lightweight human feedback. This platform allows developers to select from a set of candidate intentions or edit the intent to better guide the model. Our experiments show that this interactive approach leads to further performance improvements.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 17 of its 49 references that are in the map. First posted on arXiv 13 Aug 2025.

Builds on

17 of 49 references.

Closest ancestors · 1

Same direction, newest first

  1. 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug

Other references · 16

  1. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2024GPT-4o System Cardcited by 4,588
  4. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  5. 2024DeepSeek-V3 Technical Reportcited by 811
  6. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
  7. 2024A Survey on Large Language Models for Code Generationcited by 658
  8. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  9. 2024EvoCodeBench: An Evolving Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
  10. 2025OpenCodeInstruct: A Large-scale Instruction Tuning Dataset for Code LLMscited by 60
  11. 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Modelcited by 40
  12. 2024COAST: Enhancing the Code Debugging Ability of LLMs through Communicative Agent Based Data Synthesiscited by 13
4 more
  1. 2024RAMBO: Enhancing RAG-based Repository-Level Method Body Completioncited by 10
  2. 2024DevEval: Evaluating Code Generation in Practical Software Projectscited by 9
  3. 2024REInstruct: Building Instruction Data from Unlabeled Corpuscited by 4
  4. 2024aiXcoder-7B: A Lightweight and Effective Large Language Model for Code Processingcited by 2

Built on by

Cited by year

Citing papers per year: 2025: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2026From Completion to Editing: Unlocking Context-Aware Code Infilling via Search-and-Replace Instruction Tuning
  2. 2024Language hooks: a modular framework for augmenting LLM reasoning that decouples tool usage from the model and its prompt
  3. 2025NeuroSync: Intent-Aware Code-Based Problem Solving via Direct LLM Understanding Modification
  4. 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation
  5. 2024SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning
  6. 2026Evaluating and Achieving Controllable Code Completion in Code LLM
  7. 2025Completion by Comprehension: Guiding Code Generation with Multi-Granularity Understanding
  8. 2023GuardRails: Automated Suggestions for Clarifying Ambiguous Purpose Statements