siann
Fast nearest-neighbor search on Apple silicon, exact or to a recall target, for dense NumPy vectors,
on the GPU and the CPU, by Euclidean (L2), cosine, inner product, Manhattan (L1) and Chebyshev (L-infinity)
distance. Give siann a recall target rather than settings: it calibrates the index to your data, measures
where each batch size runs fastest, on the CPU or the GPU, and index.plan says what it chose and why. Each
path it chooses between is fast in its own right, through custom GPU kernels and CPU code laid out for the
hardware (IMPLEMENTATION).
Exact search beats FAISS on the CPU and mlxvs on the GPU almost everywhere, most of all for L1 and L-infinity. Where another library is faster, as graph indexes are for approximate search on some data, 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
siann is on PyPI and 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.
uv add siann # with uv
pip install siann # with pip
There are wheels (built packages) for 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's Haswell, AMD from 2015's Excavator); on an
older one, pip install --no-binary siann siann builds siann from source, which takes a
Rust toolchain. On Linux and Windows, import siann before NumPy
(TUNING).
To run the quickstart notebook, clone the repository and, from its folder,
uv run --group dev --with jupyterlab jupyter lab examples/quickstart.ipynb.
Documentation
| Document | What it covers |
|---|---|
| Quickstart notebook | The metrics, scores, plans, devices and tuning, hands-on |
| siann.readthedocs.io | These pages, online |
| IMPLEMENTATION | Why siann is fast: how it chooses the fastest way to meet a recall target, the search methods, the kernels in detail, where other libraries are faster, and what does not pay |
| 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: sources, preparation and quirks |
| BENCHMARKS | Which path to use for each workload, and every measurement behind it, with the scripts that reproduce them |
| TUNING | Calibration and tuning: what siann measures, on what, and how to measure it on your own queries, data and hardware |
| DEVELOPMENT | Building, testing and linting, and the rules for changing the code |
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") # or "l2", "l1", "linf", "ip"
res = index.search(xb[:5], k=10) # exact, on the GPU or the CPU by batch size
res.indices, res.scores # (5, 10) each, best first
print(index.plan) # what was chosen, and why
profile = siann.tune(xb) # measure the GPU/CPU choice on your data
approx = siann.Index(xb, metric="cosine", recall=0.95) # approximate: an IVF, calibrated to the target
approx.search(xq, k=10)
approx = siann.Index(xb, metric="cosine", recall=0.95, calibration_queries=xq[:1000]) # optional: on your queries
approx.save("approx.siann") # and 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. device="cpu" or "gpu" overrides the choice of device, for the
index or for one search; a profile from siann.tune changes it for the indexes it is given to
(TUNING). With recall=, siann builds an IVF, finds the number of lists to probe that reaches
the target on a sample of the index's own vectors, and keeps exact search instead where that is faster;
the plan reports each choice. Passing calibration_queries, a sample of your own queries, is optional, and
keeps the target where they differ from the base vectors (TUNING).
How it compares
Measured on an Apple M3 Max, with exact search returning exactly the same neighbors and approximate search compared at matched recall: queries per second of siann's routed path divided by the other's, so above 1 siann is faster and below 1 the other is. SIFT1M (image descriptors, L2), GloVe-100 (word embeddings, cosine), Music-100 (inner product) and DBpedia OpenAI embeddings (1,536 dimensions) favor different methods (DATASETS).
Against the fastest alternative for each workload, FAISS 1.16 (on the CPU or its Metal GPU path) or mlxvs 0.16.1 (NVIDIA cuVS's methods on MLX, CAGRA graphs included):
| Workload | Fastest alternative | siann against it |
|---|---|---|
| Exact search, L1 or L-infinity | FAISS on the CPU (neither its GPU path nor mlxvs has these metrics) | 18-49x |
| Exact search, L2, cosine or inner product, batches | mlxvs or FAISS's GPU path (level with each other) | 2.6-3.8x; 1.1-1.2x at 1,536 dimensions |
| Approximate, single queries | FAISS's HNSW on the CPU | GloVe 1.5-1.65x, Music-100 0.85-1.4x, SIFT 0.69-0.77x; split over 4 threads, GloVe 1.5-3.1x, SIFT 1.2-1.6x from recall 0.97 |
| Approximate, batches of about 100 | mlxvs's CAGRA, or FAISS's HNSW (about level) | GloVe level with CAGRA, Music-100 level with both, SIFT 0.67-0.83x |
| Approximate, batches of 10,000 | mlxvs's CAGRA | GloVe level, Music-100 0.67-0.69x, SIFT 0.38-0.48x |
| Approximate, 1,536 dimensions (100,000 vectors) | mlxvs's CAGRA; FAISS's HNSW for single queries | 0.35-0.53x; single queries 0.37-0.42x |
Against FAISS on the Mac, its faster path for each workload, CPU or GPU:
| Workload | FAISS's faster path | siann against it |
|---|---|---|
| Exact search, L2, cosine or inner product, batches of 100 | its GPU | 2.7-2.9x |
| Exact search, L2 or cosine, batches of 10,000 | its GPU (in calls of 1,000, as larger ones exhaust memory) | 5.6-6.0x |
| Exact search, inner product, batches of 10,000 | its CPU | 3.5x |
| Exact search, L1 or L-infinity | its CPU (its GPU path has neither) | L1 18.5-25x, L-infinity 47-49x |
| Approximate, single queries | HNSW on the CPU | GloVe 1.5-1.65x, Music-100 0.85-1.4x, SIFT 0.69-0.77x; split over 4 threads, GloVe 1.5-3.1x, SIFT 1.2-1.6x from recall 0.97 |
| Approximate, batches of 100 | HNSW on the CPU | GloVe 1.2-1.8x, Music-100 0.77-1.05x, SIFT 0.67-0.84x below recall 0.99, level at 0.99 |
| Approximate, batches of 10,000 | HNSW on the CPU | GloVe 5.0x, Music-100 2.1-2.3x, SIFT 1.2-1.3x |
FAISS's GPU IVF is no faster than its own 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 (FAISS computes them with plain loops), 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, and IMPLEMENTATION explains where the speed comes from.
License
MIT (LICENSE)
Metadata
Release files for siann 0.1.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.1.0.tar.gz | 55.3 kB | With provenance | Details for siann-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| siann-0.1.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for siann-0.1.0-cp312-abi3-win_amd64.whl |
| siann-0.1.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.1.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| siann-0.1.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for siann-0.1.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| siann-0.1.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for siann-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
Total release size: 2.3 MB
Release files / siann-0.1.0.tar.gz
| Download URL | siann-0.1.0.tar.gz |
|---|---|
| Size | 55.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c83870189279ca1b8a5fc90a19beeb4ff14ba232319505d3142f658daf0e252
|
|
BLAKE2b-256 checksum How to use checksums |
224c109cf941515be2c3e859c858feab545aef5f6d68f9fc7424685502c6e934
|
| 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.1.0-cp312-abi3-win_amd64.whl
| Download URL | siann-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 489.5 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
23f997f26052ba1ece28b21767484445ab190db0d26e3e91ddc8e67cb6d4cc09
|
|
BLAKE2b-256 checksum How to use checksums |
4137f8ea7273437881586f00c4ef2de71f35f826d62d9dd089fe5ea075e5fa21
|
| 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.1.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | siann-0.1.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 609.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7ae0b24e95a7164f45e64e18cad461cb4cf5f4d3a8d063847dcf6c839c2a9a27
|
|
BLAKE2b-256 checksum How to use checksums |
2762418db1b04a8b5b8d6c241a1a00893c739df6a2466fd854669699c47e8898
|
| 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.1.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | siann-0.1.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 574.0 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8db471025227b72aae7a9bee5f89666026f98d6926360403ac9dd1c33e577e39
|
|
BLAKE2b-256 checksum How to use checksums |
98a57253fe3f4d9708b52e131ff9e7b29beaf7f129c4b6e9754d77cc56514c0f
|
| 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.1.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | siann-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 536.7 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
809c1d48e49126dcaa26648add02f04402c29eb64f15328fc093f3d5c35ccd3a
|
|
BLAKE2b-256 checksum How to use checksums |
873408809f611d65fc398bc085192549647b870e3e720098d4ff9f7a7ab676a7
|
| 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.1.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.1.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 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.