Fast Plaid

raw JSON →
1.4.6.2110 verified Fri May 01 auth: no python

Fast Plaid is a GPU-accelerated approximate nearest neighbor search library for high-dimensional embeddings, designed for fast indexing and search with support for incremental updates, filtering, and deletions. Current version 1.4.6, requires Python >=3.10. Released irregularly.

pip install fast-plaid
error ImportError: cannot import name 'FastPlaid' from 'fast_plaid'
cause FastPlaid class is in the search submodule, not the root package.
fix
Use 'from fast_plaid.search import FastPlaid' instead of 'from fast_plaid import FastPlaid'.
error PanicException: input tensor is too large
cause The internal quantile computation fails on large datasets due to PyTorch size limits in versions <1.4.5.
fix
Upgrade to fast-plaid >=1.4.5, which replaces quantile with kthvalue-based approach.
error AttributeError: 'FastPlaid' object has no attribute 'delete'
cause The delete method was introduced in version 1.2.3; using an older version.
fix
Upgrade to fast-plaid >=1.2.3: pip install 'fast-plaid>=1.2.3'
breaking Pytorch's native quantile() can cause 'input tensor is too large' panic on large datasets. Versions before 1.4.5 are affected. Upgrade to >=1.4.5.
fix Upgrade fast-plaid to 1.4.5 or later: pip install 'fast-plaid>=1.4.5'
deprecated Older code uses 'create(index='...')' incorrectly; index parameter in FastPlaid() constructor is for loading an existing index, not for creation.
fix Use FastPlaid() without arguments for creation, then call .create(docs) or use FastPlaid(index='path') to load an existing index.
gotcha The `subset` filtering parameter expects a list of integer IDs, not boolean masks or tensors.
fix Pass a list of document IDs (e.g., [2, 5, 10]) to the subset parameter in search().

Basic index creation and search with random embeddings

import torch
from fast_plaid.search import FastPlaid

# Create random embeddings (100 documents, 128 dimensions)
docs = torch.randn(100, 128)
queries = torch.randn(5, 128)

# Build index
plaid = FastPlaid()
plaid.create(docs)

# Search
scores, indices = plaid.search(queries, top_k=3)
print(indices)