RAG & Vector Lab

Eight interactive labs: text chunking, embeddings, semantic search, vector databases, the RAG pipeline, advanced retrieval, chat with your documents and evaluation, plus an assistant builder for your own documents and experiments that run in the browser.

44interactive experiments

IVF and quantisation

← Back to Vector Databases Lab

Level 1: idea and analogy

Idea

IVF splits vectors into clusters with k-means and searches only the nearest nprobe clusters. Quantisation stores each dimension in 8 bits (or compresses with PQ), saving memory at the cost of a small rounding error.

Analogy

Like dividing a library into sections and searching the two nearest, and like storing images at lower quality to save space.

Level 2: how it works and when to use it

Steps

1. Train the centroids with k-means.

2. Assign each vector to its nearest centroid.

3. At query time probe nprobe lists.

4. Optionally quantise the vectors.

When to use

When memory must be saved or comparisons reduced on large data.

Strengths

A simple index and large memory saving.

Level 3: mathematics, assumptions, limits

Assumptions

The vectors naturally form clusters.

Limits

IVF recall is sensitive to nprobe, and quantisation lowers score precision. The measurements here use synthetic data.

Level 4: pitfalls and references for researchers

Common pitfalls

nprobe=1 on non-clustered data, which makes recall collapse.

References