arroy
Library Listed
Annoy-inspired Approximate Nearest Neighbors in Rust, based on LMDB and optimized for memory usage
- Downloads
- 22,053
- Dependents
- 6
- Stars
- 314
- Forks
- 18
- Contributors
- 8
- Commits
- 562
- Latest release
- 0.9.0 ·
About

Arroy (Approximate Rearest Reighbors Oh Yeah) is a Rust library with an interface close of the Annoy Python library to search for vectors in space that are near a targeted vector. It is based on LMDB, a memory-mapped key-value store, so many processes may share the same data and atomically modify the vectors.
Background
There are some other libraries to do nearest neighbor search. However, most of them are memory-bound, and none use LMDB for their storage. Annoy considered using LMDB as a backend since 2015. We built Meilisearch on top of LMDB; therefore, it was an obvious choice. As Annoy highly inspires it, we benefit from the same low memory footprint.
Why is this useful? If you want to find the nearest neighbors and have many CPUs, you only need to build the index once. Any thread will be able to query the LMDB-based index and will be able to do lookups immediately, even while another index is modifying it.
We use it inside Meilisearch. This library helps our users search for similar documents. Our users have many millions of them in a high-dimensional space (i.e., 768 on average and 1536 for OpenAI), so memory usage is a prime concern.
Read the full README
Arroy was built by @Kerollmops and @irevoire with the help of @dureuill in a week by porting the original C++ source code of Annoy.
Summary of features
- Euclidean distance, Manhattan distance, cosine distance, or Dot (Inner) Product distance
- Cosine distance is equivalent to Euclidean distance of normalized vectors i.e.,
sqrt(2-2*cos(u, v)) - Works better if you don't have too many dimensions (like <100) but seems to perform surprisingly well even up to 1,000 dimensions
- Small memory usage
- Lets you share memory between multiple processes using LMDB
- Index creation is separate from lookup (in particular, you can not add more items once the tree has been created)
- Build index on disk to enable indexing big datasets that won't fit into memory using LMDB
- Multithreaded tree building using rayon
- Additional features compared to Annoy
- Filter when querying
- Incrementally update the tree without rebuilding it from scratch
- Store and modify different indexes atomically using LMDB (indexes are identified by an
u16) - Modify the items list in place while performing queries using LMDB
- Storage based on LMDB using LMDB
- Safer to use API, i.e., check dimensions, distances, etc
- The database size does not depend on the highest item ID but on the number of items
- Generic over your random number generator
Missing features
- No Python support
- No Hamming distance support
- Generally slower due to the
log(n)lookups and non-aligned vectors due to LMDB
Tradeoffs
Only two main parameters are needed to tune Arroy: the number of trees n_trees and the number of nodes to inspect during searching search_k.
n_treesis provided during build time and affects the build time and the index size. A larger value will give more accurate results but larger indexes.search_kis provided in runtime and affects the search performance. A larger value will give more accurate results but will take a longer time to return.
If search_k is not provided, it will default to n * n_trees where n is the number of approximate nearest neighbors. Otherwise, search_k and n_trees are roughly independent, i.e., the value of n_trees will not affect search time if search_k is held constant and vice versa. Basically, it's recommended to set n_trees as large as possible given the amount of memory you can afford, and it's recommended to set search_k as large as possible given the time constraints you have for the queries.
How does it work
Using random projections and by building up a tree. At every intermediate node in the tree, a random hyperplane is chosen, which divides the space into two subspaces. This hyperplane is determined by sampling two points from the subset and taking the hyperplane equidistant from them.
We do this k times so that we get a forest of trees. k has to be tuned to your needs by looking at what tradeoff you have between precision and performance.
Dot Product distance (originally contributed by @psobot and @pkorobov) reduces the provided vectors from dot (or "inner-product") space to a more query-friendly cosine space using a method by Bachrach et al., at Microsoft Research, published in 2014.
Benchmarks
The benchmarks are available in another repository. It shows the performances of arroy in terms of recall, disk size usage, search and indexing performances with different parameters compared to other competitors.
Source code
It's all written in Rust and based on LMDB without a handful of ugly optimizations for performance and memory usage. You have been warned :)
The code should support Windows, thanks to LMDB and the Rust programming language.
Big thanks to the open-source community
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Required
- Binds native code: lmdb-master-sys
- Python bindings
- No Python binding crate found
- License
- MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Annoy-inspired Approximate Nearest Neighbors in Rust, based on LMDB and optimized for memory usage |
22,053 downloads over 30 days | 6 | 314 | 0.9.0 | GPU support unknown | Binds native code: lmdb-master-sys | MIT |
|
kiddo Featured
A high-performance, flexible, ergonomic k-d tree library. Ideal for geo- and astro- nearest-neighbour and k-nearest-neighbor queries |
481,504 downloads over 30 days | 56 | 179 | 6.3.0 | GPU support unknown | Build uses a native toolchain: cc (feature cpp_competitors) | Apache-2.0 OR MIT |
|
kdtree-rs Featured
K-dimensional tree in Rust for fast geospatial indexing and nearest neighbors lookup |
388,481 downloads over 30 days | 29 | 286 | 0.8.1 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
Fast approximate nearest neighbors |
15,542 downloads over 30 days | 13 | 268 | 0.11.0 | GPU support unknown | No native code found | MIT |
|
splintr Listed
Tokenizer for Rust and Python: pure Rust by default, with 18 bundled vocabularies and four backends covering BPE, SentencePiece and WordPiece. Its output matches Hugging Face tokenizers id for id on 14 model families, including GPT-2, Qwen, Whisper, T5 and BERT. Python bindings |
8,204 downloads over 30 days | 7 | 63 | 0.22.2 | GPU support unknown | Binds native code: pcre2-sys (feature pcre2) | MIT |
|
Graph-based Retrieval of Approximate Nearest Neighbors |
34 downloads over 30 days | 0 | 319 | 0.5.2 | GPU support unknown | Binds native code: blas, blas-sys (feature blas) | MIT |
|
instant-distance Archived
Fast minimal implementation of HNSW maps for approximate nearest neighbors searches |
96,520 downloads over 30 days | 36 | 343 | 0.6.1 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 0.5 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 314 stars, 18 forks and 8 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
What else the check found
- The last activity is on 22 Oct 2026, 18 days ago. The rules expect an update within 365 days. Dormancy rule
- The oldest outside issue waits 1034 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.9.0 base 140, raised to the 365-day floor: E = 365 daysdormancy: last activity 2026-10-22, 18 days ago, E = 365: activerot: oldest unanswered issue 1034 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 0.5 < 11 and new_adopters 0 < 9 and repository route stars 314 (needs 4539), forks 18 (needs 434), contributors 8 (needs 79)listed: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption1 active dependents, 0 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 0.5 | crates.io database dump | Yes | |
| New dependents (365 days) | 0 | crates.io database dump | Yes | |
| Peak active dependents | 4.25 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 0.9313 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 12 months ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2025-10-16 | GitHub repository | Yes | |
| Latest release | 2026-10-22 | crates.io database dump | Yes | |
| First release | 2023-11-30 | crates.io database dump | Yes | |
| Latest version | 0.9.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 1034 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution14 releases, 22,053 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 14 | crates.io database dump | Yes | |
| Downloads over 30 days | 22053 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository314 stars, 18 forks, 8 contributors, 562 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 314 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 18 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 8 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 562 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: lmdb-master-sys | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 6 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.