USearch v2 ended up inside ClickHouse, DuckDB, YugabyteDB, TiDB and ScyllaDB, some AI labs, and government agencies around the globe. It never leaned on BLAS, carried its own SIMD kernels for more hardware than almost any library, and beat Meta’s FAISS by 10-100× in common scenarios. Yet, compared to v3, the v2 is an absolute toy.
A big part of modern software still runs on one CPU core at a time. Most of the rest scales poorly, and still believes thread pools and task queues are the same thing… And almost all of it keeps its data in RAM, which is neither the largest pool of memory in your computer, nor the fastest. v3 is by far the most hardware-friendly software we have ever written. It still searches vectors on CPUs, NUMA node by NUMA node, but more importantly:
- It parallelizes better, from CPU cores to GPUs with thousands of them.
- It scales further, onto SSD pools beside RAM and VRAM, up to a trillion vectors on one machine, without glue or networking.
- It navigates more, from dense vectors to 3D shapes, string-like sequences, and geospatial data, out of the box.
This post tours our biggest innovations. If you’d rather ask your agent what v3 can do for you, feed it this:
curl -sL https://www.unum.cloud/docs/usearch/llms.txt | claude -p "Let's learn more about USearch v3!"§ Bandwidth Is in GPUs, Scale Is on SSDs, and RAM Has Neither
A modern server is a hierarchy of memories, and the CPU is rarely the largest part of it. NVIDIA rates a DGX B300 at about 14 kW, of which its two Xeon sockets draw 700 W. The rest feeds eight GPUs with 2.3 TB of HBM3e between them, while the largest pools of bytes sit on the NVMe drives. Software that only uses RAM leaves most of that machine idle.
Power ≈ 14.0 kW
Capacity ≈ 35.0 TB
- 8 × B300 · HBM3e 12.8 kW · 2.3 TB
- 2 × Xeon 6776P · DDR5 1.0 kW · 2.0 TB
- 8 × E1.S · NVMe 0.2 kW · 30.7 TB
Each tier asks for a different program. CPUs handle irregular, latency-bound work well, but have few cores and modest bandwidth next to the accelerators beside them. GPUs bring tens of thousands of lanes and terabytes per second, but only over their own memory, and a graph walk is the opposite of the dense, regular work they were designed for. SSDs hold orders of magnitude more than either, but turn every hop of a walk into a separate read with tens of microseconds of latency.
USearch v2 picked RAM and stayed there. v3 treats all three as places an index can live, which we call residencies, and shards each along the hardware it is made of:
- RAM shards follow memory domains, so on a dual-socket server no walk crosses the socket link.
- VRAM shards follow devices, one or more per GPU, and never page to the host.
- NVMe views follow checkpoint parts, read in place through
io_uringor SPDK, without loading the graph into memory.
Sharding partitions the entries rather than replicating the graph, and all three residencies read and write the same SafeGraphs checkpoints, so a graph built in one opens in any other:
Python · RAM
from usearch import Arena, DenseIndex, DenseMetric, Executor, Scalar
pool = Executor.for_ram() # threads pinned to memory domains
index = DenseIndex.init_ram(96, DenseMetric.EUCLIDEAN, Scalar.BF16, connectivity=64)
index.on(pool).insert(keys, vectors) # one shard per memory domain
index.on(pool).refine()
matches = index.on(pool).search(queries, 10, Arena(pool))Python · VRAM
from usearch import Arena, DenseIndex, DenseMetric, Executor, Scalar
pool = Executor.for_vram(devices=range(8)) # one stream per GPU
index = DenseIndex.init_vram(96, DenseMetric.EUCLIDEAN, Scalar.BF16, connectivity=64, devices=range(8))
index.on(pool).insert(keys, vectors) # one shard per GPU
index.on(pool).refine()
index.on(pool).save("deep.safegraphs.json") # one part per shard
matches = index.on(pool).search(queries, 10, Arena(pool)) Python · NVMe
from usearch import Arena, DenseIndex, DenseMetric, Executor, Scalar
pool = Executor.for_nvme(paths=["/mnt/nvme0", "/mnt/nvme1"]) # one ring per worker
index = DenseIndex.view_nvme("deep.safegraphs.json", executor=pool) # read-only, in place
matches = index.on(pool).search(queries, 10, Arena(pool)) Rust · RAM
use usearch::*;
let options = DenseOptions { dimensions: 96, metric: DenseMetric::Euclidean, quantization: Scalar::BF16,
connectivity: 64, ..DenseOptions::default() };
let pool = Executor::for_ram(&[], None, 0)?; // threads pinned to memory domains
let index = DenseIndex::init_ram(&options, &[])?;
index.on(&pool).insert(&keys, &rows(&vectors, 96)?)?; // one shard per memory domain
index.on(&pool).refine(DenseRefineConfig::default())?;
let mut arena = Arena::new_in(&pool)?;
let matches = index.on(&pool).search(&rows(&queries, 96)?, 10, &mut arena)?; Rust · VRAM
use usearch::*;
let options = DenseOptions { dimensions: 96, metric: DenseMetric::Euclidean, quantization: Scalar::BF16,
connectivity: 64, ..DenseOptions::default() };
let gpus = [0, 1, 2, 3, 4, 5, 6, 7];
let pool = unsafe { Executor::for_vram(&gpus, None, &[], 0)? }; // one stream per GPU
let index = DenseIndex::init_vram(&options, &gpus)?;
index.on(&pool).insert(&keys, &rows(&vectors, 96)?)?; // one shard per GPU
index.on(&pool).refine(DenseRefineConfig::default())?;
index.on(&pool).save("deep.safegraphs.json")?; // one part per shard
let mut arena = Arena::new_in(&pool)?;
let matches = index.on(&pool).search(&rows(&queries, 96)?, 10, &mut arena)?; Rust · NVMe
use usearch::*;
let pool = Executor::for_nvme(&["/mnt/nvme0", "/mnt/nvme1"], None, 0)?; // one ring per worker
let index = DenseIndex::view_nvme("deep.safegraphs.json")?; // read-only, in place
let mut arena = Arena::new_in(&pool)?;
let matches = index.on(&pool).search(&rows(&queries, 96)?, 10, &mut arena)?; C++ · RAM
#include <usearch/dense_index.hpp>
namespace us = unum::usearch;
auto [pool, pool_status, pool_message] = us::executor_t::for_ram(); // threads pinned to memory domains
auto [index, index_status, index_message] = us::dense_index_t::init_ram({
.metric = usearch_dense_metric_euclidean_k, .quantization = usearch_scalar_bf16_k,
.dimensions = 96, .connectivity = 64});
index.insert({.count = count, .keys = {keys, sizeof(usearch_key_t)},
.vectors = {vectors, sizeof(float) * 96, 96, usearch_scalar_f32_k}}, pool); // one shard per memory domain
index.refine({}, pool);
auto [arena, arena_status, arena_message] = us::arena_t::make({.executor = pool.handle()});
auto [matches, status, message] = index.search(
{.count = queries_count, .queries = {queries, sizeof(float) * 96, 96, usearch_scalar_f32_k}, .wanted = 10},
arena, pool); C++ · VRAM
#include <usearch/dense_index.hpp>
namespace us = unum::usearch;
auto bytes = [](std::string_view text) {
return usearch_bytes_view_t {reinterpret_cast<usearch_byte_t const*>(text.data()), text.size()};
};
std::int32_t const gpus[] = {0, 1, 2, 3, 4, 5, 6, 7};
usearch_vram_options_t const vram = {.devices = gpus, .devices_count = 8};
auto [pool, pool_status, pool_message] = us::executor_t::for_vram({.vram = vram}); // one stream per GPU
auto [index, index_status, index_message] = us::dense_index_t::init_vram({
.metric = usearch_dense_metric_euclidean_k, .quantization = usearch_scalar_bf16_k,
.dimensions = 96, .connectivity = 64, .vram = vram});
index.insert({.count = count, .keys = {keys, sizeof(usearch_key_t)},
.vectors = {vectors, sizeof(float) * 96, 96, usearch_scalar_f32_k}}, pool); // one shard per GPU
index.refine({}, pool);
index.save({.path = bytes("deep.safegraphs.json")}, pool); // one part per shard
auto [arena, arena_status, arena_message] = us::arena_t::make({.executor = pool.handle()});
auto [matches, status, message] = index.search(
{.count = queries_count, .queries = {queries, sizeof(float) * 96, 96, usearch_scalar_f32_k}, .wanted = 10},
arena, pool); C++ · NVMe
#include <usearch/dense_index.hpp>
namespace us = unum::usearch;
auto bytes = [](std::string_view text) {
return usearch_bytes_view_t {reinterpret_cast<usearch_byte_t const*>(text.data()), text.size()};
};
usearch_bytes_view_t const drives[] = {bytes("/mnt/nvme0"), bytes("/mnt/nvme1")};
usearch_nvme_options_t const nvme = {.paths = drives, .paths_count = 2};
auto [pool, pool_status, pool_message] = us::executor_t::for_nvme({.nvme = nvme}); // one ring per worker
auto [index, index_status, index_message] = us::dense_index_t::view_nvme(
{.path = bytes("deep.safegraphs.json"), .nvme = nvme}, pool); // read-only, in place
auto [arena, arena_status, arena_message] = us::arena_t::make({.executor = pool.handle()});
auto [matches, status, message] = index.search(
{.count = queries_count, .queries = {queries, sizeof(float) * 96, 96, usearch_scalar_f32_k}, .wanted = 10},
arena, pool); The second handle in every snippet is the executor, and it is pinned to a residency just like the index. For RAM it is a pool of threads pinned to memory domains, which overlap many independent walks. For VRAM it is one stream per device, driven by a single host thread, where the warps of a GPU cooperate on the candidates and vector fragments of one walk. For NVMe it is one submission ring per worker, which keeps many walks pending while their reads complete. Every verb names its executor, several indexes can share one, and USearch never starts threads of its own.
This changes the economics of search. GPU memory, HBM or GDDR, goes where it matters most: bulk indexing, where thousands of cores build a graph many times faster than the CPUs beside them. RAM takes the work that is irregular or larger than VRAM: incremental updates in small batches, analytics and sampling over the whole collection, and refinements of graphs that outgrow the devices. And large deployments serve from NVMe, reading the same checkpoint in place, without paying for hot memory around the clock.
None of this pays off unless each residency actually saturates the hardware it runs on, which is what the rest of the engine is built around.
§ Faster Compute: SIMD, Atomics, & Unrolling
We have been religiously avoiding loop unrolling, everyone’s favorite first “performance optimization” pull request. Naive unrolling looks great in microbenchmarks, but in reality it bloats the binaries, and in lightweight, memory-bound vector-vector operations it yields no gains. But what if we unrolled the vector math not along the depth of a dot product, but across independent candidates coming from random memory locations, saturating the CPU’s load ports with deeply integrated prefetching?
That’s what v3 does on every hop of a walk, scoring one query against four candidates at once:
// Simplified from `invoke_scores_` in USearch `include/usearch/dense/ram_metric.hpp` at `840374af`
for (std::size_t dim = 0; dim < dimensions; dim += simd_width) {
load(query + dim, &query_slice); // loaded & upcast once for four lanes
for (std::size_t lane = 0; lane != 4; ++lane) // four rows from four random addresses
load(candidates[lane] + dim, &candidate_slices[lane]);
for (std::size_t lane = 0; lane != 4; ++lane)
accumulate(&accumulators[lane], query_slice, candidate_slices[lane]);
for (std::size_t lane = 0; lane != 4; ++lane) // the next four rows, at the same depth
prefetch(next_candidates[lane] + dim);
}
reduce(accumulators, &dot_products); // one horizontal reduction for four lanes
distances = from_dot_products(metric, dot_products, query_norm, candidate_norms);Every line of it pays for something:
- The query half of each product is loaded and upcast four times less often, so scoring M neighbors costs M + M/4 loads instead of 2M, which matters most for mini-floats like
e4m3that upcast on every load. - The horizontal reduction, the most expensive part of a short dot product on x86, is shared by four lanes.
- The next four rows stream in while the current four are scored, and stay out of L1 and L2, which belong to the traversal’s own state.
- Angular and Euclidean distances fall out of the inner product and two norms stored at insertion, so each costs 2·D operations instead of 6·D.
In the real code the lanes unroll through std::index_sequence, so one body compiles to both the 1-to-1 and the 1-to-4 kernel, and scans over many queries at once switch to tiled matrix engines, like Intel AMX.
SIMD also changed. v2 reached its kernels through a function pointer per distance. v3 compiles NumKong’s kernels header-only into every hardware class it targets, so each one inlines into the walk, and a runtime check picks the newest class the machine admits.
| Kernel family | x86 | Arm | NVIDIA | AMD | Apple | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| haswell | skylake | icelake | alder | sierra | genoa | sapphireamx | graniteamx | diamond | neon | neonsdot | neonfhm | neonbfdot | neonfp8 | sve | svehalf | svesdot | svebfdot | sme | smef64 | smebi32 | ampere | ada | hopper | blackwell | blackwellrtx | cdna3 | cdna4 | cdna5 | apple9 | apple10 | |
| Floats | |||||||||||||||||||||||||||||||
| Float64 | dedicated | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | dedicated | older tier | older tier | older tier | older tier | fallback | fallback | fallback | unavailable | unavailable |
| Float32 | dedicated | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | dedicated | older tier | older tier | older tier | older tier | fallback | fallback | fallback | unavailable | unavailable |
| Float16 | dedicated | dedicated | older tier | older tier | older tier | older tier | older tier | dedicated | dedicated | dedicated | older tier | dedicated | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | dedicated | dedicated |
| BFloat16 | dedicated | dedicated | older tier | older tier | older tier | dedicated | dedicated | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | dedicated | dedicated |
| Float8, Float6 & Float4 | |||||||||||||||||||||||||||||||
| Float8 E5M2 | dedicated | dedicated | older tier | older tier | older tier | dedicated | dedicated | dedicated | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | older tier | dedicated | dedicated | dedicated vector kernels, matrix units unused | dedicated | dedicated | dedicated | dedicated |
| Float8 E4M3 | dedicated | dedicated | dedicated | older tier | older tier | dedicated | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | older tier | dedicated | dedicated | dedicated vector kernels, matrix units unused | dedicated | dedicated | dedicated | dedicated |
| Float6 E3M2 | dedicated | dedicated | dedicated | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | dedicated | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | older tier | dedicated | dedicated | dedicated vector kernels, matrix units unused | dedicated | dedicated | dedicated | dedicated |
| Float6 E2M3 | dedicated | dedicated | dedicated | dedicated | dedicated | older tier | dedicated | older tier | older tier | dedicated | dedicated | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | dedicated | dedicated vector kernels, matrix units unused | dedicated | dedicated | dedicated | dedicated |
| Float4 E2M1 | dedicated | dedicated | dedicated | dedicated | dedicated | older tier | dedicated | older tier | older tier | fallback | dedicated | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | dedicated | dedicated vector kernels, matrix units unused | dedicated | dedicated | dedicated | dedicated |
| Integers & binary | |||||||||||||||||||||||||||||||
| Int8 | dedicated | dedicated | dedicated | dedicated | dedicated | older tier | dedicated | older tier | older tier | fallback | dedicated | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | fallback | dedicated |
| UInt8 | dedicated | dedicated | dedicated | dedicated | dedicated | older tier | dedicated | older tier | older tier | fallback | dedicated | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | fallback | dedicated |
| Int4 | dedicated | older tier | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | fallback | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | fallback | dedicated |
| UInt4 | dedicated | older tier | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | fallback | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | dedicated | older tier | dedicated | dedicated | older tier | dedicated | dedicated | dedicated | fallback | dedicated |
| UInt1 | dedicated | older tier | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | older tier | older tier | older tier | older tier | older tier | older tier | older tier | older tier | older tier | older tier | dedicated | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
- Dedicated kernels, on tile or matrix units too where the chip has them
- Dedicated vector kernels; the chip’s tile or matrix units unused
- Reuses an older tier to its left
- Portable fallback
- Unavailable
Beyond SIMD, we also multi-version the “atomics” and the “waiters”. The kit a walk runs under carries the atomics that publish new nodes and the instructions idle threads wait on, each picked per CPU generation through ForkUnion. The rules behind them are simple to state and hard to follow: mutexes are avoided like the plague, compare-and-swap is treated as expensive, and as much logic as possible becomes single read-modify-writes that cannot fail. An insertion claims capacity with one fetch-sub and storage with one fetch-add, hands out a whole batch of identities in one step, and publishes by advancing a watermark, while ForkUnion’s fork-join dispatches a parallel loop without a single compare-and-swap.
What’s left is making each of those one instruction on every CPU.
Arm’s LSE replaces exclusive load-store loops with single ldadd, cas and swp instructions, x86 adds cmpccxadd for conditional adds and RAO-INT’s aadd, which executes at the shared cache instead of pulling the line, and RISC-V brings its amo forms and amocas.
Idle workers sleep on tpause, wfe, wfet or wrs instead of spinning, so a waiting executor burns neither power nor a sibling hyper-thread’s cycles.
Here is what each CPU generation executes for the operations the index relies on:
Scroll horizontally to explore →
| Operation | x86 | Arm | RISC-V | |||
|---|---|---|---|---|---|---|
| x86-64 | + RAO-INT | v8.0 | v8.1+ | RV64A | + Zacas | |
| Fetch-add | lock xadd | lock xadd | ldaxr · add · stlxr ↺ | ldaddal | amoadd.d.aqrl | amoadd.d.aqrl |
| Add, no result | lock add | aadd | ldaxr · add · stlxr ↺ | staddl | amoadd.d x0 | amoadd.d x0 |
| Compare-swap | lock cmpxchg | lock cmpxchg | ldaxr · cmp · stlxr ↺ | casal | lr.d · sc.d ↺ | amocas.d |
| Add if at most | mov · lock cmpxchg ↺ | cmpccxadd | ldaxr · cmp · stlxr ↺ | ldar · casal ↺ | lr.d · sc.d ↺ | ld · amocas.d ↺ |
| Acquiring load | mov | mov | ldar | ldapr | ld · fence | ld · fence |
| Wait for a store | pause ↺ | umonitor · umwait | ldaxr · wfe | wfet | pause ↺ | lr · wrs.sto |
The standard libraries of C++, Rust and Zig expose none of this.
Their atomic_ref lowers to whatever the translation unit’s target flags allow, which in a portable binary means the oldest instruction the build supports.
§ Faster I/O: SPDK, GPUDirect Storage, & io_uring
For most of the history of databases, the operating system sat between the application and the drive, and it could afford to. A spinning disk took milliseconds per read, so a few microseconds of system calls, interrupts and copies disappeared in the noise. NVMe changed that arithmetic in the second half of the 2010s: once one SSD answered hundreds of thousands of random reads per second, the software around each read became the bottleneck. Two projects set out to remove it from opposite ends. Intel’s SPDK, open-sourced in 2015, moved the NVMe driver into user space and polls the device directly, skipping the kernel altogether. NVIDIA’s GPUDirect Storage, introduced in 2019, kept the kernel but let the drive write straight into GPU memory, so analytics on the GPU stopped bouncing every byte through the host.
Each call from the application enters the stack at the layer below it
- Application
- libc
- Userspace buffers
- mmap
- Page cache
- io_uring + O_DIRECTGPUDirect Storage
- Block I/O layer
- SPDK
- NVMe device
The NVMe residency treats these as interchangeable engines under one walk.
The walk itself is a pure state machine that emits reads and consumes completions, and the executor pumps them through whichever engine the machine allows: blocking pread as the portable reference, Linux AIO where cloud images block io_uring, io_uring over registered buffers or as NVMe passthrough, I/O Rings on Windows, or SPDK.
GPUDirect Storage, in turn, moves checkpoints between the drives and the GPUs without a stop in host memory.
All of these paths read and write the same files.
v3 saves its graphs as SafeGraphs, a format we maintain as its own project, the SafeTensors of graphs.
A checkpoint holds keys, values and neighbor lists, and nothing about how the graph was built or how it will be searched, either as one memory-mappable .safegraphs monolith or as a .safegraphs.json manifest over one file per shard.
So whether a graph was built on eight GPUs, refined in RAM, or will be served from a rack of SSDs, it travels as the same documented bytes, readable by tools that never link USearch, and designed from the start as an exchange layer between NSW, CAGRA and similar graph indexes.
§ From C99 to Mojo 1.2, One Shared Library Behind Every SDK
In v2, every binding was its own port of the C++ templates.
In v3, the C interface is the one place types are erased, and every binding, Python included, links the same pre-instantiated shared library.
That interface follows one convention throughout: every verb takes a single argument struct named after it, so usearch_dense_search takes a usearch_dense_search_t, and every struct opens in the same order, with the handle, the executor, the outcome and the completion first, then the inputs, the outputs and the arena they land in, and last the knobs.
With C99’s designated initializers, a call names only the fields it sets, and everything else takes its zero default:
// Adapted from USearch `c/README.md` at `840374af`
// Two independent shards, each with its own executor & arena, e.g. one per NUMA node
usearch_matches_view_t matches[2];
usearch_outcome_t outcomes[2] = {{0}};
for (size_t shard = 0; shard != 2; ++shard) // submit both searches, neither blocks
usearch_dense_search(&(usearch_dense_search_t) {
.index = shards[shard], .executor = executors[shard], .outcome = &outcomes[shard],
.completion = usearch_completion_deferred_k, .count = 32,
.queries = {queries, 128 * sizeof(float), 128, usearch_scalar_f32_k},
.matches = &matches[shard], .arena = arenas[shard], .wanted = 10});
while (usearch_outcome_status(&outcomes[0]) == usearch_status_deferred_k ||
usearch_outcome_status(&outcomes[1]) == usearch_status_deferred_k)
do_other_work(); // polling alone finishes both, each on its own node
merge_by_distance(&matches[0], &matches[1], 10); // the application's own join, in one placeThe same convention settles asynchrony, so no verb has an asynchronous twin.
A call blocks by default, or, marked deferred, returns once submitted, the way an io_uring entry does, and finishes on its executor without allocating or queueing. usearch_outcome_status polls the result and usearch_outcome_wait blocks on an atomic wait, and those two calls are all a binding needs beneath its own futures, promises or coroutines.
Rust and Mojo get a disproportionate share of the new software spanning CPUs and GPUs, and Mojo is now a first-party integration point for us.
Every Unum engine ships a Mojo SDK, USearch, UStore, UForm and UCall alike, each opening the stable C API through dlopen, so a consumer needs no linker flags.
Since no SDK compiles a kernel, their build pipelines are independent of the engine’s, which ships as one shared library per platform.
That library builds two ways.
A multiversioned build, the default for every package, compiles each CPU class above an -march floor and picks the best one at runtime, while a monoversioned build, USEARCH_MULTIVERSIONED=OFF with USEARCH_MARCH=native, compiles exactly one class for one machine.
Both export the same C ABI, so an application built around one runs unchanged against the other.
§ Search During Updates with Atomic Guarantees & without Mutexes
Few search indexes offer database-grade guarantees, and the protocol behind ours is the part of v3 we rewrote the most times.
Construction and search run at once: every node’s neighbor list carries that node’s own lock in its leading slot, so locks never share a cache line, and the rest of the bookkeeping is a handful of atomic counters. remaining_capacity_ is what a batch claims storage against, last_allocated_id_ marks the rows that physically exist, next_dispensed_id_ hands out identities, and last_visible_id_ is the publication watermark, below which every node is fully wired.
Scroll horizontally to explore →
A batch publishes whole. One compare-exchange dispenses its rows’ IDs as one range, the rows are wired against the graph, and one watermark turn files their keys and makes all of them visible at once. Turns run in the order IDs were dispensed, never in the order wiring finished, so a reader never steps onto a half-wired node, and sees either all of a batch or none of it.
What users get from this is two-phase insertion. Every step that can fail, the capacity claim, scratch allocation and key translation, happens before the first identity is dispensed, and after that nothing can fail, so a rejected batch publishes nothing. That makes the index a safe half of a transaction: UStore stages and validates the documents, USearch links their vectors, and readers filter candidates to committed keys during the walk, so a hit never arrives without its document.
None of this rests on reasoning alone: every protocol above is model-checked.
The verification folder holds the Spin models, from the watermark turn and the capacity counters to the sharded commits and the NVMe rings, and GenMC checks the C++ itself against the real headers where it fits.
The models earned their keep by catching two races: a refinement sweep must count with fetch_add, since a relaxed add is posted under RAO-INT and can pass the executor’s await in flight, and a turn’s waiters must re-read the watermark after arming, or the store that ends the turn can slip past them.
§ Add Greedily, Then Refine the Whole Graph
v2 built its graph the way HNSW does: eagerly and greedily, one insertion at a time, each node choosing its neighbors from the graph as it stood at that moment and never revisiting them. Nothing ever looked at the index as a whole, to ask whether every node was still reachable, or whether the earliest nodes kept the neighbors they had picked from a nearly empty graph.
v3 keeps insertion online and cheap, and adds macro-level operations that judge the graph as a whole. refine re-selects neighbors for entries already in the graph against the finished graph, then closes with a reachability audit that re-links any island no search reaches. absorb folds donor indexes into one, re-selecting only the entries along the new seams, and health runs the same audit read-only.
A refinement improves the graph in two ways a single search never sees. It restores reachability: greedy insertion strands some entries in islands no walk from the landmarks can enter, and the audit finds and re-links every one of them. And it improves navigability: entries re-select neighbors against the finished graph, so walks take fewer wrong turns and recall rises at the same search effort.
Here is what one refine round does to a billion-entry graph of molecular fingerprints:
A cheap insertion followed by one or two wide refinements reaches a better graph, in less total time, than one expensive insertion, and the difference in kind matters as much as the difference in quality. Nothing waits on a refinement’s answers, so it can afford kernels a search cannot: seeing many nodes at once, it batches its distance work into tiles for the matrix units of modern chips, AMX on Intel, SME on Arm and tensor cores on GPUs, instead of scoring one pair at a time. And on the NVMe residency, where parts are immutable, a refinement writes new parts from old ones in target order, turning a walk’s random reads into near-sequential scans of the neighbor columns, which drives serve at full bandwidth.
§ Vector Search ≈ Sparse Matrix Multiplication ≈ FlashAttention
Underneath, every vector search engine solves maximum inner product search. Batch the queries into and the stored rows into , and a search computes while keeping only the few largest entries per row, so a search engine is a sparse matrix multiplication engine, and the question is which part of the product it gets to skip.
A product can be sparse along three axes: along , when only some queries need answers, along , when each query needs only its best-scoring rows, which is exactly what a graph walk finds, and along , when vectors carry few non-zero coordinates, as learned sparse retrieval does. Machine learning has been converging on the same picture from the other side:
Dense GEMM
100%
2:4 structured
50%
Mixture-of-Experts
top-2 ≈ 12.5%
Sparse attention
~2% of keys
Proximity graph
O(log N) hops
USearch covers and out of the box, through search, multiply and maxsim, and pro users can add through the basic/ templates, scoring any payload with a metric of their own.
Attention is the same product with a softmax in the middle. FlashAttention made it tractable on GPUs by never storing the score matrix, keeping per query only a running maximum , a sum of exponentials and a partial output , and folding in each key with score and value :
attend runs this online softmax over only the keys a graph walk reaches, since softmax weights decay exponentially with the score and the keys a walk skips carry almost nothing.
Its state , the carry, also merges partial results exactly, so a dense window of recent tokens and a graph over everything before it combine into one output.
We are exploring how to make this part of UForm, our neural network project, so that a model attends over a context held in external memory, in RAM or on NVMe, far beyond what fits in its accelerators. Validating that experimentally, at a significantly larger scale than our first measurements, needs more compute than we have today, and we are waiting on it.
§ The New State of the Art in Every Residency
We benchmark USearch with RetriEval, a harness that drives USearch, FAISS, cuVS and standalone databases through one interface, and compares engines only at matched recall. Every row below reaches 99% 1-recall@10 against exact ground truth, on the same host for every pair it compares. At 100 million vectors, where in-memory graphs start to strain one machine, the comparison spans three workloads, from Yandex Deep embeddings in BFloat16 through Microsoft SpaceV in Int8 to binary molecular fingerprints in UInt1:
On the same Graviton4 host, USearch builds and searches faster than FAISS on every workload, and FAISS never reaches 99% on the fingerprints at all. The rows marked 188× NVIDIA SM120 are a single RTX PRO 6000, whose 188 streaming multiprocessors build the same graphs faster still. And the gap widens with scale: as graphs grow to billions of entries and beyond, the distance between USearch and the alternatives grows rather than shrinks.
Rows at larger scales take far longer to earn than the builds themselves. A fair row needs each engine’s whole recall curve, swept over search breadth on one saved graph, so the two are read at the same recall rather than at the same knob, and it needs their memory matched, with as many links per vector on both sides, because a graph allowed more links buys its recall with RAM. At a billion vectors, every point on those curves is a build of many hours, after exact ground truth that has to be computed first, so each fair comparison takes days of one machine.
§ Try It Yourself
USearch v3 hasn’t reached the package registries yet, so pip install usearch and its siblings on crates.io and npm still bring v2.
The release candidates live in the repository, where you can build them and experiment with dense vectors and the other modalities alike, with every residency, verb and binding above documented in the docs.
The fastest way to see what it does for your data is to hand those docs to your coding agent, with the commands right below this article, and let it explore, validate and benchmark on your own workload.
Before we fold the release candidates into the final release, we want to hear what they do on your hardware and your data. Come to our Discord to discuss and report your findings, the wins and the regressions alike, and stay tuned for the next wave of articles, which cover those other modalities one by one.
To cite USearch:
@software{Vardanian_USearch,
author = {Vardanian, Ash},
title = {{USearch: One Proximity Graph for Search, Sparse Products \& Attention across RAM, VRAM \& NVMe}},
doi = {10.5281/zenodo.7949415},
url = {https://github.com/unum-cloud/USearch},
license = {Apache-2.0}
}