Skip to main content

Rust-native MUVERA retriever with Python bindings

Project description

muvera-rs

Rust-native MUVERA: multi-vector retrieval via fixed dimensional encodings, plus Python bindings for wheel builds.

PyPI project name: muvera-rs (import as muvera).

This repository is based on the paper.

Status

The active implementation is now Rust-first:

The legacy C++ remains in the repository on branch legacy_cpp for reference.

This repository is under active development.

Contributing

Build the Rust library

Create and activate the Conda environment first:

conda env create -f environment.yml
conda activate muvera-rust

If the environment already exists and you only want to refresh dependencies:

conda env update -f environment.yml --prune
conda activate muvera-rust

Then from the repository root:

cargo test

Build the Python wheel locally

maturin build --release

To install into the current environment:

maturin develop --release

Then in Python:

from muvera import MuveraRetriever

retriever = MuveraRetriever(
	dimensions=3,
	max_points=500,
	d_proj=128,
	d_final=10240,
	k_sim=10,
	r_reps=5,
	seed=42,
)

dataset = [
	[[1.0, 2.0, 3.0], [1.0, -2.0, 3.0]],
	[[4.0, 5.0, 6.0], [4.0, -5.0, 6.0]],
]

retriever.index_dataset(dataset, [1, 2])
print(retriever.get_top_k(dataset[0], 1))

Python build, test, and release

Local compile/test/package checks

After activating muvera-rust, from the repository root:

cargo test -p muvera-core
maturin develop --release
python -m pytest -q python/tests

rm -rf dist
maturin build --release --sdist -o dist
python -m twine check dist/*

GitHub Actions workflows

  • CI workflow: .github/workflows/python-ci.yml
    • Runs Rust tests, Python smoke tests, and package metadata checks on push/PR.
    • Builds a wheel with maturin build and installs it with pip for testing; it does not use maturin develop.
  • Release workflow: .github/workflows/python-release.yml
    • Manual only via GitHub Actions workflow_dispatch.
    • Builds wheels (Linux/macOS/Windows) and sdist.
    • Publishes to TestPyPI via manual dispatch (repository=testpypi).
    • Publishes to PyPI via manual dispatch (repository=pypi).

For publishing, configure trusted publishing in PyPI/TestPyPI for this repository so pypa/gh-action-pypi-publish can use OIDC (id-token: write).

Typical release flow:

conda activate muvera-rust

cargo test -p muvera-core
maturin develop --release
python -m pytest -q python/tests

rm -rf dist
maturin build --release --sdist -o dist
python -m twine check dist/*

git tag v0.1.1
git push origin v0.1.1

Then trigger .github/workflows/python-release.yml manually in GitHub Actions and choose repository=testpypi or repository=pypi.

Notes

  • The Rust port includes the full FDE pipeline and both retrievers.
  • The active MuveraRetriever is Rust-native and no longer compiles the legacy C++ DiskANN sources.
  • The Python package is configured through pyproject.toml for PyPI-compatible wheel builds.
  • The legacy C++ code is available on the legacy_cpp branch.

Acknowledgements

We sincerely appreciate Rajesh and other original authors for explaining to us the original experimental recipes and open sourcing the source code snippet with Google.

The index backend uses Microsoft DiskANN. We sincerely appreciate the open source efforts from folks at Microsoft.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

muvera_rs-0.1.0-cp39-abi3-win_amd64.whl (659.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

muvera_rs-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl (638.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

muvera_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (556.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file muvera_rs-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: muvera_rs-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 659.8 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for muvera_rs-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7e1c0be404dc931b953740adfff6d1696f772decf3128f08433129a7a4ef0a97
MD5 fcb921c04ab2601c3bdb30e5496d05a4
BLAKE2b-256 328b279f094540ce782c0fe1650dfd18accbca7eb78a45c10b40b517b0cc8d88

See more details on using hashes here.

Provenance

The following attestation bundles were made for muvera_rs-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: python-release.yml on SylviaZiyuZhang/muvera

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

File details

Details for the file muvera_rs-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for muvera_rs-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 248f7492220aceb0d586b7f22b319c92ca268f8517246754f257137c834cf9b4
MD5 86ee2a63c74244ce2af240b533ee42c9
BLAKE2b-256 c8c65af1c08699989f537bb1027f7a7f34c22a9c65dcc9282c56b4ab90ec2449

See more details on using hashes here.

Provenance

The following attestation bundles were made for muvera_rs-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl:

Publisher: python-release.yml on SylviaZiyuZhang/muvera

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

File details

Details for the file muvera_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for muvera_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb27a66e146ba0563771127d465da8f82e8c153434bf7873f273e30d851846b0
MD5 7b29e10640e164b05b00c98f91f41bab
BLAKE2b-256 37e779d2e1f5d82294c0fe4db46f39a74b59805d0596b9b40fb9b26962d1651a

See more details on using hashes here.

Provenance

The following attestation bundles were made for muvera_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python-release.yml on SylviaZiyuZhang/muvera

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