Problem
A team building its own Java IDE adds an AI assistant to it. Chat assistants make the user attach context by hand. In inline completion there is no user query, and a model that sees only the current file guesses classes that live elsewhere in the project or in its dependencies. Plain BM25 and embeddings need a text query and existing usage examples, and know nothing about libraries given only as compiled jars.
Example from the article: the developer must implement an interface and then create an identifier. Without retrieval the model implements the interface wrongly; with all retrievers it finds the interface, a factory in another folder and a class hierarchy inside a dependency.
Solution in brief
The IDE builds the context itself. It makes the query from the types around the cursor, walks the AST and class hierarchy to find nearby types, and reads dependencies from bytecode. The results are merged with BM25 and re-ranked by a small trained model.
Questions this case answers
- How to build a query for context retrieval from the code around a cursor when the user has typed no search text
- How to retrieve types and their API from compiled dependencies that have no source code, within an interactive latency budget
- How to pick project context for an LLM code-completion feature when the user has typed no query
- How to retrieve classes and API from a codebase and its compiled dependencies for a code model
Tools and methods
- BM25 over project sources — text retriever, query is the identifiers of surrounding types
- Code Model retriever — AST and class-hierarchy traversal using the IDE's project model
- Bytecode token extraction — restores source tokens from jars, no decompiling
- Composite retriever and re-ranker — strict-order merge of retrievers, then a small trained re-ranking model
- Masked-code benchmark — 3 Java projects, recall, precision, F1 and IoU on needed classes
Google or a one-time email code. No password.