Expand description
Index construction: turn a corpus of token embeddings into a searchable PLAID index.
build_index ties together the three lower layers:
- Flatten every document’s token matrix into one big cloud of points.
- Run k-means to pick coarse centroids (
crate::kmeans::fit). - Assign every token to a centroid, compute residuals, train cutoffs
and weights on the residuals (
crate::codec::train_quantizer), and encode each token against the fresh codec.
The resulting Index keeps one EncodedVector per original token
plus the per-document doc_id bookkeeping. Inverted-file construction
and the query-time search path will be added on top in later
TDD cycles.
Structs§
- Document
Tokens - A single document’s worth of token embeddings, ready to index.
- Index
- A fully-built PLAID index over a corpus of multi-vector embeddings.
- Index
Params - Parameters that control how an
Indexis built. - Inverted
File - Inverted file: for each centroid, the sorted list of unique document indices that have at least one token clustered in that centroid.
Functions§
- build_
index - Build a
Indexfrom a corpus of documents. - build_
index_ from_ pool - Build an
Indexfrom a pre-assembled token pool and per-document(doc_id, n_tokens)metadata.