TreeRanker: IDEにおけるコード提案のための高速かつモデル非依存なランキングシステム
TreeRanker: Fast and Model-agnostic Ranking System for Code Suggestions in IDEs
August 4, 2025
著者: Daniele Cipollone, Egor Bogomolov, Arie van Deursen, Maliheh Izadi
cs.AI
要旨
トークンレベルのコード補完は、現代の統合開発環境(IDE)において最も重要な機能の一つである。これは、開発者がコーディング中に関連する識別子やAPIを提案することで支援する。補完は通常、静的解析に基づいて行われるが、その有用性はランキングの方法に大きく依存する。なぜなら、リストの深部に埋もれた正しい予測は、ユーザーにほとんど見られることがないからである。現在のほとんどのシステムは、手作りのヒューリスティックやユーザーログに基づいて訓練された軽量な機械学習モデルに依存しており、これらはコンテキスト情報を捕捉し、プロジェクトやコーディングスタイルを越えて一般化するためにさらに改善される余地がある。本研究では、言語モデルを使用して静的補完をランキングする新しいスコアリング手法を提案する。この手法は、軽量でモデルに依存しない方法で行われる。我々の方法は、すべての有効な補完をプレフィックスツリーに整理し、単一の貪欲デコーディングパスを実行してツリー全体のトークンレベルのスコアを収集する。これにより、ビームサーチ、プロンプトエンジニアリング、またはモデルの適応を必要とせずに、正確なトークン認識ランキングが可能となる。このアプローチは高速で、アーキテクチャに依存せず、既に展開されているコード補完モデルと互換性がある。これらの発見は、言語モデルをIDE内の既存ツールに統合し、最終的によりスマートで応答性の高い開発者支援を提供するための実践的で効果的な道筋を示している。
English
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.