Skip to main content

MuvFDE

MuvFDE turns the token embeddings for a query or document into one fixed-dimensional encoding (FDE) using Google's MUVERA algorithm. Index document FDEs for maximum inner product search, then rerank the retrieved candidates with MaxSim on their original token embeddings. Google Research overview · MUVERA paper

PyPI version Tests Downloads License

Install

python -m pip install --upgrade muvfde

The build matrix covers standard CPython 3.10–3.15. The release workflow builds x86-64 Linux wheels for glibc and musl. Source builds require a C++20 compiler, and pip installs the build dependencies, including CMake 4.4.5 or newer and nanobind 3.1 or newer. NumPy is installed as a runtime dependency.

Encode a query and a document

Pass a two-dimensional NumPy array of finite float32 values with shape (num_tokens, embedding_dim). Each output is a one-dimensional NumPy float32 array. Use token embeddings from the same model and keep the dimensionality, seed, and sketch settings aligned between queries and documents.

import muvfde as m
import numpy as np


def make_config(document=False):
    config = (
        m.fixed_dimensional_encoding_config()
        .set_num_repetitions(20)
        .set_num_simhash_projections(5)
        .set_seed(42)
        .set_projection_type(m.projection_type.AMS_SKETCH)
        .set_projection_dimension(16)
    )
    if document:
        config.set_encoding_type(m.encoding_type.AVERAGE).enable_fill_empty()
    return config


query_tokens = np.array([[1, 0, 0], [0, 1, 0]], dtype=np.float32)
document_tokens = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.float32)

query_fde = m.generate_fixed_dimensional_encoding(query_tokens, make_config())
document_fde = m.generate_fixed_dimensional_encoding(document_tokens, make_config(document=True))

score = float(query_fde @ document_fde)
assert query_fde.shape == document_fde.shape == (10_240,)

Configuration

Property Default Behavior
num_repetitions 1 Positive number of independently seeded repetitions.
num_simhash_projections 0 Number of SimHash bits (0–30). Each additional bit doubles the number of partitions per repetition.
seed 1 Signed 32-bit seed. Repetition seeds advance in unsigned 32-bit arithmetic.
encoding_type DEFAULT_SUM Use DEFAULT_SUM for queries and AVERAGE for documents.
projection_type DEFAULT_IDENTITY Identity retains the input width. AMS_SKETCH maps each input coordinate to one signed output coordinate.
projection_dimension 0 Required positive output width for AMS_SKETCH. Identity uses the input width.
fill_empty_partitions False Documents can copy the point with the closest SimHash into an empty partition. Ties use the first input row.
final_projection_dimension 0 A positive value applies CountSketch to the concatenated encoding. Zero disables this step.

The uncompressed length is num_repetitions × 2**num_simhash_projections × projection_width. The final CountSketch changes the returned length and still processes the full uncompressed encoding. Input width must be positive. An input with zero token rows returns a zero vector of the configured output length. Invalid settings raise ValueError, and an unrepresentably large encoding raises OverflowError.

Use the raw FDE dot product for candidate retrieval. Keep the model's query/document prompts, token masks and preprocessing consistent. Choose the projection settings and candidate count using retrieval measurements on your data. Persist the model revision, preprocessing, encoder build, and config with your index. Implementation compatibility and audit

Retrieval benchmark

The NFCorpus test benchmark uses LightOn's LateOn-regularized, the highest-scoring model in the linked English NanoBEIR comparison and a checkpoint trained with MUVERA compression in mind. The benchmark measures full-corpus MaxSim, FDE dot product, and MaxSim reranking of FDE candidates, with and without mean-centering the token embeddings used for FDEs. Sentence Transformers comparison · LightOn model card

python -m pip install -e .
python -m pip install -r integeration_test/requirements.txt
python integeration_test/benchmark.py --candidates 100

LateOn benchmark results · Historical ColBERT and Jina results

Test and release

python -m pip install -e . pytest
python -m pytest

A push to main runs test CI for code and build changes. A tag push records the release version. PyPI updates after a GitHub Release is published for that tag and the Wheels workflow successfully uploads the distributions using the repository's pypi_password secret. The tag determines the package version through setuptools-scm. Publish v0.0.10 against the tested commit to release muvfde==0.0.10. Wheels workflow

Metadata

Release files for muvfde 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muvfde 0.0.10
File Size Uploaded Provenance Actions
muvfde-0.0.10.tar.gz 1.0 MB Without provenance Details for muvfde-0.0.10.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for muvfde 0.0.10
File Actions
muvfde-0.0.10-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for muvfde-0.0.10-cp312-abi3-musllinux_1_2_x86_64.whl
muvfde-0.0.10-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for muvfde-0.0.10-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
muvfde-0.0.10-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details for muvfde-0.0.10-cp311-cp311-musllinux_1_2_x86_64.whl
muvfde-0.0.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for muvfde-0.0.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
muvfde-0.0.10-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details for muvfde-0.0.10-cp310-cp310-musllinux_1_2_x86_64.whl
muvfde-0.0.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for muvfde-0.0.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 2.0 MB

Release files / muvfde-0.0.10.tar.gz

Download URL muvfde-0.0.10.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a549bcf43423e6210f1ab5db16ea175e3cddf0d9614184cd9015ea26a4305c84
BLAKE2b-256 checksum
How to use checksums
886c0483515825ae07f5e6484a6708039ed817e8f5b052d53d0b684f40271bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL muvfde-0.0.10-cp312-abi3-musllinux_1_2_x86_64.whl
Size 208.2 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
ea3932278a3f13b825e4c7f36199f2f49f6ea7195c9dcc766bdee161411a5ec4
BLAKE2b-256 checksum
How to use checksums
1f22b0c53a615601eb00cbc75db53637bd61f0613dca8a7d17260dc9d830cb8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL muvfde-0.0.10-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 111.5 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0ddb2838d1e0c616671c9a499adf93c3ede29d74eb172ba2eca72d749a420668
BLAKE2b-256 checksum
How to use checksums
237a8a3195b886ce464b1c0378763e7d6642bd395446b524685fbf9e1c85e6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL muvfde-0.0.10-cp311-cp311-musllinux_1_2_x86_64.whl
Size 213.3 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
a0c2bf9a4dd88362c8d27aeda808c446ff68a4332207ac5686c9e99690bec371
BLAKE2b-256 checksum
How to use checksums
1c8f1dcbcc05f588960fe10f035238eaeed7f2c2c1644a59ff1da19ff03649c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL muvfde-0.0.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 116.6 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4124636e0bd813c89d74441349533b6301f03384eb167f24f7e290a15070d925
BLAKE2b-256 checksum
How to use checksums
6b6243523f1ab82d42af989242522ca41ee597fd7ef61b88d75155ea4c4bfdb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL muvfde-0.0.10-cp310-cp310-musllinux_1_2_x86_64.whl
Size 213.2 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
530749183ff374faf287cdf2d947985dfa1686070daebcdcc09d909c346258a0
BLAKE2b-256 checksum
How to use checksums
f0181f0acf0dc8748be92587b8d59d2e3a94095ec98d173a41060a17464773cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / muvfde-0.0.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL muvfde-0.0.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 116.3 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b9d14ab7073d11b88a14f1377ad1ee495092051bc3da01c86b96098de7340c58
BLAKE2b-256 checksum
How to use checksums
108ecbd068cbf622d32aa1d9c43622f38515a8457897cb0b5be492657272bb1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for muvfde 0.0.10

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page