Skip to main content

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

ordvec-0.3.0.tar.gz (212.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ordvec-0.3.0-cp310-abi3-win_amd64.whl (412.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

ordvec-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (528.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

ordvec-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (498.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

ordvec-0.3.0-cp310-abi3-macosx_11_0_arm64.whl (461.3 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file ordvec-0.3.0.tar.gz.

File metadata

  • Download URL: ordvec-0.3.0.tar.gz
  • Upload date:
  • Size: 212.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ordvec-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bdcc4eb22b15a942be96f3aeb90980431e1fd126fa536e9c5b23bf5d8a1dc226
MD5 a56e5eaffe9f2c8329e03b7f0373dff3
BLAKE2b-256 f7a39fccb78cbea52de3ce42a90397a196a58585b9d828094bc0946ec07f28ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.3.0.tar.gz:

Publisher: release.yml on Fieldnote-Echo/ordvec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ordvec-0.3.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ordvec-0.3.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 412.9 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

Hashes for ordvec-0.3.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 57ddb419561bdf1ff976a330854c66c32fa010a0fc001bc7ab2a54404fadaedc
MD5 04757b8f1c6bddeeb31a59d14d131853
BLAKE2b-256 eb00408b13064457a6a1a7442c8b77a33a0227fbfb130f80bfd41c313d6b00c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.3.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on Fieldnote-Echo/ordvec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ordvec-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ordvec-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a1e06e946253f3cd15a80d832eddb1d3132a042d013e302b5d807c553bce05c
MD5 f52b8ac1435119fb5381c800771f4eb2
BLAKE2b-256 011d897ebe868d21ae5d08ef3dffd2118497e62cfa8dfc7dec163fd57272cf61

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Fieldnote-Echo/ordvec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ordvec-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ordvec-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c6359ff05827ce285e86a1e9ac459f802557ddd991775c3c00d2e641d96145ff
MD5 b46467fae63f6fad6af6cf5c7fef4232
BLAKE2b-256 c4d1cc93dd716ed8933722c2f510f62e5830fdb8f73c03a2c22e19fa70244ed7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Fieldnote-Echo/ordvec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ordvec-0.3.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ordvec-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6799e7d09a760057574e8c07954b01c9260625cf3da7f572053f8d6d0d73d019
MD5 6541164c37307c46e3531d9655ad4ce6
BLAKE2b-256 d143d9de2d102342e5548f3fc5eb42e94b26a9dcec6793fc04b31f9380e90324

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.3.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on Fieldnote-Echo/ordvec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page