# IVF-FLAT

> Inverted File index with FLAT (uncompressed) vectors, partitioning the vector space into clusters with centroids, offering a balance between search speed and accuracy for approximate nearest neighbor search.

- **URL:** https://www.meegle.com/en_us/topics/vector-databases/vector-database-query-optimization
- **Category:** Concepts & Definitions
- **Tags:** indexing, ivf, Clustering
- **Updated:** 2026-03-13 12:21
- **Canonical page:** https://vectordb.ever.works/pl/items/ivf-flat

## Details

## Overview

IVF-FLAT (Inverted File with FLAT vectors) is an indexing method that partitions the vector space into clusters, with each cluster having a centroid. Vectors are stored in their original, uncompressed form (FLAT) within their assigned clusters.

## How IVF-FLAT Works

### Indexing Process

1. **Clustering**: Partition vectors into clusters using k-means or similar algorithm
2. **Centroid Creation**: Create a centroid for each cluster
3. **Assignment**: Assign each vector to its nearest cluster
4. **Storage**: Store full-precision vectors within clusters

### Search Process

1. Find nearest cluster centroids to query vector
2. Search only within selected clusters
3. Compare query with full-precision vectors in those clusters
4. Return top-k most similar vectors

## Characteristics

### Accuracy

Higher accuracy than IVF-PQ because:
- Stores full-precision vectors (no quantization loss)
- Exact distance calculations within searched clusters

### Memory Usage

Higher memory usage than IVF-PQ:
- Stores complete vectors instead of compressed codes
- Suitable when memory is not the primary constraint

## Trade-offs

**vs IVF-PQ**:
- Higher accuracy, higher memory usage
- Slower than IVF-PQ due to full-precision comparisons

**vs HNSW**:
- Lower memory for index structure
- Can be slower for high-recall scenarios

## Configuration Parameters

- **nlist**: Number of clusters
- **nprobe**: Number of clusters to search (recall vs speed trade-off)

## Use Cases

- Applications requiring high accuracy
- When memory is available
- Medium-scale datasets (millions of vectors)
- Scenarios where some recall loss is acceptable

## Pricing

Implemented in open-source libraries (FAISS, Milvus, etc.)

---

_This Markdown mirror is generated by Ever Works for AI agents. The canonical HTML page is at https://vectordb.ever.works/pl/items/ivf-flat._
