← Lessons

quiz vs the machine

Gold1420

Machine Learning

The Vector Database for Memory

Storing and searching memories by meaning instead of keywords.

5 min read · core · beat Gold to climb

The Vector Database for Memory

Agents recall by meaning, not exact words. A vector database stores text as numeric embeddings and finds entries whose meaning is close to a query, even when the wording differs.

How it works

  • An embedding model maps each chunk of text to a vector of numbers.
  • Similar meanings land near each other in this vector space.
  • A query is embedded the same way, and the database returns the nearest stored vectors.

Why nearest neighbor search

Exact keyword search misses paraphrases: a query about cancelling an order should match a note about refund requests. Vector similarity, usually cosine distance, captures that semantic overlap. To stay fast at scale, these systems use approximate nearest neighbor indexes that trade a tiny bit of accuracy for large speedups.

Practical concerns

Retrieval quality depends heavily on chunking and on the embedding model's domain fit. Stale entries can surface as confident but outdated memories, so many systems attach timestamps and prune. A vector store is powerful but not magic: garbage embeddings in means irrelevant memories out, and the agent will happily act on them.

Key idea

A vector database stores text as embeddings and retrieves memories by semantic similarity rather than exact keyword match.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a vector database match on?

2. Why use approximate nearest neighbor search?

3. What is a common failure of vector memory?