Skip to content

Releases: ashvardanian/SimSIMD

v6.5: Half-Precision `f16` & `bf16` Numbers in Rust 🦀

07 Jul 12:46
Compare
Choose a tag to compare

SimSIMD has historically been one of the largest collections of mixed-precision kernels, but f32 to/from f16 and bf16 conversion operators have never been exposed to bindings. This release is the first step in that direction. I look forward to everyone's suggestions on how to further improve the Rust API. Thanks 🤗


Here's an example:

use simsimd::{SpatialSimilarity, f16, bf16};

// Process embeddings at different precisions for speed vs accuracy trade-offs
let embeddings_f32 = vec![1.0, 2.0, 3.0, 4.0];
let query_f32 = vec![0.5, 1.5, 2.5, 3.5];

// Convert to f16 for memory efficiency (2x compression)
let embeddings_f16: Vec<f16> = embeddings_f32.iter()
    .map(|&x| f16::from_f32(x))
    .collect();
let query_f16: Vec<f16> = query_f32.iter()
    .map(|&x| f16::from_f32(x))
    .collect();

// Convert to bf16 for ML workloads (better range than f16)
let embeddings_bf16: Vec<bf16> = embeddings_f32.iter()
    .map(|&x| bf16::from_f32(x))
    .collect();
let query_bf16: Vec<bf16> = query_f32.iter()
    .map(|&x| bf16::from_f32(x))
    .collect();

// Hardware-accelerated similarity at different precisions
let similarity_f32 = f32::cosine(&embeddings_f32, &query_f32).unwrap();
let similarity_f16 = f16::cosine(&embeddings_f16, &query_f16).unwrap();
let similarity_bf16 = bf16::cosine(&embeddings_bf16, &query_bf16).unwrap();

println!("Cosine similarities:");
println!("f32:  {:.6}", similarity_f32);   // Full precision
println!("f16:  {:.6}", similarity_f16);   // 2x memory savings
println!("bf16: {:.6}", similarity_bf16);  // ML-optimized range

// Natural arithmetic operations work seamlessly
let scaled_f16 = embeddings_f16.iter()
    .map(|&x| x * f16::from_f32(2.0) + f16::ONE)
    .collect::<Vec<_>>();

// Direct bit manipulation when needed
let raw_bits = embeddings_f16[0].0; // Access underlying u16
let reconstructed = f16(raw_bits);

Minor

  • Add: Half-precision converters for C/Rust (bf5a7d2)

Patch

  • Improve: Support more numeric operators in Rust (1d7b2b8)
  • Improve: Rust nostd builds (c6c0698)
  • Make: Bump dependencies (3667313)
  • Fix: Expose Distance in Rust (e0c69c7)

v6.4.10: Multi-threading in Python 3.13t

06 Jul 13:50
Compare
Choose a tag to compare

Other minor tweaks:

  • bf16 L2 calculation in Rust
  • flushing denormals in Rust
  • nonnull build warnings in GCC & Clang
  • upgrading JS dependencies

Patch

  • Fix: Require NumPy for GIL tests (529b0dd)
  • Improve: Free threading examples & checks (83e522a)
  • Make: Enable free-threading CIBW builds (0093c3f)
  • Docs: Setting up uv env (8dc7012)
  • Improve: GIL-free batch-processing in Py (eb234d5)
  • Make: Drop Python 3.7 for 3.13t (fc62de4)
  • Improve: Flushing denormals in Rust (1c1e608)
  • Docs: Top-level script instructions (d17c9a9)
  • Fix: Typos & auto-formatting (7bca0e3)
  • Make: Bump JS deps (440d3e5)
  • Fix: Avoid nonull attribute warning on GCC (f14db4a)
  • Fix: Wrong SpatialSimilarity::<bf16>::l2 dispatch (00ad454)

Release v6.4.9

08 Jun 03:22
Compare
Choose a tag to compare

Release: v6.4.9 [skip ci]

Patch

v6.4.8: Supporting R-profile Arm CPUs 💪

06 Jun 21:51
Compare
Choose a tag to compare
  • Fix: GCC can't handle v8.0-a decimal (4116f8a)
  • Fix: f16, i8, bf16 compile-time dispatch (29c0f46)
  • Docs: Globally unset DEVELOPER_DIR (22bb40b)
  • Fix: Check for NEON for R-profile CPUs (a6bbf9e)
  • Make: Lower armv8.2 to armv8.0 requirement (31fbdcd)
  • Improve: Set nonnull attributes (fc61d19)
  • Docs: Unset DEVELOPER_DIR on macOS (69c6614)
  • Make: Bump Google Benchmark (cca25a0)
  • Docs: Refresh C example (73e6ccb)

Release v6.4.7

01 Jun 13:13
Compare
Choose a tag to compare

Release: v6.4.7 [skip ci]

Patch

  • Make: Differentiate cibw uploads (9116b2a)

Release v6.4.6

01 Jun 07:14
Compare
Choose a tag to compare

Release: v6.4.6 [skip ci]

Patch

  • Fix: Deno testing CLI commands (be8acfb)
  • Make: Bump vulnerable JS deps (506b816)
  • Make: Checking env. variables on macOS (6cb256f)
  • Make: Try compiling wheels with different flags (77870cf)
  • Make: Enable Deno to run pre-builds (71b3412)
  • Make: Set f16c flag for _cvtss_sh (1215418)
  • Fix: Pedantic _Float16 cast warnings (3230095)
  • Make: Overwrite JS bundles (c252f84)
  • Fix: Missing avx512dq flags (ace4f7e)

Release v6.4.5

30 May 14:08
Compare
Choose a tag to compare

Release: v6.4.5 [skip ci]

Patch

  • Fix: Aliasing of half-precision types (abb2d88)

Release v6.4.4

13 May 20:29
Compare
Choose a tag to compare

Release: v6.4.4 [skip ci]

Patch

Release v6.4.3

24 Apr 17:40
Compare
Choose a tag to compare

Release: v6.4.3 [skip ci]

Patch

  • Fix: Use correct type in sparse dot-product macro (354a6b8)

Release v6.4.2

23 Apr 13:40
Compare
Choose a tag to compare

Release: v6.4.2 [skip ci]

Patch