siann
Fast nearest-neighbor search on any CPU and on Apple and NVIDIA GPUs, with few dependencies. Do your research on a Mac, build graphs on an NVIDIA GPU, and serve them from a Rust service on any CPU: the same index, the same neighbors.
- Fast. Against FAISS on the same hardware: exact search on a Mac's GPU 2.7-6.0 times as fast for L2 and cosine, 18-25 times for L1; on an NVIDIA T4, at the same recall, siann's IVF 1.4-3.1 times FAISS's GPU IVF and its graph search 1.3-3.0 times; on the CPU, single queries through the graph 1.32 times FAISS's HNSW on SIFT. Where another library is faster, How it compares says so.
- Universal. Exact search, an IVF and CAGRA graphs (the graph index of NVIDIA's cuVS), by L2, cosine, inner product, L1 and L-infinity, on any CPU (Linux, macOS and Windows; x86-64 and ARM), on Apple's GPU and on NVIDIA GPUs, with the same methods and the same neighbors up to near-ties: every path is siann's own code (Rust on the CPU, Metal on Apple's GPU, Triton on NVIDIA's). AMD GPUs should work in principle, through PyTorch's ROCm builds and Triton's AMD backend running the same kernels, but are untested. An index saved on one machine loads on any other, in Python or in Rust through the siann crate, which finds the same neighbors as Python's CPU search.
- Convenient. A Python API over NumPy arrays. Give a recall target and siann calibrates how deep to search,
picks the method and, for each batch size, the device, from timings on your data and machine;
index.plansays what it chose, and every choice can be overridden. The target holds on average for queries like the calibration sample: pass representativecalibration_queries=and check recall where it matters. - Few dependencies. NumPy, MLX and PyTorch, and nothing else: no FAISS, no CUDA toolkit or compiler, no BLAS library of its own. siann's GPU kernels are compiled as it runs, by MLX and PyTorch's MPS backend on Apple's GPU and by Triton (which comes with PyTorch's CUDA builds) on NVIDIA's; on the CPU it is Rust inside its wheels, with NumPy's BLAS for matrix multiplies. MLX installs with siann on Apple silicon; PyTorch is needed only for NVIDIA GPUs. cuVS and mlxvs are optional plug-ins, used where they are installed and measured faster. The Rust crate needs only rayon and serde_json.
Start with the quickstart notebook.
One query's 25 nearest points by Euclidean (L2), Manhattan (L1) and Chebyshev (L-infinity) distance.
Install
uv add siann # or: pip install siann
Python 3.12 or later. siann runs on the CPU on Linux, macOS and Windows, and on the GPU too on Macs with Apple
silicon, where it installs MLX, Apple's array framework; with
PyTorch installed, it also searches on an NVIDIA GPU (gpu="torch": exact search, the IVF
and graphs). Wheels (built packages) cover Linux on x86-64 and ARM, macOS on Apple silicon and Windows on x86-64;
the x86-64 ones need a processor with AVX2 (Intel from 2013, AMD from 2015), and
pip install --no-binary siann siann builds from source elsewhere, with a Rust toolchain.
Import siann before NumPy. On Linux and Windows, siann sets up NumPy's BLAS as it loads, which can make some CPU searches twice as fast; it warns if NumPy came first (TUNING).
Python
import siann # before NumPy: on Linux and Windows it sets NumPy's BLAS up first
import numpy as np
xb = np.random.default_rng(0).standard_normal((100_000, 128), dtype=np.float32)
xq = np.random.default_rng(1).standard_normal((1_000, 128), dtype=np.float32)
index = siann.Index(xb, metric="cosine") # exact; or "l2", "l1", "linf", "ip"
res = index.search(xq, k=10) # res.indices, res.scores: (1000, 10) each, best first
print(index.plan) # what siann chose, and why
approx = siann.Index(xb, metric="cosine", recall=0.95, calibration_queries=xq) # approximate
ids = approx.add(xq) # add vectors; searches return their ids
approx.remove(ids[:10]) # remove them by id
approx.save("approx.siann") # siann.Index.load("approx.siann"), on any machine
Scores are each metric's natural value: the distance for L2 (not squared), L1 and L-infinity, the similarity
for cosine and inner product. Every choice can be overridden: kind="exact", "ivf" or "graph",
device="cpu" or "gpu", nprobe= for one search, gpu="torch" for PyTorch instead of MLX (on Apple's GPU or an NVIDIA one), and a profile
from siann.tune (TUNING).
What siann chooses for you
- How hard to search. A recall target is calibrated when the index is built: the fewest IVF lists to scan
and the narrowest graph search that reach it on a sample of queries (
calibration_queries=, or the index's own vectors). It holds on average for queries like the sample: on new queries recall lands within a few thousandths of the target either way (1,000 calibration queries carry about 0.006 of sampling noise), and calibrating on the index's own vectors falls 0.005-0.01 short when the queries differ from them.search(..., nprobe=)sets the IVF's depth for one search. - Which method, on which device, for each batch size. Every path, exact search included, is timed at batch sizes from 1 to 4,096 when the index is built, and each search takes the fastest for its size: typically the graph on the CPU for single queries and small batches, the GPU for large ones.
- Graphs on any machine, by any metric. siann builds and searches its own graphs (CAGRA graphs, the kind NVIDIA's cuVS builds) on the CPU and the GPU, on Linux and Windows too, for L1 and L-infinity as well: by L1 on SIFT1M, 6.2 times siann's IVF at recall 0.95. A graph built elsewhere (by cuVS, mlxvs or siann on a GPU) is searched at the width calibrated for it. A graph that cannot reach the target is declined.
- As the index changes, it merges added vectors, recalibrates, re-clusters, and switches methods once another is faster; it can start empty, keep your own ids, and be searched from several threads while it changes.
GPU searches stay within a memory budget, and an index too large for the GPU stays on the CPU (IMPLEMENTATION explains each choice).
Backends, plug-ins and FAISS
siann's own code runs on every device through its backends (BACKENDS): Rust on the CPU, MLX or PyTorch on Apple's GPU, PyTorch with Triton on NVIDIA GPUs, the same methods and the same results on each. Another library's implementation is a plug-in: optional, used where it is installed and measured faster, or where chosen.
- FAISS (Meta) is the standard for similarity search on the CPU, and the main baseline below. siann does not call it.
- cuVS (NVIDIA), a plug-in, is GPU search on NVIDIA GPUs; CAGRA is its
graph index, and siann's graphs are CAGRA graphs. siann does not need it: on NVIDIA GPUs it runs its own exact
search, IVF and graph search, through PyTorch (
gpu="torch"). With cuVS installed, cuVS builds the graphs and its search is calibrated and timed beside siann's, each batch size going to the faster;graph_builder="cuvs"orgraph_search="cuvs"chooses it. siann reads and writes cuVS's CAGRA files. - mlxvs, a plug-in, brings cuVS's methods to the Mac, on MLX. siann
does not need it: it builds and searches its graphs itself on every device. With mlxvs installed
(
pip install siann[graph], Apple silicon), mlxvs builds the graphs, 2.4-3.3 times faster than siann's builder, and its GPU search is calibrated and timed beside siann's, each batch size going to the faster.graph_builder=andgraph_search=("siann"or"mlxvs") choose either, even where it is slower.
How it compares
Queries per second of siann's routed path divided by the other library's, above 1 where siann is faster, on each platform. BENCHMARKS has the measurements and the scripts that reproduce them.
On a Mac with Apple silicon
On an Apple M3 Max, exact search returning the same neighbors and approximate search compared at matched recall (0.95 to 0.96). Against FAISS 1.16's faster path (CPU or Metal GPU) and mlxvs 0.16.1 on the GPU. FAISS's HNSW and mlxvs's CAGRA are graph indexes. The datasets (DATASETS): SIFT1M (image descriptors, L2), GloVe-100 (word embeddings, cosine), Music-100 (inner product), DBpedia OpenAI embeddings (1,536 dimensions).
| Workload | Against FAISS | Against mlxvs |
|---|---|---|
| Exact, L1 or L-infinity | L1 18.5-25x, L-infinity 47-49x (its CPU; neither GPU library has these metrics) | |
| Exact, L2, cosine or inner product, batches of 100 | 2.7-2.9x (its GPU) | 2.6-3.8x in batches; 1.1-1.2x at 1,536 dimensions |
| Exact, batches of 10,000 | L2 and cosine 5.6-6.0x (its GPU), inner product 3.5x (its CPU) | |
| Approximate, single queries | SIFT 1.32x, Music-100 1.05x, GloVe 1.5-3.1x (HNSW, its fastest variant) | CAGRA on the GPU: SIFT and Music-100 10-11x |
| Approximate, batches of 100 | SIFT 0.98x, Music-100 0.93x, GloVe 1.2-1.8x (HNSW) | CAGRA: SIFT 0.84x, Music-100 0.93x, GloVe level |
| Approximate, batches of 9,000-10,000 | SIFT 3.2x, Music-100 2.9x, GloVe 5.0x (HNSW) | CAGRA: SIFT 0.83x, Music-100 0.97x, GloVe level |
| Approximate, 1,536 dimensions (a million vectors) | single queries 0.36x; batches of 100 3.9x, of 9,000 9.2x (HNSW) | CAGRA: single queries level, batches 0.64-0.95x |
On the CPU alone
Against FAISS on the CPU, the same neighbors for exact search, matched recall for approximate search:
| Workload | Against FAISS |
|---|---|
| Exact, L1 or L-infinity | L1 3.8-4.3x, L-infinity 7.3x |
| Exact, L2, cosine or inner product | L2 and cosine 1.7-3.6x, inner product 0.9-2.7x |
| Approximate on 4 Linux CPUs: single queries, batches of 10, of 100 | SIFT 1.16x, 0.84x, 0.99x; Music-100 0.78x, 0.94x, 1.78x (HNSW) |
On an NVIDIA GPU
gpu="torch" on a Tesla T4: exact search on the GPU, against FAISS 1.14's GPU brute force, 200,000 vectors of
128 dimensions, the same neighbors.
| Metric | Batches of 100 | Batches of 1,000 |
|---|---|---|
| L1, L-infinity | 1.12-1.14x | 1.39-1.41x |
| L2 | 0.64x | 1.05x |
| Inner product, cosine | 0.73-0.75x | 0.88-0.92x |
Approximate search on the same T4, on the GPU, against FAISS 1.14's GPU IVF (GpuIndexIVFFlat) at the same
recall, SIFT's first 200,000 vectors (The IVF on NVIDIA GPUs, Graphs on
NVIDIA GPUs):
| siann's index, recall target (reached) | Batches of 100 | Batches of 1,000 |
|---|---|---|
| IVF, 0.95 (0.953) | 1.44x | 2.79x |
| IVF, 0.99 (0.990) | 2.16x | 3.11x |
| Graph, 0.95 (0.951) | 1.29x | 1.89x |
| Graph, 0.99 (0.990) | 1.94x | 2.95x |
Documentation
| Document | What it covers |
|---|---|
| Quickstart notebook | Every feature, hands-on |
| IMPLEMENTATION | How siann chooses, the search methods, the kernels, where other libraries are faster |
| TUNING | What siann measures, on what, and how to measure it on your own queries, data and hardware |
| BENCHMARKS | Every measurement, with the scripts that reproduce them |
| BACKENDS | MLX, PyTorch (on Apple's GPU and on NVIDIA's) and siann's Rust code, and FAISS as the baseline: what each offers, and their pitfalls |
| DATASETS | SIFT1M, GloVe-100, Music-100, DBpedia OpenAI and Gaussian vectors |
| DEVELOPMENT | Building, testing, releasing, the rules for changing the code, and the ideas that do not pay |
| API reference | Every public class, method and function |
These pages are also at siann.readthedocs.io.
License
MIT (LICENSE)
Metadata
Release files for siann 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| siann-0.6.0.tar.gz | 129.7 kB | With provenance | Details for siann-0.6.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| siann-0.6.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for siann-0.6.0-cp312-abi3-win_amd64.whl |
| siann-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details for siann-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| siann-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for siann-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| siann-0.6.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for siann-0.6.0-cp312-abi3-macosx_11_0_arm64.whl |
Total release size: 3.2 MB
Release files / siann-0.6.0.tar.gz
| Download URL | siann-0.6.0.tar.gz |
|---|---|
| Size | 129.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ae3d0b33c816c8f30f2aeba73a64941527ff69a7230ed3b508daf98a5850921
|
|
BLAKE2b-256 checksum How to use checksums |
9a642b4d9ecdcebc2350535e13dc1f2e013215c50d8d152bd49fd1f6b81006d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / siann-0.6.0-cp312-abi3-win_amd64.whl
| Download URL | siann-0.6.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 718.3 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
00441be652eda8246e3d946c42b9570419ec5921cfec1ac00a12d2ffc211e6a7
|
|
BLAKE2b-256 checksum How to use checksums |
2df6a474642e4bb52b601bb9523a68bffa67bd47cd8bd5d6b1f840cc864aee18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / siann-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | siann-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 836.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f922847ea8645875f7a1cc8007a3763198557cf75855239d99eef02454a4578c
|
|
BLAKE2b-256 checksum How to use checksums |
e55c7be937095c066817f808cac83ca046ed9ee7bd2b3f3b2fcf1c7dbaf77b8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / siann-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | siann-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 781.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e680caca09ed3087184ac61004d7a08cc7f9a1e1cb60996f2c9d6b769808b5cd
|
|
BLAKE2b-256 checksum How to use checksums |
b16cb480a7c6b75b1c9905cc97415158a588f25d5f89ba4e0db11be70034050d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / siann-0.6.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | siann-0.6.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 743.2 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
88509429b20862b9f9072483420397f686b210f28dac3007d7b36e94ea49a28c
|
|
BLAKE2b-256 checksum How to use checksums |
6e80240c673ebfbef373157b923cd871ccd30fd908bddc34fb53e13e28184642
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for siann 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for siann-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.