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.
- Home
- Text Chunking Lab
- Embeddings Lab
- Semantic Search Lab
- Vector Databases Lab
- RAG Pipeline Lab
- Advanced Retrieval Lab
- Chat with Documents Lab
- RAG Evaluation Lab
- GraphRAG Lab
- Multimodal RAG Lab
- RAG vs Fine-Tuning Arena
- Build your document assistant
- RAG engineering roadmap
- Project library
- Datasets library
- Algorithms and concepts
- Scientific references
- Glossary and FAQ
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
- Jegou, H., Douze, M., Schmid, C. (2011). Product Quantization for Nearest Neighbor Search. IEEE Transactions on Pattern Analysis and Machine Intelligence 33(1), pp. 117-128.
- Johnson, J., Douze, M., Jegou, H. (2021). Billion-Scale Similarity Search with GPUs. IEEE Transactions on Big Data 7(3), pp. 535-547 (online first 2019).
