Glossary

IVF index

An inverted file index groups vectors into clusters around learned centroids, so a search only scans the few clusters closest to the query instead of the whole collection.

An IVF index, short for inverted file index, is a way of organising embeddings so that a similarity search only has to look at a small part of the collection. It clusters all the vectors around a set of learned centroids, then stores each vector in a list attached to its nearest centroid. At query time, the engine finds the centroids closest to the query and scans only their lists. With 4,096 clusters and 16 of them probed per query, a search touches about 0.4 percent of the data. IVF is one of the oldest and most widely used approximate nearest neighbour structures, and it is the backbone of many billion-scale vector indexes, usually combined with compression.

Where the name comes from

The term borrows from text search. A classic inverted index maps each word to the list of documents that contain it, so a keyword query reads a few short lists instead of every document. An IVF index applies the same idea to vectors. Each centroid plays the role of a word, and the list attached to it holds the vectors that belong to that region of the space. The analogy is loose, since a vector belongs to exactly one list while a document appears under many words, but the access pattern is the same: read a few lists, skip the rest.

How an IVF index works

Training. The engine runs k-means clustering on a sample of the embeddings to be indexed, producing a fixed number of centroids. That number is usually called nlist. The centroids together are called the coarse quantiser, because they divide the space into regions.

Adding vectors. Each vector is compared with all centroids and appended to the list of the nearest one. The vector can be stored as it is (IVF-Flat), compressed with int8 scalar quantisation (IVF-SQ8), or compressed with product quantisation (IVF-PQ).

Searching. The query is compared with all centroids, which is cheap because there are only a few thousand. The engine picks the nprobe closest centroids and computes distances between the query and every vector in those lists. The best results across the probed lists are merged and returned as the top-k candidates.

The method is approximate because a query’s true nearest neighbour can sit in a cluster that was not probed. That happens most often when the query lands near the boundary between regions. Probing more clusters makes misses rarer and searches slower.

The two settings that matter: nlist and nprobe

Most of an IVF index’s behaviour comes down to two numbers.

nlist sets how finely the space is divided. More clusters mean shorter lists, so each probe is cheaper, but also more boundaries, so a query’s neighbours are more likely to be split across clusters. A widely used starting point is a few times the square root of the collection size: for 10 million vectors, somewhere between 4,000 and 16,000 clusters. Training more centroids also needs a larger training sample.

nprobe sets how many clusters each query visits. It is the main dial for trading recall at k against latency, and unlike nlist it can be changed per query without rebuilding anything. Teams usually plot recall against nprobe on a held-out query set and pick the smallest value that meets their target.

nprobe (nlist = 8,192)

Share of data scanned

Typical effect

1

about 0.01%

Very fast, poor recall

16

about 0.2%

Fast, moderate recall

64

about 0.8%

Good balance for many workloads

256

about 3%

High recall, slower

These figures describe the shape of the trade-off rather than fixed results. Real recall depends on how well the clusters fit the data and on the embedding model.

IVF variants

IVF is a partitioning scheme, and what sits inside the lists is a separate choice.

IVF-Flat keeps full-precision vectors. It gives the best accuracy for a given nprobe and needs the most memory. It suits collections that fit in RAM where the goal is lower latency than brute force.

IVF-SQ8 stores each value as one byte. Memory drops four-fold and accuracy barely changes, which makes it a common default.

IVF-PQ stores product-quantised codes, often of the residual between each vector and its centroid, which compresses well because residuals are small. It reaches 30 to 60-fold compression and is the standard design for collections in the hundreds of millions or billions. It usually needs a refinement step that rescores the best candidates with fuller vectors. The broader trade-offs are covered under vector quantisation, and the extreme case of one bit per dimension under binary quantisation.

FAISS made these combinations easy to build and name, with index strings that read like recipes, and several vector databases offer IVF-based index types alongside graph indexes.

IVF compared with HNSW

The other dominant structure for approximate nearest neighbour search is the graph-based HNSW. The two make different trade-offs.

Aspect

IVF

HNSW

Structure

Clusters with lists of vectors

Layered proximity graph

Training step

Yes (k-means)

No

Memory overhead

Low: centroids and list IDs

Higher: graph links per vector

Recall at low latency

Good, especially with tuning

Usually better

Inserts

Cheap, append to a list

More expensive, graph updates

Fit with compression

Very good (IVF-PQ)

Possible, less common

Best suited to

Very large, memory-bound collections

In-memory collections needing top recall

In practice, HNSW is the default for collections that fit in memory and need the best recall per millisecond. IVF wins when memory is the constraint, when the collection is large enough that graph overhead hurts, or when the index runs on GPUs, where scanning lists in parallel is very efficient. Some systems combine the two, using a small HNSW graph to find the nearest centroids quickly when nlist is very large.

Operating an IVF index

The training step brings operational duties. Centroids describe the data they were trained on. If a corpus grows in a new direction, for example after adding a new language, a new content type or a different embedding model, new vectors pile into whichever existing clusters are nearest. Lists become unbalanced, the busiest clusters slow every query that probes them, and recall drifts down. The fix is retraining the centroids and rebuilding, the same cycle described under re-indexing and embedding drift.

Deletes need care too. Most IVF implementations mark deleted vectors and filter them out at search time, then compact lists in the background. Heavy churn without compaction wastes memory and time. Filtering by metadata, such as a tenant or date, interacts with probing: if most vectors in the probed clusters fail the filter, the search can return too few results, so engines either probe more clusters or apply the filter differently. That is one reason multi-tenant systems often prefer a per-tenant index or vector namespaces to a single shared IVF index with filters.

Finally, IVF inherits the general limits of vector search. It finds vectors close to the query, which is not always the same as passages that answer it. In large corpora many candidates score almost the same, the effect known as semantic collapse, and partitioning does nothing to separate them. A reranking step and hybrid search that adds keyword matching are the usual complements.

A worked example

An e-commerce search team indexes 50 million product and review embeddings at 768 dimensions. They train 16,384 centroids on a 2 million vector sample and store vectors as IVF-SQ8, which takes about 38 GB including list overhead. On a set of 5,000 labelled queries, nprobe 32 gives recall at 10 of 0.88 at 4 ms median latency, and nprobe 128 gives 0.96 at 11 ms. They choose 96 for interactive search and 256 for an offline deduplication job, using the same index for both. Six months later, after adding a large catalogue in a new language, recall at nprobe 96 drops to 0.91 and the largest lists are ten times the median size. Retraining centroids on a fresh sample restores both. The index structure did its job; the retraining schedule is part of owning it. The team now records list sizes every week, so imbalance shows up as a gradual trend on a dashboard rather than as a sudden fall in recall that customers notice first.

Where Exabase fits

Exabase does not ask developers to choose nlist, nprobe or a coarse quantiser. Files, notes, bookmarks, audio and video stored as Resources are extracted and indexed automatically, and Deep Search returns the matching passage, page, timestamp or video scene, combining semantic search with typo-tolerant keyword matching. The closest thing to nprobe is the precision parameter, a number between 0 and 1 that widens or narrows the results per query. Each Base is a separate, isolated environment with its own index, so tenant isolation does not depend on filters inside a shared structure, which is the subject of the multi-tenant page.

Exabase is the retrieval substrate rather than a tunable vector engine, so teams that need to control index internals will still run a dedicated engine; the best vector databases roundup and Exabase vs pgvector describe that route. For teams that would rather store content and query it, the searching resources guide and the search endpoint reference cover the API, and RAG accuracy explains why passage-level retrieval matters for answers.

Frequently asked questions

What does IVF stand for?

IVF stands for inverted file. The name comes from inverted indexes in text search, which map terms to document lists; an IVF index maps cluster centroids to lists of vectors.

What is the difference between nlist and nprobe?

nlist is the number of clusters the index is divided into and is fixed when the index is trained. nprobe is the number of clusters scanned per query and can be changed at search time to trade recall against speed.

How do I choose nlist?

A common starting point is a few times the square root of the number of vectors, then adjusting based on measured recall and latency. Larger collections need more clusters and a larger training sample.

Is IVF better than HNSW?

Neither is better everywhere. HNSW usually gives higher recall at low latency for in-memory collections, while IVF uses less memory, inserts faster and pairs well with compression for very large collections.

What is IVF-PQ?

IVF-PQ is an IVF index whose lists store product-quantised codes instead of full vectors. It is a standard design for collections of hundreds of millions to billions of vectors.

Why does IVF recall drop over time?

Centroids reflect the data they were trained on. As new data arrives that does not match the original distribution, clusters become unbalanced and neighbours get split across regions, so the index needs retraining.

Do I need to configure an IVF index in Exabase?

No. Exabase indexes stored content automatically and Deep Search handles retrieval, with a precision parameter instead of index settings.

Related pages: HNSW, Product quantisation, FAISS, Vector index, Inverted index, K-nearest neighbors, Vector database, Best vector databases, RAG accuracy

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.