Hybrid Search — Pipeline Code by Framework

Full BM25 + vector + RRF pipeline for an identical task: index 5 documents, run hybrid query, return top-3 via RRF fusion. Click a framework to compare.

How RRF Works
score(doc) = Σ 1 / (k + rank_i) for each retriever i
k
Rank constant (default 60). Controls how much top-rank dominates. Lower k = top rank matters more.
rank_i
Position of the document in retriever i's result list (1-indexed).
weights
SynapseKit and LangChain multiply by per-retriever weight. LlamaIndex uses equal weights (1/n).
SynapseKit 1.4 8 lines total · 2 imports · 6 functional
# Imports (2 lines)
from synapsekit.retrieval import HybridSearchRetriever, Retriever, InMemoryVectorStore
from synapsekit.embeddings import SynapsekitEmbeddings

# Functional (6 lines)
emb    = SynapsekitEmbeddings(model="all-MiniLM-L6-v2", use_gpu=False)
r      = Retriever(InMemoryVectorStore(emb))
hybrid = HybridSearchRetriever(r, bm25_weight=0.5, vector_weight=0.5, rrf_k=60)
hybrid.add_documents(DOCS)
await r.add(DOCS)
results = await hybrid.retrieve(QUERY, top_k=3)
Single class, explicit parameters. HybridSearchRetriever wraps both modes. bm25_weight, vector_weight, and rrf_k are constructor arguments — readable and greppable. Limitation: fixed at two retrievers. You cannot add a third retrieval signal.
www.engineersofai.com · AI Letters #20 · LLM Showdown #11