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.4.0.tar.gz (235.4 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.4.0-cp310-abi3-win_amd64.whl (431.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (540.8 kB view details)

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

ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (516.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl (477.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

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

Hashes for ordvec-0.4.0.tar.gz
Algorithm Hash digest
SHA256 db3976ef250499dfe2206756444914a08c0bd52c5c90b840fb93f2b116649480
MD5 2723edc5f0a22347e6ae10c5b229f2a5
BLAKE2b-256 399f5a8f916260603ccaf7f2c2df8acab419dabc4276db0933dd0cb057f7d4b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.4.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.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

Hashes for ordvec-0.4.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e0740aa4821bac0d4594286810227278ee37f01e342700b3ebefc5a764cf35d2
MD5 73a9fc58a897ca89b87ab398db718291
BLAKE2b-256 205f1ab655ec8e10e16a915834b3feaba99b7c4d6ecdf646d8fc346274636d7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ordvec-0.4.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.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ordvec-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b4b8f38b8a0d127b0193dc5effc9271f84709b92c1a88539ee87c20e1f16dfe
MD5 c7854380ec1b60ba4233280823504863
BLAKE2b-256 111a692a31c6707555d7041e7f27d7645e5d35158ff29f448eec17433b74d411

See more details on using hashes here.

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

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.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ordvec-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96f16420dade4b2aa19b5be76edaea5fbcfa67b5b93fc67b4d94756db4302be7
MD5 2337b249a98b372a63f413b4aa98aa24
BLAKE2b-256 29142e97c7d4acad1dd4a30ecf8136d503d923c1b3bb2c9f24c7fb64c955936e

See more details on using hashes here.

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

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.4.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ordvec-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 58600bfbff5f4fd06a8baee6277bb6cc46abaa293eacd5df584db94bfb209d1b
MD5 f86c32cc304b8171d46a940b06f64188
BLAKE2b-256 d3adaff896503264dccc5e7326907e874a66aae2306e8f01de34ef47555315d7

See more details on using hashes here.

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

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