Skip to main content

siann

CI PyPI Documentation

Nearest-neighbor search that decides how to search. Give siann dense NumPy vectors, a metric (Euclidean L2, cosine, inner product, Manhattan L1 or Chebyshev L-infinity) and either "exact" or a recall target. It picks the method (exact search, an IVF or a graph) and, for each batch size, where to run it (the CPU, or the GPU: on Apple silicon, or an NVIDIA GPU for exact search), from measurements on your data and machine, and index.plan says why.

Every path is siann's own: Metal kernels on the Apple GPU (through MLX, or PyTorch's MPS backend), Triton kernels for exact search on NVIDIA GPUs (through PyTorch), and Rust on the CPU, on Linux, macOS and Windows. Where another library is faster, How it compares says so. Start with the quickstart notebook.

One query (an orange dot) among 600 points, and its 25 nearest by three metrics, found by siann: under L2 they fill a circle around the query, under L1 a diamond, under L-infinity a square

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 exactly on an NVIDIA GPU (gpu="torch"). 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 decides

  • 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). On new queries recall lands within a few thousandths of the target, either way.
  • 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 its own graphs (CAGRA graphs, the kind NVIDIA's cuVS builds), 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 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).

FAISS, cuVS and mlxvs

  • FAISS (Meta) is the standard for similarity search on the CPU, and the main baseline below. siann does not call it.
  • cuVS (NVIDIA) is GPU search on NVIDIA GPUs; CAGRA is its graph index. siann's graphs are CAGRA graphs, but siann does not use cuVS: on NVIDIA GPUs it runs its own exact search, through PyTorch (gpu="torch"), with the IVF and the graph on the CPU.
  • mlxvs brings cuVS's methods to the Mac, on MLX. siann does not need it: with it installed (pip install siann[graph], Apple silicon), siann has mlxvs build its graphs, faster on the GPU, and search them in GPU batches; without it, siann builds its graphs itself and searches them on the CPU, and sends GPU batches to its IVF or exact search.

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; the IVF and the graph search on the CPU there.

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

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.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for siann 0.5.0
File Size Uploaded Provenance Actions
siann-0.5.0.tar.gz 102.7 kB With provenance Details for siann-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for siann 0.5.0
File Actions
siann-0.5.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for siann-0.5.0-cp312-abi3-win_amd64.whl
siann-0.5.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.5.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
siann-0.5.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for siann-0.5.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
siann-0.5.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for siann-0.5.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 2.9 MB

Release files / siann-0.5.0.tar.gz

Download URL siann-0.5.0.tar.gz
Size 102.7 kB
Tags Source
SHA-256 checksum
How to use checksums
19fd33e0755fe7020e1205ff8ad88c6107b88dea8de7afeb05482a4adcc30ac4
BLAKE2b-256 checksum
How to use checksums
7d6ee5589be53598d9518bd6fe09fc4d6db89fcf5156f0f819a41ede72745fbb
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 log

Release files / siann-0.5.0-cp312-abi3-win_amd64.whl

Download URL siann-0.5.0-cp312-abi3-win_amd64.whl
Size 642.8 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
625ee91c20b32275cff7f52e099bbb3983826e13bb50e0f42923bf9f097e177b
BLAKE2b-256 checksum
How to use checksums
be9cad79a4cc0536fcfbc4224a2be2731c441b3f6f2c4e0cb9b4073c63d3eb1c
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 log

Release files / siann-0.5.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL siann-0.5.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 759.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c2322ff92e019c2103c0d423800f721c2501f62b9ae328ead93114b70d41bb55
BLAKE2b-256 checksum
How to use checksums
33112abd3564dd6168119152d0e8b83de98a4423aa5bbf1c2e127833185a2e0a
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 log

Release files / siann-0.5.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL siann-0.5.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 711.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
b9d9e106a5723452e758b8c18343e6944edd398e6723500b425c934731fc2e4b
BLAKE2b-256 checksum
How to use checksums
8703b595d9d44ea0a6bca7bc947f168f752ec1899cf8d562da68ee3395fdcf25
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 log

Release files / siann-0.5.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL siann-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
Size 670.7 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aa1296a3ef78385244ef81653cda65b7c91477a7d251a9bcc65fd11523518f3f
BLAKE2b-256 checksum
How to use checksums
602171e8ee878136c73a611967b18468c9ea62cb3c0ad340d2db756efe490fc2
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 log

Security for siann 0.5.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.

Select from 5 files

Attestation for siann-0.5.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page