[ Engineering ]

Vector search in production, practical instead of theoretical

·

2 min read

·

InfraCore Engineering

var(--variable-Xl_A26EtY)

On this page

01 Pick the recall you need, not the best you can get 02 Updates are the hard part 03 Filters change everything

Index choices, recall targets and the boring operational details nobody puts in a benchmark.

Benchmarks for vector search compare recall and latency on a frozen dataset. Production adds three things the benchmark leaves out: the data keeps changing, the queries are not shaped like the test set, and somebody has to be on call for it.

Pick the recall you need, not the best you can get

Perfect recall is expensive and usually invisible to the user. We started from the product question: how often can the right result be missing before someone notices? For our use case the answer was about one in twenty, which allowed a much cheaper index.

Updates are the hard part

Most approximate indexes are built for read-heavy workloads. When vectors are added and removed all day, quality drifts. We rebuild in the background and swap atomically, and we track recall on a small labelled set so a degraded index shows up as a number, not as a complaint.

  • Keep a labelled probe set and run it on every index build

  • Rebuild off to the side, then swap, never mutate in place for long

  • Record the embedding model version next to every vector

Filters change everything

A query for the nearest neighbours inside one customer’s data behaves very differently from a global query. Pre-filtering can starve the search, post-filtering can return nothing. We partition by tenant first and search inside the partition, which keeps both cost and recall predictable.

search(query, {
partition: tenantId,
k: 20,
minScore: 0.72
})

If you cannot measure recall in production, you do not have a recall target.

The unglamorous summary: choose a target, measure it continuously, and make the rebuild boring.

Create a free website with Framer, the website builder loved by startups, designers and agencies.