~/writing
Modern AI Systems

Keyword Search vs Vector Search

Comparing how keyword search and vector search find results — exact word matching versus semantic similarity — and when to use each.

Now that I’ve written down what I learned previously about vector embeddings, I want to compare two different types of search: vector search and keyword search.

At a high level, vector search finds results based on meaning, while keyword search finds results based on matching words. Keyword search matches exact words; vector search compares embeddings.

How vector search works

Vector search operates in three stages:

1. Creating embeddings

The model converts items into embeddings — numeric representations of documents, product descriptions, images, and so on. Items with similar meanings tend to have similar embeddings.

2. Building an index

Embeddings are stored in a vector database (ChromaDB, Pinecone, etc.), which uses Approximate Nearest Neighbour (ANN) by default for fast similarity search rather than exact K-Nearest Neighbours, trading a small amount of accuracy for a large gain in speed.

3. Matching queries

When a query arrives, it’s converted into an embedding too, and the system finds the stored embeddings closest to the query to return the associated results.

Keyword search vs vector search at a glance

Attribute Keyword Search Vector Search
Matches on Exact words Meaning and context
Typical method Best Matching 25 (BM25) Nearest-neighbor search
Works on images and audio No Yes

An example: searching for “dog”

A keyword search returns results containing the exact word “dog.” A vector search can also surface “puppy,” “golden retriever,” or “pet” — results that are conceptually related even though they use different words. Vector search also works across formats like images, since it retrieves based on semantic similarity regardless of format.

Trade-offs

Neither approach is superior — they suit different use cases. Keyword search is still the best tool for structured queries like IDs or product codes, where lexical precision and exact matching matter. Vector search is better suited to unstructured queries, multilingual search, and conceptual intent.

These two methods complement each other, which is why many production systems run both in parallel through hybrid search — more on that in a future post.