Skip to main content

goldenmatch-hnsw

Native HNSW (IndexHNSWFlat) approximate-nearest-neighbor index for GoldenMatch, shipped as a small maturin/abi3 wheel with zero C dependencies (no FAISS, no ONNX, no OpenSSL).

It is the native ANN backend behind goldenmatch.core.ann_blocker.ANNBlocker. Where the FAISS IndexFlatIP / numpy paths are exact and scale linearly (or worse) in the corpus size, HNSW gives sub-linear queries with recall approaching 1.0 — and installs everywhere the pure-Python package does.

Design

A thin PyO3 wrapper over the pyo3-free goldenhnsw Rust crate, mirroring the sibling goldenmatch-embed / goldenmatch-native wheels:

  • pyo3-free core. goldenhnsw carries the algorithm and no CPython, so it can also be linked from the pgrx postgres crate or a DataFusion FFI surface later without embedding an interpreter.
  • No rayon. Insertion is single-threaded by construction — the Python caller already parallelizes across probes/buckets, and the #688 rayon LockLatch futex-park (see the monorepo CLAUDE.md) cannot recur.
  • Inner-product scores identical to FAISS IndexFlatIP. On the normal GoldenMatch path the embedder emits L2-normalized vectors, so the inner product is the cosine similarity.
  • Deterministic graph for a given (seed, insertion order); ef_search auto-scales to the corpus size for small indexes, so recall is exact at the scales the fallback-parity tests exercise.

Usage

import numpy as np
from goldenmatch_hnsw import HnswIndex

vecs = np.random.randn(10_000, 64).astype("<f4")
vecs /= np.linalg.norm(vecs, axis=1, keepdims=True)

idx = HnswIndex(dim=64, m=16, ef_construction=200, ef_search=64)
idx.add_batch(vecs.tobytes(), n=len(vecs))          # fast bulk load

q = vecs[0]
idx.search(q.tolist(), k=10)                          # -> [(id, inner_product), ...]
idx.search_batch(vecs[:32].tobytes(), n=32, k=10)     # one list per query row

add(vec) (single incremental insert) and __len__ / .size / .dim round out the surface.

Metadata

Release files for goldenmatch-hnsw 0.2.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 goldenmatch-hnsw 0.2.0
File Size Uploaded Provenance
goldenmatch_hnsw-0.2.0.tar.gz 25.8 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for goldenmatch-hnsw 0.2.0
File
goldenmatch_hnsw-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 1.2 MB

Release files / goldenmatch_hnsw-0.2.0.tar.gz

Download URL goldenmatch_hnsw-0.2.0.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6fb356537e7a9b8082dff0f59f861c6651ba1c538088c3110bb68a8c0ab1f3a6
BLAKE2b-256 checksum
How to use checksums
0d67525b43ed40acdd3733e8979afc57f8ce2a1219429ce88f9043695a3fc796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenmatch_hnsw-0.2.0-cp311-abi3-win_amd64.whl

Download URL goldenmatch_hnsw-0.2.0-cp311-abi3-win_amd64.whl
Size 149.1 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
88f119302e3f01c1235158b0fc3c28ce7e29c3b7eb565e283f6a35c7d5b8905e
BLAKE2b-256 checksum
How to use checksums
2810706c9b4632f9379ed86db67306b5bfa67554991a12053f1c514ce220b648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 279.4 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
a3b1951aa9acd5bcfce760e900695a45678f74ea0bd8c17096b5338fa48b2997
BLAKE2b-256 checksum
How to use checksums
a423f8efb5fe4e070183a05f76d12032d559494c1894d3d94ced3c1823923622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL goldenmatch_hnsw-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 280.3 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7d007a680d62d5ccb6e803ba55e3935a59c26d2dd3e7c8f8b78de5123762acc6
BLAKE2b-256 checksum
How to use checksums
75c7a60d09ab2102f58692c81e881428a607550508c54543ce1335c45976ae7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 252.3 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f54297ba8476044b9a2404885646812235c66f5bf4b31ee735da8ce212a9c0ed
BLAKE2b-256 checksum
How to use checksums
8565ce1a98ad30acf81c037524dcc487fc857766821e1e28d46190d835a8ab1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL goldenmatch_hnsw-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 253.2 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3e4f4bf718c9754b47d13ff82a1d0242959e82cf4245794d9d1b441c8171658d
BLAKE2b-256 checksum
How to use checksums
ddfdad3217f7ea83d08e1a3c387b78ab448103f06a69e6ec35382a39331bb3a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Security for goldenmatch-hnsw 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files No provenance

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