LLM‑Assisted Code Index Search (Query Rewriting + Reranking) with Shared Sub‑LLM Layer #7820
Replies: 3 comments
-
I'm exploring a potential implementation for the LLM-assisted code index search feature. I'll work on creating the shared sub-LLM layer and integrating query rewriting and reranking capabilities as outlined in the requirements. Will open a PR to share progress. |
Beta Was this translation helpful? Give feedback.
-
I've made initial progress on implementing the LLM-assisted code index search feature. The core sub-LLM layer is in place with the following components: Completed:
Questions before proceeding:
The branch is pushed to feature/llm-assisted-search with the initial implementation. I'd appreciate your guidance on these integration points before completing the implementation to ensure it aligns with your architectural preferences. |
Beta Was this translation helpful? Give feedback.
-
Hey @Michaelzag, thanks for the detailed proposal. Improving result relevance is definitely valuable, but I don’t think introducing an extra LLM layer for reranking is the right fit here. The purpose of code search is to provide semantically similar candidates to the query. The main model, which already has the full conversation and task context, is in a better position to judge whether those candidates are relevant or not. Adding a second model that only sees partial context risks introducing noise and extra complexity without clear benefit. In our view, the search index should stay focused on fast and broad discovery, while the main model handles interpretation and filtering. I am open for discussion, feel free to ping me on discord if you have any thoughts on this! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What specific problem does this solve?
Users struggle to find relevant code with plain vector search when queries are vague, natural‑language, or use synonyms that don’t match raw code text. This leads to trial‑and‑error search phrasing, extra time scanning irrelevant results, and “I know it’s here but can’t find it” frustration.
Additional context (optional)
This complements, not replaces, Issue #6223 (vector DB alternatives). This proposal is provider‑agnostic and focuses on retrieval quality rather than storage engines.
The LLM utility introduced here is deliberately generic so it can later be reused by Conversation/Chat Memory (#7537) for extraction, episode titles, and memory search reranking.
Roo Code Task Links (Optional)
No response
Request checklist
Interested in implementing this?
Implementation requirements
How should this be solved? (REQUIRED if contributing, optional otherwise)
Introduce a shared “sub‑LLM” layer and apply two high‑ROI improvements to Code Index search in a single PR. All enhancements are opt‑in and disabled by default (no LLM calls, no added cost unless explicitly enabled). Keep behavior gated via settings and fall back gracefully on error/timeouts.
Shared sub‑LLM component (new)
src/services/llm-utils/
generateJson
/generateText
with backoff and budgets{ score: 0..1, reason? }
Code Index integration
src/services/code-index/search-service.ts
final = 0.7*rerank + 0.3*embedding
); keep timeouts fallbackssrc/services/code-index/processors/scanner.ts
CacheManager
with an “aux‑hash” to recompute summaries only when code changesSettings (opt‑in; safe defaults)
roo-cline.subLlm.enabled
(default false)roo-cline.subLlm.model.mode
:mirror | custom
roo-cline.subLlm.model.provider/modelId
: when customroo-cline.codeIndex.llm.rewriter
(default false)roo-cline.codeIndex.llm.reranker
(default false)roo-cline.codeIndex.llm.summaries
(default false; reindex required)roo-cline.codeIndex.llm.tags
(default false; reindex required)maxKForRerank
,maxTokensPerOp
,dailyCostCapUSD
Reuse for Chat Memory (later; no extra surface)
LlmClient
+JsonRunner
(strict JSON)Summarizer
Reranker
for top‑K facts/episodesHow will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
Technical considerations (REQUIRED if contributing, optional otherwise)
src/services/llm-utils/
with unit tests; add small hooks insearch-service.ts
; augment inscanner.ts
(gated by setting). When disabled, these paths short‑circuit and incur zero LLM usage.Trade-offs and risks (REQUIRED if contributing, optional otherwise)
Trade‑offs and risks (REQUIRED if contributing)
Related issues
Beta Was this translation helpful? Give feedback.
All reactions