rotorvec
Vector index using block-diagonal Clifford-rotor quantization with optional Walsh-Hadamard cross-block mixing. Four rotation variants, one API:
"planar2"— 2D Givens, O(d), cheapest"rotor3"— Cl(3,0) sandwich, O(d), default"iso4"— quaternion left-iso, O(d)"walshrotor3"✨ — signed FWHT then Cl(3,0) sandwich, O(d log d). Closes the recall gap on data with strong cross-coordinate correlations (image features, SIFT). Requiresdim ∈ {128, 256, 512, 1024, 2048, 4096}.
A block-diagonal cousin of turbovec
(TurboQuant): same compression and bit-plane layout, but the dense d×d
random rotation is replaced by small per-block rotors. Beats turbovec on
SIFT-1M recall (0.496 vs 0.487) at 1.8× faster build time when
"walshrotor3" is used.
See the main repo README for the full algorithm description, attribution, and benchmarks.
Install
pip install rotorvec
Wheels are built for Linux (x86_64, aarch64), macOS (x86_64, aarch64), and Windows (x64), abi3-py310 (one binary per platform covers Python 3.10–3.13).
Usage
import numpy as np
from rotorvec import RotorQuantIndex, IdMapIndex
# Default: Cl(3,0) rotors, 4-bit codes
index = RotorQuantIndex(dim=1536, bits=4)
# Or pick a variant explicitly
planar = RotorQuantIndex(dim=1536, bits=4, rotation="planar2")
iso = RotorQuantIndex(dim=1536, bits=4, rotation="iso4")
# Power-of-two dim → use walshrotor3 for the strongest recall
walsh = RotorQuantIndex(dim=1024, bits=4, rotation="walshrotor3")
vectors = np.random.randn(10_000, 1536).astype(np.float32)
queries = np.random.randn(8, 1536).astype(np.float32)
index.add(vectors)
scores, indices = index.search(queries, k=10) # (8, 10) float32 / int64
index.write("index.rv")
loaded = RotorQuantIndex.load("index.rv")
Stable external ids:
ids = np.array([1001, 1002, 1003], dtype=np.uint64)
m = IdMapIndex(dim=1536, bits=4, rotation="planar2")
m.add_with_ids(vectors[:3], ids)
scores, returned_ids = m.search(queries, k=3) # ids are uint64
m.remove(1002)
Accepted rotation values: "planar2", "rotor3" (default), "iso4",
"walshrotor3" (case-insensitive; aliases "givens", "clifford",
"quaternion", "walsh", "walsh-rotor3", "rotor3+walsh" also work).
Development
git clone https://github.com/smarthi/rotorvec
cd rotorvec/rotorvec-python
uv venv --python 3.10
uv pip install -e .
uv run pytest tests/
License
MIT — see LICENSE.
Metadata
Release files for rotorvec 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rotorvec-0.2.4.tar.gz | 58.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rotorvec-0.2.4-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| rotorvec-0.2.4-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| rotorvec-0.2.4-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| rotorvec-0.2.4-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 1.5 MB
Release files / rotorvec-0.2.4.tar.gz
| Download URL | rotorvec-0.2.4.tar.gz |
|---|---|
| Size | 58.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
473780473b3bd88f5882a6fa7b96f54363e0cc3763a3ba358681eb5bb1c4a928
|
|
BLAKE2b-256 checksum How to use checksums |
46bb6294e81f119b2725ac14da312237c6eea7a9b5f6dd7410d312c7d01fc011
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logRelease files / rotorvec-0.2.4-cp310-abi3-win_amd64.whl
| Download URL | rotorvec-0.2.4-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 264.1 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cfabf71fb5e8a551a819ba4e29dba457ee1dad3019b0954194b50691c05cabfc
|
|
BLAKE2b-256 checksum How to use checksums |
ea7edad97abf0e113590f556722b08e8cf289969c150cc63b08829c8af40ae8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logRelease files / rotorvec-0.2.4-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | rotorvec-0.2.4-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 407.4 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c2c5bf7f891ced6887156f8c1fd3685ce6cbc62ad29cbb1a65a055ff96aff29f
|
|
BLAKE2b-256 checksum How to use checksums |
2f3383eb011ed5521795ff49a081941304350cbd3374e87423c39b94b376258d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logRelease files / rotorvec-0.2.4-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | rotorvec-0.2.4-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 408.3 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5191957d494fda2a6b12f5bb5a3e1400061cff868dc093c5609f42cac83e43dd
|
|
BLAKE2b-256 checksum How to use checksums |
b5d89d63bd1f065376df69457ac5db01545c28e1b7de323286cc6470e83c7a2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logRelease files / rotorvec-0.2.4-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | rotorvec-0.2.4-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 368.7 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
90446af9af3c57c6abf1ac2be2e5f77670f3565fcaa28f898a2946a3c80ea6ad
|
|
BLAKE2b-256 checksum How to use checksums |
ab3b15bf3485eff2634c07883efddba8b5e741c59bd241684da1e9d86c46df75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency log