SIMD-optimized library for similarity metrics in Python, Rust, C, JS, and Swift
Top 29.0% on sourcepulse
SimSIMD is a high-performance, mixed-precision math library designed to accelerate vector operations for machine learning, scientific computing, and data retrieval. It offers a broad range of distance and similarity metrics, supporting various data types from float64 down to bit vectors, and is optimized for both x86 (AVX2, AVX-512) and Arm (NEON, SVE, SVE2) architectures.
How It Works
SimSIMD leverages extensive SIMD (Single Instruction, Multiple Data) optimizations to achieve near-memcpy speeds for vector operations. Its core design principle is to maximize hardware utilization, offering significant speedups (up to 200x) over traditional libraries like NumPy and SciPy. It achieves this through techniques such as Horner's method for polynomial approximations, masked loads to eliminate loop tails, and custom Newton-Raphson iterations for reciprocal square roots to improve accuracy and speed. The library also prioritizes mixed-precision computations, using higher-precision accumulators to prevent overflow and maintain accuracy, especially with lower-precision inputs like float16 and bfloat16.
Quick Start & Requirements
pip install simsimd
python -c "import simsimd; print(simsimd.get_capabilities())"
python -c "import simsimd; help(simsimd)"
Highlighted Details
Maintenance & Community
The project is actively maintained by ashvardanian. Community interaction and contributions are encouraged via GitHub issues and pull requests.
Licensing & Compatibility
Licensed under Apache 2.0 or the Three-clause BSD license, allowing for commercial use and integration into closed-source projects.
Limitations & Caveats
Some benchmarks are marked as "in progress" (🚧), indicating ongoing development or potential issues. While the library aims for broad compatibility, specific performance characteristics may vary across different CPU generations and microarchitectures.
3 weeks ago
Inactive