Skip to content
← The journal

Retrieval & graphs / Insight

Hybrid search for AI memory: keyword, vector and graph retrieval

Understand what keyword and vector retrieval contribute, why their scores differ, and how to test a combined ranking on your own questions.

A river dividing into channels beside fields and woodland.
Photography by Yunus Emre / Unsplash

Different signals. One evidence shortlist.

Exact wording and related meaning provide different candidate lists. Rank fusion combines their positions; graph connections can then adjust the order of permitted candidates.

Gigabrain / Visual guideConceptual illustration

Enlarge diagram

How lexical and semantic retrieval combineIllustrative query: What is the exit fee in ZX-41? Exact terms and related meaning produce separate candidate rankings. Reciprocal-rank fusion combines ranks. Source-linked graph evidence reranks existing permitted candidates, followed by exact-span checks. No measured ranking or benchmark is shown. GIGABRAIN / HYBRID RETRIEVAL “What is the exit fee in ZX-41?” Lexical matching Exact identifiers + wording Semantic similarity Related meaning + paraphrases ZX-41 / amendment The same identifier as your question. “Early termination charge” Relevant wording can be different. Reciprocal-rank fusion Merge list positions, not raw scores ranks ranks Graph-aware reranking → Exact-span checks → Selected evidence Illustrative candidates. Graph reranking cannot add new sources; scoped graph traversal is a separate context operation.
Graph reranking contributes after rank fusion. It does not introduce a new source candidate or cross a project boundary.
Read the diagram step by step
  1. Apply the approved project scope to retrieval.
  2. Lexical retrieval matches terms such as an exact invoice identifier. Semantic retrieval finds related meaning when wording differs.
  3. Reciprocal-rank fusion combines positions in the result lists, not incompatible raw scores.
  4. Source-linked graph contributions rerank existing permitted candidates.
  5. Check the selected source spans before assembling context. Relevance alone does not prove a source is current or true.

The query examples explain the mechanism. No retrieval scores or comparative performance results are asserted here. Bounded graph traversal for context is a separate operation.

The short answer

Combine retrieval methods only when the result improves the questions you care about.

Understand what keyword and vector retrieval contribute, why their scores differ, and how to test a combined ranking on your own questions.

Test exact names as well as descriptions

Invoice AX-417 is easy to describe with an exact identifier. "The meeting where we changed the launch scope" may use none of the words in the relevant note. Test both kinds of question when choosing a search method.

In general search design, hybrid search combines signals such as lexical matching and semantic similarity. The diagram above shows the query ranking path: reciprocal-rank fusion followed by source-linked graph reranking and source checks. Hybrid search helps select evidence. You still need to check whether that evidence is correct and current.

Do not compare unlike scores directly

A lexical score and a vector-similarity score can have different ranges and meanings. Adding them without understanding their scale can let one dominate for accidental reasons.

Elastic's hybrid-search documentation describes combining full-text and vector retrieval. Its RRF reference describes merging ranked result lists. These examples describe Elasticsearch’s implementation. Gigabrain uses a separate retrieval pipeline.

See what rank fusion is doing

For an illustrative two-list calculation, suppose passage A is first in keyword results and tenth in semantic results. Passage B is fourth in both. A reciprocal-rank method assigns contributions based on positions rather than treating the raw scores as interchangeable.

Illustrative reciprocal-rank contribution:
score(document) = sum(1 / (constant + rank_in_each_list))

Before choosing parameters, record:
- Which methods supplied the candidate lists
- How many candidates each method returned
- Which scope filters applied to both
- Whether duplicated passages count only once

The example explains the mechanism. It does not select a parameter value for your corpus or establish that fused ranking beats either list.

Test the cases that can worsen

CaseWhat to inspect
Exact identifiersDoes an approximate match displace the exact record?
ParaphrasesDoes semantic retrieval recover a relevant passage?
Similar project namesDo scope filters preserve project identity?
Changed factsDoes relevance hide an obsolete source?
Missing answerCan the system return a clear evidence gap?

A top-ranked passage can be highly relevant and still be outdated. Ranking and source authority need separate treatment.

Compare against a simple baseline

Use the same source collection and query set for each method. Record the top results, source versions and relevance judgments. Measure query groups separately. An aggregate improvement can conceal worse identifier lookup.

If a combined system retrieves more relevant material but sends too much duplicate context, inspect the final evidence-selection step. The agent still needs a manageable set of supporting passages for the task.

What the Gigabrain demonstration tested

Gigabrain combines local semantic embeddings and lexical search through rank fusion, with graph reranking and source checks on retrieved passages. The earlier component demonstration tests lexical recovery mode only. The four-mode experiment below separately measures the local memory service.

Use the evaluation kit to choose questions to test with your own sources. Then review integration status and packages if a ready local knowledge system fits your workflow.

Compare four modes on the same fictional sources

We ran lexical search, hybrid search without graph effects, graph reranking and graph expansion through the same local memory service. Each configuration used the same questions, sources and limit of eight hits.

The source set includes Project Alder, its access review and a separate schedule. It also contains ambiguous person aliases and distracting project records.

Open the complete query results beside the source files. Compare the returned sources and the retrieval contributions for the question you care about.

The summary separates source recall, source precision, citation checks and abstention. These measures do not establish generated-answer quality. Developers inspected these fictional cases during earlier work. This rerun supplies regression evidence rather than blind validation.

Read the improvement beside the failure

In the development corpus, six questions had labelled supporting sources. One question had no supporting source. The table averages source-level precision and recall across the six answerable questions.

ModeMean source recallMean source precisionUnsupported-query abstention
lexical61.1%12.5%0/1
hybrid77.8%16.7%0/1
graph_rerank77.8%16.7%0/1
graph_expand100.0%28.6%0/1

Expansion recovered all labelled sources in this small set, but most returned sources were still irrelevant to the labels. Every mode returned passages for the unsupported question. Verified citations therefore did not establish that an answer was available.

These figures describe one previously inspected fictional corpus and an eight-hit limit. They do not establish accuracy across customer data or a generated answer.

Separate graph reranking from expansion

Reranking changes the order of candidates already under consideration. Expansion follows relationships and can add a source absent from the initial results.

In the connected-source demonstration, the path leads from Alder to the access review and then to the schedule. Each edge names supporting text. The relationship remains an authored interpretation.

The current local memory service exposes these graph modes. Older query commands and individual integrations can use different paths. Check the interface named in the experiment before applying its results elsewhere.

Download the reproduction instructions. Use the evaluation guide to create questions from your own work.

Use retrieval in a recurring brief

Before a weekly review, choose one project and its notes. Search for the project name and its open decisions. Check the returned passages, then draft the review from supported facts. Record unresolved questions separately.

Project: ____
Question: ____
Source passage: ____
Current or replaced: ____
Next task: ____

The Loop Pack includes the prepared automations. Choose their tools, permissions and schedule during setup. Explore the Loop Pack.

Method note: Gigabrain Labs prepared this article with AI assistance. Linked records define the measured scope. Fictional exercises remain separate from executed results.

About this publication

Gigabrain Labs publishes practical guidance for people using file-capable AI agents. Our guides explain the product and link to supporting tests. We label practice exercises separately from recorded results.

About Gigabrain ↗
One complete system

Get Gigabrain.

Give your AI agent persistent, source-linked knowledge from the files you already own.

Gigabrain System
Complete core system

$79 once

The complete knowledge and memory system for your AI agent.

Try Gigabrain
7-day money-back guaranteeNot satisfied? Request a full System refund within seven days of delivery.
  • Persistent, source-linked memory
  • Semantic and lexical retrieval
  • Connected knowledge graph
  • Guided agent setup
  • Tools for building your own workflows
  • Twelve months of core updates

One-time purchase · No coding required · Knowledge stored locally · Model accounts and usage fees are separate

Gigabrain

Gigabrain System 1.1.0

Your context, ready for the next conversation.Keep your files, decisions and previous work ready for your AI.

7-day money-back guarantee

Not satisfied? Request a full System refund within seven days of delivery.

  • Keep every conversation connectedYour AI starts with the decisions and work already done.
  • Set up with a guided walkthroughStart your first project with clear, practical steps.
  • 12 months of core updatesKeep your system current as your work develops.
  • Your licence and download linkSet up on your computer. Keep your files local.

One payment. Yours to keep. No subscription.

Your AI agent and model usage fees are separate.

Secure checkout

Stripe handles your payment details. Your final total, including any tax, appears in the payment form before you pay.

Preparing secure checkout.