arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2508.02455cs.SEcs.AIcs.IR
收藏

TreeRanker: 代码建议中集成开发环境的快速且模型无关的排名系统

TreeRanker: Fast and Model-agnostic Ranking System for Code Suggestions in IDEs

JetBrains;Delft University of Technology(代尔夫特理工大学)

Daniele Cipollone, Egor Bogomolov, Arie van Deursen, Maliheh Izadi

AI总结:

本文提出一种基于语言模型的快速、模型无关的代码建议排名方法,通过构建前缀树并进行贪心解码,实现精确的token级排序,无需束搜索、提示工程或模型调整。

摘要:

令牌级代码补全是现代集成开发环境(IDE)中最关键的功能之一。它通过在编码过程中建议相关的标识符和API来帮助开发者。虽然补全通常来源于静态分析,但其有用性取决于如何排序,因为正确的预测深埋在列表中很少被用户看到。目前的系统通常依赖于手工制定的启发式或轻量级机器学习模型,这些模型可以进一步改进以捕捉上下文信息并在项目和编码风格之间泛化。在本文中,我们提出了一种新的评分方法,利用语言模型对静态补全进行排名,方法轻量且模型无关。我们的方法将所有有效的补全组织成一个前缀树,并进行一次贪心解码以收集树上的token级评分。这使得能够实现精确的token感知排序,而无需束搜索、提示工程或模型调整。该方法快速、架构无关,并且可以与已经部署的代码补全模型兼容。这些发现强调了将语言模型整合到现有IDE工具中的实际和有效路径,最终提供更智能和响应更快的开发者帮助。

英文摘要:

Token-level code completion is one of the most critical features in modern Integrated Development Environments (IDEs). It assists developers by suggesting relevant identifiers and APIs during coding. While completions are typically derived from static analysis, their usefulness depends heavily on how they are ranked, as correct predictions buried deep in the list are rarely seen by users. Most current systems rely on hand-crafted heuristics or lightweight machine learning models trained on user logs, which can be further improved to capture context information and generalize across projects and coding styles. In this work, we propose a new scoring approach to ranking static completions using language models in a lightweight and model-agnostic way. Our method organizes all valid completions into a prefix tree and performs a single greedy decoding pass to collect token-level scores across the tree. This enables a precise token-aware ranking without needing beam search, prompt engineering, or model adaptations. The approach is fast, architecture-agnostic, and compatible with already deployed models for code completion. These findings highlight a practical and effective pathway for integrating language models into already existing tools within IDEs, and ultimately providing smarter and more responsive developer assistance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑