siann
Nearest-neighbor search that decides how to search, on Apple silicon. Tell siann what you need, exact
neighbors or a recall target, for dense NumPy vectors by Euclidean (L2), cosine, inner product, Manhattan
(L1) or Chebyshev (L-infinity) distance. It chooses the method (exact search, or an IVF calibrated to the
target) and the device for each batch size (the CPU or the Apple GPU) from measurements on your data and
machine, says why in index.plan, and keeps choosing as the index grows and changes.
Each path it chooses between is fast in its own right, through custom GPU kernels and CPU code laid out for the hardware (IMPLEMENTATION); where another library is faster, How it compares says so. 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
siann runs on Python 3.12 or later: on the CPU on Linux, macOS and Windows, and on the GPU too on Macs with
Apple silicon, where it installs MLX for it. Wheels (built packages) cover Linux on x86-64 and ARM, macOS on
Apple silicon and Windows on x86-64. The x86-64 wheels need a processor with AVX2 (Intel from 2013, AMD
from 2015); on an older one, pip install --no-binary siann siann builds from source, which takes a
Rust toolchain. On Linux and Windows, import siann before NumPy
(TUNING).
Python
import numpy as np
import siann
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) # an IVF, if faster
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
grown = siann.Index(np.empty((0, 128), np.float32), metric="l2", recall=0.95) # start empty, grow by add()
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: device=, kind="exact" or
"ivf", nlist=, storage=, nprobe= for one search, gpu="torch" for PyTorch's MPS backend instead of
MLX, and a profile from siann.tune for the routing (TUNING).
What siann does for you
It takes a target, not settings. With recall=0.95, siann builds an IVF, finds how many lists each
query must probe to reach the target, and keeps it only if it beats exact search. Calibrating on a sample of
your queries (calibration_queries=, or later index.calibrate()) makes the target hold on them
(TUNING).
One index uses both the CPU and the Apple GPU, each search sent where its batch size runs fastest on your data and machine: typically single queries to the CPU, batches to the GPU (TUNING).
Every common metric is fast, L1 and L-infinity included, with kernels of their own on the GPU and in Rust on the CPU (IMPLEMENTATION).
The index keeps choosing as it changes. It can start empty, grow and shrink, keep ids of your own, and be searched from several threads while it changes; siann merges, recalibrates, re-clusters, and switches from exact search to an IVF once that is faster (IMPLEMENTATION).
It explains itself. index.plan lists each choice and the measurement behind it: method, nprobe and
the recall reached, storage, routes, memory, what changed since the build.
It is safe on unified memory. GPU searches stay within a memory budget, so a large batch cannot stall the Mac, and an index too large for the GPU stays on the CPU (IMPLEMENTATION).
How it compares
Measured on an Apple M3 Max: queries per second of siann's routed path divided by the other's, above 1 where siann is faster, with exact search returning the same neighbors and approximate search compared at matched recall. Against FAISS 1.16 (its faster path, CPU or Metal GPU), and on the GPU against mlxvs 0.16.1 (NVIDIA cuVS's methods on MLX, CAGRA graphs included). SIFT1M (image descriptors, L2), GloVe-100 (word embeddings, cosine), Music-100 (inner product) and DBpedia OpenAI embeddings (1,536 dimensions) favor different methods (DATASETS).
| 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 (HNSW on the CPU) | split over 4 threads, as siann answers them: GloVe 1.5-3.1x, SIFT 0.45x at recall 0.83 and 1.2-1.6x from 0.97; on one thread (many concurrent queries): GloVe 1.6x, Music-100 0.85-1.4x, SIFT 0.64-0.73x | |
| Approximate, batches of 100 | GloVe 1.2-1.8x, Music-100 0.77-1.05x, SIFT 0.67-0.84x below recall 0.99 (HNSW) | CAGRA: GloVe and Music-100 level, SIFT 0.67-0.83x |
| Approximate, batches of 10,000 | GloVe 5.0x, Music-100 2.1-2.3x, SIFT 1.2-1.3x (HNSW) | CAGRA: GloVe level, Music-100 0.67-0.69x, SIFT 0.38-0.48x |
| Approximate, 1,536 dimensions (100,000 vectors) | single queries 0.37-0.42x (HNSW) | CAGRA: 0.35-0.53x |
FAISS's GPU IVF is no faster than its HNSW at matched recall in any case measured, so HNSW is FAISS's approximate method on the Mac. Without a GPU, siann's CPU path against FAISS's: exact L1 3.8-4.3x and L-infinity 7.3x, L2 and cosine 1.7-1.9x on 1,000 queries and 3.0-3.6x on 100, inner product 0.9-2.7x. BENCHMARKS has the measurements behind each row and how to rerun them.
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 MPS, FAISS and siann's Rust code: 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.3.1
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.3.1.tar.gz | 78.6 kB | With provenance | Details for siann-0.3.1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| siann-0.3.1-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for siann-0.3.1-cp312-abi3-win_amd64.whl |
| siann-0.3.1-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.3.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| siann-0.3.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for siann-0.3.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| siann-0.3.1-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for siann-0.3.1-cp312-abi3-macosx_11_0_arm64.whl |
Total release size: 2.5 MB
Release files / siann-0.3.1.tar.gz
| Download URL | siann-0.3.1.tar.gz |
|---|---|
| Size | 78.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
057fe44ba7bd26b7a86babb47f7eb73c8f75a4e875b883d6f35a90da2a5ed1d8
|
|
BLAKE2b-256 checksum How to use checksums |
bda70af464fdaa9eff0705395309188212ed441f8c6a00f1730195b0e23f9ec3
|
| 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 22, 2026.
Transparency logRelease files / siann-0.3.1-cp312-abi3-win_amd64.whl
| Download URL | siann-0.3.1-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 552.9 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ce43ae67386f4048abfb2f4a8fd1edc336fbe0bd9690566e36071254f1209a26
|
|
BLAKE2b-256 checksum How to use checksums |
ecfc5c4aa1cc8a330b1e0f21ad44f461b5a0428b3a38f0dc563220b03c19ba0d
|
| 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 22, 2026.
Transparency logRelease files / siann-0.3.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | siann-0.3.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 671.2 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
605747e0ad07da6a85d76be25c8e13eaf4091de10dba0fc7329573a0991f8929
|
|
BLAKE2b-256 checksum How to use checksums |
3607ec50a07ab6a669ef635089dfe315aea8392ee48b9868c64151f1b3933864
|
| 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 22, 2026.
Transparency logRelease files / siann-0.3.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | siann-0.3.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 628.9 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c30ee95e2a5dc4b1971328c477f586f6da4f1109d815c696e904dcc7c5464ecc
|
|
BLAKE2b-256 checksum How to use checksums |
024ab751f056e61f64b1c76a769f9be932ce482ac11619a824cfd6fdbdafeb9e
|
| 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 22, 2026.
Transparency logRelease files / siann-0.3.1-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | siann-0.3.1-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 593.1 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b047a3bee99a29a3fd4ee4132df5ad541f5182bad381d0bf16193b941821e302
|
|
BLAKE2b-256 checksum How to use checksums |
9fec00fd6ee83b5bb8282664e3adbf0926898c43cd6c2e5a2986d52367037fdc
|
| 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 22, 2026.
Transparency logSecurity for siann 0.3.1
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.3.1.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 22, 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.