From Guessing to Placeholding: A Cost-Theoretic Framework for Uncertainty-Aware Code Completion
Liang Zhu, Haolin Chen, Lidong Zhao, Xian Wu

TL;DR
This paper introduces a cost-theoretic framework for uncertainty-aware code completion, enabling models to output placeholders at uncertain positions to reduce editing costs and improve user experience.
Contribution
It proposes Adaptive Placeholder Completion (APC), a novel approach that strategically outputs placeholders, backed by theoretical analysis and reinforcement learning training methods.
Findings
APC reduces expected editing costs by up to 50%.
Models trained with APC maintain standard code completion performance.
Theoretical analysis shows a critical entropy threshold for effective placeholder use.
Abstract
While Large Language Models (LLMs) have demonstrated exceptional proficiency in code completion, they typically adhere to a Hard Completion (HC) paradigm, compelling the generation of fully concrete code even amidst insufficient context. Our analysis of 3 million real-world interactions exposes the limitations of this strategy: 61% of the generated suggestions were either edited after acceptance or rejected despite exhibiting over 80% similarity to the user's subsequent code, suggesting that models frequently make erroneous predictions at specific token positions. Motivated by this observation, we propose Adaptive Placeholder Completion (APC), a collaborative framework that extends HC by strategically outputting explicit placeholders at high-entropy positions, allowing users to fill directly via IDE navigation. Theoretically, we formulate code completion as a cost-minimization problem…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
