Training-free ordinal & sign quantization for compressed vector retrieval
Project description
ordvec (Python)
Python bindings for ordvec — a
training-free ordinal & sign vector-quantization library for compressed
nearest-neighbour retrieval over high-dimensional embeddings. Pure-Rust core,
zero system dependencies; SIMD-accelerated at runtime (AVX-512 / AVX2 / scalar).
import numpy as np
import ordvec
q = ordvec.RankQuant(1024, 2) # 1024-dim, 2 bits/coord
q.add(np.random.randn(10_000, 1024).astype(np.float32))
# asymmetric: full-precision float queries vs bucketed docs (recommended)
scores, ids = q.search_asymmetric(np.random.randn(8, 1024).astype(np.float32), k=10)
Classes
| Class | Purpose |
|---|---|
Rank |
Full-precision rank vectors (u16 per coordinate). |
RankQuant |
Bucketed ranks, bits ∈ {1, 2, 4}; symmetric + asymmetric (float-query LUT) scoring. |
Bitmap |
Constant-weight top-bucket bitmap per document; popcount(Q AND D) candidate scoring. |
SignBitmap |
Sign bitmap for sign-cosine candidate generation; separate from the constant-weight bitmap theorem. |
Theory and calibration
Bitmap exposes the constant-weight top-bucket overlap statistic formalized in
ordvec-formalization.
In that finite Lean model, literal bitmap overlap is the query-preserving
quotient statistic, an overlap threshold is Bayes-optimal under explicit
monotone-overlap assumptions, and the idealized uniform constant-weight null
calibrates that threshold by the hypergeometric upper tail.
This is not a deployment guarantee for every encoder or corpus. Real-corpus recall, monotonicity, and null fit remain empirical diagnostics.
Installation
pip install ordvec
Wheels target CPython 3.10+ (abi3) and require numpy>=2.2. Building from
source needs a Rust toolchain (MSRV 1.89) and
maturin.
Provenance & license
The ordvec Python bindings were developed within turbovec, factored out
into this standalone package. turbovec
(MIT, by Ryan Codrai) is credited as
the origin project.
Dual-licensed under either of MIT or Apache-2.0 at your option.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 ordvec-0.4.0.tar.gz.
File metadata
- Download URL: ordvec-0.4.0.tar.gz
- Upload date:
- Size: 235.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db3976ef250499dfe2206756444914a08c0bd52c5c90b840fb93f2b116649480
|
|
| MD5 |
2723edc5f0a22347e6ae10c5b229f2a5
|
|
| BLAKE2b-256 |
399f5a8f916260603ccaf7f2c2df8acab419dabc4276db0933dd0cb057f7d4b6
|
Provenance
The following attestation bundles were made for ordvec-0.4.0.tar.gz:
Publisher:
release.yml on Fieldnote-Echo/ordvec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ordvec-0.4.0.tar.gz -
Subject digest:
db3976ef250499dfe2206756444914a08c0bd52c5c90b840fb93f2b116649480 - Sigstore transparency entry: 1771642754
- Sigstore integration time:
-
Permalink:
Fieldnote-Echo/ordvec@d7d11827a67e5a181c554b13e30df4de07143760 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Fieldnote-Echo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7d11827a67e5a181c554b13e30df4de07143760 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ordvec-0.4.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: ordvec-0.4.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 431.1 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0740aa4821bac0d4594286810227278ee37f01e342700b3ebefc5a764cf35d2
|
|
| MD5 |
73a9fc58a897ca89b87ab398db718291
|
|
| BLAKE2b-256 |
205f1ab655ec8e10e16a915834b3feaba99b7c4d6ecdf646d8fc346274636d7c
|
Provenance
The following attestation bundles were made for ordvec-0.4.0-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on Fieldnote-Echo/ordvec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ordvec-0.4.0-cp310-abi3-win_amd64.whl -
Subject digest:
e0740aa4821bac0d4594286810227278ee37f01e342700b3ebefc5a764cf35d2 - Sigstore transparency entry: 1771642865
- Sigstore integration time:
-
Permalink:
Fieldnote-Echo/ordvec@d7d11827a67e5a181c554b13e30df4de07143760 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Fieldnote-Echo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7d11827a67e5a181c554b13e30df4de07143760 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 540.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b4b8f38b8a0d127b0193dc5effc9271f84709b92c1a88539ee87c20e1f16dfe
|
|
| MD5 |
c7854380ec1b60ba4233280823504863
|
|
| BLAKE2b-256 |
111a692a31c6707555d7041e7f27d7645e5d35158ff29f448eec17433b74d411
|
Provenance
The following attestation bundles were made for ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on Fieldnote-Echo/ordvec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5b4b8f38b8a0d127b0193dc5effc9271f84709b92c1a88539ee87c20e1f16dfe - Sigstore transparency entry: 1771643026
- Sigstore integration time:
-
Permalink:
Fieldnote-Echo/ordvec@d7d11827a67e5a181c554b13e30df4de07143760 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Fieldnote-Echo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7d11827a67e5a181c554b13e30df4de07143760 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 516.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f16420dade4b2aa19b5be76edaea5fbcfa67b5b93fc67b4d94756db4302be7
|
|
| MD5 |
2337b249a98b372a63f413b4aa98aa24
|
|
| BLAKE2b-256 |
29142e97c7d4acad1dd4a30ecf8136d503d923c1b3bb2c9f24c7fb64c955936e
|
Provenance
The following attestation bundles were made for ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on Fieldnote-Echo/ordvec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
96f16420dade4b2aa19b5be76edaea5fbcfa67b5b93fc67b4d94756db4302be7 - Sigstore transparency entry: 1771642950
- Sigstore integration time:
-
Permalink:
Fieldnote-Echo/ordvec@d7d11827a67e5a181c554b13e30df4de07143760 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Fieldnote-Echo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7d11827a67e5a181c554b13e30df4de07143760 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 477.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58600bfbff5f4fd06a8baee6277bb6cc46abaa293eacd5df584db94bfb209d1b
|
|
| MD5 |
f86c32cc304b8171d46a940b06f64188
|
|
| BLAKE2b-256 |
d3adaff896503264dccc5e7326907e874a66aae2306e8f01de34ef47555315d7
|
Provenance
The following attestation bundles were made for ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on Fieldnote-Echo/ordvec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
58600bfbff5f4fd06a8baee6277bb6cc46abaa293eacd5df584db94bfb209d1b - Sigstore transparency entry: 1771642818
- Sigstore integration time:
-
Permalink:
Fieldnote-Echo/ordvec@d7d11827a67e5a181c554b13e30df4de07143760 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Fieldnote-Echo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7d11827a67e5a181c554b13e30df4de07143760 -
Trigger Event:
push
-
Statement type: