RAG & Knowledge Retrieval11 min read• Published July 01, 2026

Advanced RAG Architectures: Hybrid Search (BM25+Dense), Cross-Encoder Re-Ranking, HyDE & The RAG Triad

Production RAG optimization: Reciprocal Rank Fusion (RRF), Cross-Encoder self-attention re-rankers, HyDE, and the RAG Triad evaluation.

MT
Manosakthi Thiyagarajan
Founder & Lead AI Architect

⚡ Executive Summary

Production-grade RAG: combine sparse BM25 with dense vectors via RRF, re-rank with Cross-Encoders, leverage HyDE, and evaluate using the RAG Triad.

Key Takeaways

  • Hybrid Search & Reciprocal Rank Fusion (RRF) — covered in depth with practical examples, formulas, and code.
  • Cross-Encoder Re-Ranking — covered in depth with practical examples, formulas, and code.
  • HyDE (Hypothetical Document Embeddings) — covered in depth with practical examples, formulas, and code.

Advanced RAG Architectures & Evaluation

Basic vector retrieval often fails when users query exact model numbers, acronyms, or complex questions. Production RAG relies on hybrid search, re-ranking, and formal evaluation frameworks.


#1. Hybrid Search & Reciprocal Rank Fusion (RRF)

Combines sparse BM25 keyword matching with dense vector search:

MATHEMATICAL FORMULA RRF Score(d ∈ D) = ∑ (m ∈ M) (1) / (k + rₘ(d))

where rₘ(d) is document d's rank in retriever m, and k ≈ 60 is a smoothing constant.

text
User Query ──┬──> [ Dense Vector Retrieval (HNSW) ] ──> Rank List A ──┐
             │                                                        ├──> [ RRF Fusion ] ──> Top-K
             └──> [ Sparse Keyword Retrieval (BM25) ] ──> Rank List B ──┘

#2. Cross-Encoder Re-Ranking

Bi-encoders generate query and document vectors independently. A Cross-Encoder processes the query and candidate chunk jointly through full self-attention, re-ranking top 50 candidates down to top 5.


#3. HyDE (Hypothetical Document Embeddings)

Prompts an LLM to generate a hypothetical answer first, embeds the answer, and searches the vector store for matching document chunks.


#4. The RAG Triad Evaluation Framework

  • Context Precision: Fraction of retrieved chunks relevant to query.
  • Context Recall: Fraction of necessary facts present in context.
  • Groundedness (Faithfulness): Fraction of claims in answer supported by context.
  • Answer Relevancy: How directly the output answers the user query.
  • python
    from sentence_transformers import CrossEncoder
    reranker = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
    scores = reranker.predict([[query, chunk] for chunk in candidate_chunks])
    Tags:#Advanced RAG#Hybrid Search#BM25#Re-Ranking#HyDE#RAG Triad
    ABOUT THE AUTHOR
    MT

    Manosakthi Thiyagarajan

    Founder & Lead AI Architect

    Manosakthi Thiyagarajan is part of the Junglans Solutions engineering team, specializing in rag & knowledge retrieval. Junglans builds a 20-product ecosystem of local-first enterprise software — AI developer tools, encrypted communication, and data infrastructure with zero cloud telemetry.

    Meet the full Junglans engineering team ↗
    RELATED RESOURCES & REFERENCES

    This article is part of the Junglans Research knowledge base, produced alongside the engineering teams that build our production AI tools. Explore related product documentation and research:

    Related Research & Articles