IVFIndex<T>

Models & Types · AiDotNet.RetrievalAugmentedGeneration.VectorSearch.Indexes

Inverted File (IVF) index that partitions the vector space for faster search.

Implements: IVectorIndex<T>

How It Works

IVF partitions vectors into clusters (cells) and only searches the most relevant clusters during query time. This is an approximate nearest neighbor (ANN) method that trades some accuracy for significant speed improvements. Search complexity: O(n/m + k) where n is total vectors, m is number of clusters, k is result size. Best for medium to large datasets (10K - 10M vectors).

Constructors

Constructor Summary
IVFIndex(ISimilarityMetric<T> metric, int numClusters, int numProbes) Initializes a new instance of the IVFIndex class.

Properties

Property Summary
int Count { get; }

Methods

Method Summary
List<ValueTuple<string, T>> Search(Vector<T> query, int k)
bool Remove(string id)
void Add(string id, Vector<T> vector)
void AddBatch(Dictionary<string, Vector<T>> vectors)
void Clear()