Skip to content
// Glossary · Agent memory

Hybrid search

Also called: hybrid retrieval, vector plus keyword search

What is hybrid search?

Hybrid search combines semantic vector matching with exact keyword matching in one query. Vectors find material that means the same thing in different words; keywords find literal strings like identifiers and error codes. Each covers the other main failure, so results are better than either alone.

// In more depth

Why one method is not enough.

Each approach fails in a way the other one handles.

01

Semantic search misses exact strings

Embeddings are about meaning, and a function name or an error code does not carry much. Search for a specific identifier and vector similarity will happily return things that are about the same area but do not contain it.

02

Keyword search misses paraphrase

If the stored note says the migration locks the table and you search for slow deploys, exact matching finds nothing. That is the case vectors exist for.

03

Combining needs a ranking decision

Two result sets with incomparable scores have to be merged, so the interesting engineering is in how they are weighted rather than in running both.

// Why it matters

Why it matters for agent memory specifically.

Agent queries are unusually mixed: half concept, half literal.

Code is full of exact tokens

File paths, symbols, error strings. Vector-only retrieval is weak on precisely the tokens a coding agent searches with.

Notes are written in prose

Memories describe situations in natural language, which is where semantic matching earns its place.

Precision matters at retrieval time

Context space is finite, so returning three right things beats returning ten plausible ones.

// Commonly confused with

Commonly confused with.

Three related ideas.

Semantic searchSemantic search is one half of hybrid. On its own it is strong on paraphrase and weak on exact identifiers.
RerankingReranking reorders a candidate set with a second model. It is complementary and often applied after a hybrid retrieval, not an alternative to it.
FilteringFilters constrain by metadata such as scope or date. They narrow the field rather than deciding relevance within it.
// FAQ

Hybrid search questions

What is hybrid search?

Combining semantic vector matching with exact keyword matching in one query, so results include both conceptually related material and literal strings such as identifiers or error codes.

Why not just use vectors?

Because embeddings represent meaning, and an exact identifier carries little meaning. Vector-only search returns things about the right area that do not contain the token you searched for.

Why not just use keywords?

Because paraphrase defeats it. If a note describes a problem in different words from your query, exact matching finds nothing.

Is it the same as reranking?

No. Reranking reorders candidates with a second model, usually after retrieval. It complements hybrid search rather than replacing it.

Why does it suit coding agents?

Their queries are mixed. Prose descriptions of situations need semantics; file paths, symbols and error strings need exact matching.

Retrieval that finds both kinds of thing.

Virex Memory is built for queries that mix prose and exact identifiers.