Education
What is Hybrid RAG?
Retrieval-Augmented Generation (RAG) grounds large language model answers in your actual documents — eliminating hallucinations and keeping responses accurate and verifiable. Hybrid RAG takes this further by combining two fundamentally different retrieval strategies.
What is RAG?
Standard LLMs answer from their training weights alone. They can't access your private documents and will confidently invent answers when they don't know. RAG fixes this by inserting a retrieval step: before generating an answer, the system searches your document corpus for the most relevant passages and passes those directly to the model as context.
The quality of the answer is therefore directly bounded by the quality of retrieval. If retrieval misses the relevant passage, the model has nothing to work with.
// Standard RAG pipeline
Query → Retrieve(corpus) → Generate(query + passages) → Answer
Two retrieval paradigms
Vector / Semantic Search
Text is encoded into a high-dimensional embedding vector that captures meaning. Queries are embedded the same way and matched by cosine similarity. Conceptual questions — "what are our data obligations?" — work brilliantly.
BM25 Keyword Search
BM25 scores documents by term frequency and inverse document frequency. Rare words that appear in a query get boosted. Searches for "Invoice #INV-20240312" return exactly that invoice.
Reciprocal Rank Fusion (RRF)
RRF merges two ranked lists into one without needing to normalise incompatible scores. Each document receives a fusion score based on its rank position in each list. Documents ranked highly by both approaches float to the top.
// RRF score formula
score(d) = Σ 1 / (k + rank_i(d))
k=60 (constant), rank_i = position in list i (vector or BM25)
The merged list is then passed to a cross-encoder re-ranker which scores each candidate passage against the original query jointly — the most expensive but most accurate ranking step, applied only to the top-N candidates.
How hRAG implements it
Vector Store
LanceDB with S3-native storage. Embeddings generated by WASM local model (default) or remote Ollama/Cloud.
Full-Text Index
LanceDB built-in FTS (BM25) on the extracted text corpus. Same store, zero extra infra.
RRF Fusion
Both ranked lists merged server-side using RRF. Top-K candidates forwarded to re-ranker.
Re-ranking
Cross-encoder model scores each candidate against the raw query. Final ordered list returned.
ACL Filter
Hard-filter at vector layer (owner_id + access_ids). Defense-in-Depth post-filter at relational layer.
Streaming Answer
Top passages injected as context. LLM streams the grounded answer via SSE with source citations.
Ready to see it in action?
Explore the full platform feature set or launch the Control Room.