Dicklesworthstone/fast_vector_similarity
High-performance vector similarity library in Rust with Python bindings: Spearman, Kendall, distance correlation, Jensen-Shannon, Hoeffding's D, and bootstrapped confidence intervals
What it solves
This library provides a high-performance way to calculate complex statistical similarity measures between vectors. It is designed to handle large datasets and high-dimensional data, such as text embeddings from language models, where standard correlation measures might be too slow or fail to capture non-linear relationships.
How it works
The library is built in Rust for speed, utilizing parallel processing via the rayon crate and vectorized operations via ndarray. It implements various statistical measures—including Spearman's rho, Kendall's tau, and Hoeffding's D—and uses optimized algorithms like merge sort for inversion counting to ensure efficiency. It also offers a bootstrapping feature to estimate the distribution of these measures for improved confidence. Python users can access these capabilities through bindings that return results in a simple JSON format.
Who it’s for
It is for data scientists, machine learning engineers, and researchers who need to perform rigorous statistical analysis on large-scale vector data, such as comparing the similarity of text embeddings generated by LLMs.
Highlights
- High-Performance Rust Core: Optimized for speed with parallel computation and vectorized operations.
- Diverse Statistical Measures: Includes Spearman's rho, Kendall's tau, Distance Correlation, Jensen-Shannon Dependency, Hoeffding's D, and Normalized Mutual Information.
- Robust Analysis: Features built-in bootstrapping to estimate result distributions and improve confidence.
- Python Integration: Seamlessly integrates into Python workflows via PyPI-installable bindings.
- LLM Ready: Specifically tested for handling high-dimensional text embeddings (e.g., 4096-dimensional vectors).
Related
- Project
- Project
- Project
- Project