Thanks to visit codestin.com
Credit goes to lib.rs

#vector-search #ann #embedding #rag #knn

annflat-core

Pure-Rust core for annflat: small in-memory flat-file ANN over f32 vectors

2 releases

0.1.1 May 10, 2026
0.1.0 May 9, 2026

#579 in Science

MIT/Apache

19KB
431 lines

Pure-Rust core for annflat. Flat brute-force ANN over (n, d) f32 vectors with cosine / L2 / inner-product metrics.

Cosine is implemented as inner product over L2-normalized vectors, so adding under the cosine metric runs an in-place normalization once at insert time. Subsequent search is a single matrix-vector dot.

score is "higher is better": for cosine it's the cosine similarity in [-1, 1], for inner product it's the dot, for L2 it's -distance (so the same top_k heap logic works across metrics).


annflat-core

Pure-Rust core for annflat. Flat-file ANN over f32 vectors with cosine, L2, or inner-product metrics.

License

Dual-licensed under MIT or Apache-2.0.

Dependencies

~2.8–4MB
~83K SLoC