RAG hybrid retrieval: BM25 + knn with RRF, integration test, prompt fix (#79) - #92
Merged
Merged
Conversation
…ix (#79) Post-MVP step P1 (#460), pulled forward: hybrid retrieval is the industry default because keyword and vector search have complementary failure modes (exact names/codes vs. paraphrase). - P1.1 hybrid retrieval in the query pipeline: parent-level Reciprocal Rank Fusion (k=60) of the knn chunk ranking (collapsed to parents) and the classic keyword (BM25) parent ranking; keyword-only parents get their leading chunks fetched for the prompt context. Hybrid is the default; KITCONCEPT_SOLR_RAG_RETRIEVAL=knn switches back to pure knn (for corpus evaluation). Client-side fusion is drop-in replaceable by Solr's native RRF when 9.11/10.1 ships. - The BM25 side is an exact copy of the @solr main query: same fields and boosts including searchwords^1000 (the editorial "pin a document for a keyword" mechanism) and the -showinsearch:False exclusion - both must behave identically in the AI search. Field notes and the refactoring criteria are documented in the module. - P1.2 CI-runnable integration test: real docker Solr with a deterministic mock LLM (topic-axis unit vectors), no network needed. - Prompt: context chunks are labeled with their document title instead of bracketed numbers - models reliably leaked "[1]"-style references into answers (complied with the no-references instruction only about half the time); with title labels the leak disappears. - Docs: Step P1 design decisions in IMPLEMENTATION-79.md; the facet/tab scoping question recorded as the remaining open point in SPECIFICATION-79.md §8 (to be discussed with Dante and Timo). Verified against the bundled German demo corpus: golden questions 19/19 retrieval hits, 2/2 declines, zero answers containing bracketed references; RAG test suite 128 passed.
reekitconcept
force-pushed
the
kid/460/hybrid-rrf-tests
branch
from
July 28, 2026 14:59
6471fc8 to
3197b91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Post-MVP step P1 (ticket: distribution-kitconcept-intranet#460, part of #79), pulled forward: hybrid retrieval — keyword and vector search have complementary failure modes (exact names/codes vs. paraphrase).
What's included
KITCONCEPT_SOLR_RAG_RETRIEVAL=knnswitches back to pure knn (for corpus evaluation). Client-side fusion is drop-in replaceable by Solr's native RRF when 9.11/10.1 ships.@solrmain query — same fields and boosts includingsearchwords^1000(the editorial "pin a document for a keyword" mechanism) and the-showinsearch:Falseexclusion; both must behave identically in the AI search. Field notes and refactoring criteria documented in the module.Verification
Against the bundled German demo corpus (#89): golden questions 19/19 retrieval hits, 2/2 declines, zero answers with bracketed references; RAG test suite 128 passed (integration tests verified against a clean docker Solr).