Exact KNN search over massive Zarr/COG datasets using Ray Data
Project description
rayzin
rayzin is a Ray project for exact k-nearest-neighbor search over chunked embedding arrays stored
in Zarr.
It is designed for workflows where:
- Embeddings are stored as chunked arrays, typically with a trailing feature dimension.
- Search should prune whole chunks before loading vector payloads whenever possible.
- Relevant chunks are read once, searched in parallel with Ray, and merged into a global top-k.
The project uses a chunk-first execution model:
- Build or read a manifest describing each chunk by slice, count, centroid, and radius.
- Apply manifest-level pushdown with Ray Data using predicate filters and optional AOI filtering.
- Compute query-to-chunk lower bounds in vectorized batches.
- Search only the active query subset for each surviving chunk after pruning.
- Merge local top-k results into a global heap actor and return flat result rows.
This architecture keeps chunk reads bounded, avoids rescanning the same data for each query, and fits naturally into Ray Data execution.
Features
- Manifest-driven pruning: Chunk summaries let the pipeline skip work before loading dense vectors, which is the main lever for scaling exact search.
- Ray-native distributed execution: Manifest filtering, chunk reads, and search fan out through Ray Data while final top-k merging stays centralized in a heap actor.
- Pluggable search backends: NumPy and FAISS backends share the same pipeline so pruning and result handling stay consistent across implementations.
Current Scope
- Zarr-backed search path.
- Batched query input shaped
(1, d)or(nq, d). - Euclidean pruning path.
- NumPy backend by default, with FAISS supported when installed separately.
- Early COG entry points are present, but the COG path is not the main supported flow yet.
Installation
Install the base package from PyPI:
pip install rayzin
That gives you the core Zarr search path and the NumPy backend.
If you want the FAISS backend, install FAISS separately after installing rayzin:
pip install faiss-cpu
For FAISS GPU, use your platform's recommended FAISS installation method. In practice that is
often conda or Pixi on linux-64.
If you are working from a local checkout and want an editable install:
pip install -e .
Development
- Install Pixi:
curl -fsSL https://pixi.sh/install.sh | sh - Install dependencies:
pixi install -e dev - Run lint:
pixi run -e dev ruff check . - Run format check:
pixi run -e dev ruff format --check . - Run type check:
pixi run -e dev mypy src/rayzin tests - Run tests:
pixi run -e dev pytest
Release
Releases are cut automatically from main after the CI workflow passes. Use Conventional
Commits for changes that should trigger a release, and semantic-release will:
- compute the next version
- update
pyproject.tomlandsrc/rayzin/__init__.py - refresh
pixi.lock - create the version tag and GitHub release
- build and publish the package to PyPI via GitHub Actions trusted publishing
Roadmap
- Keep pruning metrics and search-time metrics aligned across all supported backends.
- Generalize pruning beyond a single radius or tau so multiple pivots or metric-independent pruning are possible.
- Simplify filtering to chunk existence, AOI intersection, and straightforward coordinate subsetting.
- Add support for native dtypes when no scale or offset or other CF decoding is required.
- Add support for pre-transforms such as dequantization before search.
- Prefer
from __future__ import annotationsover quoted forward references. - Add logging and timing around pruning, loading, decoding, and per-block search.
- Revisit float32 assumptions and document where they are required by FAISS.
- Make radius-based manifest data optional if pruning mode does not require it.
- Revisit rows-per-block tuning and execution sizing once the main search path stabilizes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rayzin-0.0.1.tar.gz.
File metadata
- Download URL: rayzin-0.0.1.tar.gz
- Upload date:
- Size: 59.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1536b23dab8493f65b179d48473e9bf13b5e2b05e2739d97c4180908c41099f7
|
|
| MD5 |
0c5baae9df686b24e423d9eabece5c9f
|
|
| BLAKE2b-256 |
3fcaa6eea494fd9980be0fd8c17a68823000b63ed842d429d12725d4976e5c75
|
Provenance
The following attestation bundles were made for rayzin-0.0.1.tar.gz:
Publisher:
release.yml on ljstrnadiii/rayzin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayzin-0.0.1.tar.gz -
Subject digest:
1536b23dab8493f65b179d48473e9bf13b5e2b05e2739d97c4180908c41099f7 - Sigstore transparency entry: 1339301479
- Sigstore integration time:
-
Permalink:
ljstrnadiii/rayzin@21c85435771a1e23431d818d399fec2d027c9320 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ljstrnadiii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@21c85435771a1e23431d818d399fec2d027c9320 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file rayzin-0.0.1-py3-none-any.whl.
File metadata
- Download URL: rayzin-0.0.1-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da66db752430f1d1fe17f32002b7a31bc6305a8660081bea89e94a18b03025a4
|
|
| MD5 |
2c7f6c6cc51e15570a3e413e29e67cb4
|
|
| BLAKE2b-256 |
4342ed978a01407df5f56cd14f06b7df2a5395afe6f08cb7559612021319f2f7
|
Provenance
The following attestation bundles were made for rayzin-0.0.1-py3-none-any.whl:
Publisher:
release.yml on ljstrnadiii/rayzin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayzin-0.0.1-py3-none-any.whl -
Subject digest:
da66db752430f1d1fe17f32002b7a31bc6305a8660081bea89e94a18b03025a4 - Sigstore transparency entry: 1339301489
- Sigstore integration time:
-
Permalink:
ljstrnadiii/rayzin@21c85435771a1e23431d818d399fec2d027c9320 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ljstrnadiii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@21c85435771a1e23431d818d399fec2d027c9320 -
Trigger Event:
workflow_run
-
Statement type: