innr
SIMD-accelerated vector similarity primitives.
Dual-licensed under MIT or Apache-2.0.
Why this exists
innr is the dependency you reach for when you need fast, well-tested vector math without
pulling in a full ANN index or ML framework. It is designed to sit under crates like jin,
retrieval pipelines, and evaluation tooling.
Quickstart
[]
= "0.1.1"
use ;
let a = ;
let b = ;
let d = dot; // 0.707
let c = cosine; // 0.707
let n = norm; // 1.0
Operations
| Function | Description |
|---|---|
dot |
Inner product |
norm |
L2 norm |
cosine |
Cosine similarity |
l2_distance |
Euclidean distance |
sparse_dot |
Sparse vector dot (sparse feature) |
maxsim |
ColBERT late interaction (maxsim feature) |
SIMD Dispatch
| Architecture | Instructions | Detection |
|---|---|---|
| x86_64 | AVX2 + FMA | Runtime |
| aarch64 | NEON | Always |
| Other | Portable | LLVM auto-vec |
Vectors < 16 dimensions use portable code.
Features
sparse— sparse vector operationsmaxsim— ColBERT late interaction scoringfull— all features
Best starting points
- Cosine / dot / norm:
cosine,dot,norm - Distances:
l2_distance - When using cosine: normalize once (or use an index that expects normalized vectors)
Performance

Apple Silicon (NEON). Run cargo bench to reproduce on your hardware.
For maximum performance, build with native CPU features:
RUSTFLAGS="-C target-cpu=native"
Or specify a portable baseline with SIMD:
# AVX2 (89% of x86_64 CPUs)
RUSTFLAGS="-C target-cpu=x86-64-v3"
# SSE2 only (100% compatible)
RUSTFLAGS="-C target-cpu=x86-64"
Run benchmarks:
Generate flamegraphs (requires cargo-flamegraph):
Tests
License
Dual-licensed under MIT or Apache-2.0.