Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:24kchengYe MemoMind Hybrid Retrieval

From Leeroopedia
Knowledge Sources
Domains Information_Retrieval, NLP
Last Updated 2026-10-28 00:00 GMT

Overview

Retrieval strategy that combines multiple independent search methods—semantic (vector), lexical (BM25), graph (link traversal), and temporal—in parallel to capture different aspects of relevance, then fuses their ranked results.

Description

No single retrieval method captures all relevance signals. Semantic search matches meaning but misses exact keywords; BM25 matches exact terms but misses synonyms; graph retrieval finds related facts through connections but may miss direct matches; temporal retrieval filters by time but ignores content relevance.

Hybrid retrieval runs all four methods in parallel for each fact type, then fuses the ranked result lists. This ensures that a fact relevant by any signal is surfaced. The parallelization reduces latency compared to sequential execution.

The four methods:

  • Semantic: HNSW vector search using query embedding cosine similarity
  • BM25: PostgreSQL tsvector full-text search with tf-idf scoring
  • Graph: MPFP/BFS/LinkExpansion traversal from semantic seeds through the memory graph
  • Temporal: date-range filtering combined with semantic matching

Usage

Use this principle when a single retrieval channel is insufficient and the system needs to balance precision (BM25, temporal) with recall (semantic, graph). It is the standard approach for production RAG and memory retrieval systems.

Theoretical Basis

Each retrieval method produces a ranked list of results for the same query:

# Abstract parallel retrieval (not real implementation)
semantic_results = semantic_search(query_embedding, bank_id, fact_types)
bm25_results = bm25_search(query_text, bank_id, fact_types)
graph_results = graph_traverse(query_embedding, bank_id, fact_types, budget)
temporal_results = temporal_search(query_embedding, bank_id, fact_types, date_range)

# Fuse all ranked lists
merged = reciprocal_rank_fusion([
    semantic_results, bm25_results, graph_results, temporal_results
])

The parallel execution is batched: semantic+BM25+temporal share a single database connection (combined CTE query), while graph retrieval runs per fact type in parallel asyncio tasks.

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment