Skip to content
unum-cloudPublic

About

One proximity graph for vector search, sparse products & attention across RAM, VRAM & NVMe, over dense vectors, sequences, shapes & geospatial sets in 14 languages πŸ”

Topics

Resources

Code of conduct

Contributing

Stars

4.4k stars

Watchers

45 watching

Forks

Latest commit

Β 

History

3,002 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

USearch

One Proximity Graph for Search, Sparse Products & Attention
across RAM, VRAM & NVMe


Discord Β Β Β  LinkedIn Β Β Β  Twitter Β Β Β  Blog Β Β Β  GitHub

Dense Vectors β€’ Sequences β€’ Shapes β€’ Geospatial Sets
C++ β€’ C β€’ Python β€’ Rust β€’ JavaScript β€’ Go β€’ Swift β€’ Java, Kotlin & Scala β€’ C# β€’ Zig β€’ Mojo β€’ Wolfram
Linux β€’ macOS β€’ Windows β€’ FreeBSD β€’ iOS β€’ Android β€’ WASI
x86 β€’ Arm β€’ RISC-V β€’ Power β€’ WebAssembly β€’ CUDA β€’ ROCm β€’ Metal


USearch is an open-source proximity-graph index for nearest-neighbor search over dense vectors, sequences, shapes & geospatial sets. The same graph serves as a sparse operand, folding sparse matrix products, MaxSim scoring & softmax attention into its traversal, and one checkpoint opens in RAM, VRAM or on NVMe without being rewritten. Its core is a set of header-only C++ 23 templates, whose in-RAM basic tier needs only the standard library, a commitment to lightweight systems. ClickHouse, DuckDB, ScyllaDB & YugabyteDB embed it for vector search.

  • βœ… One Vector Index, Three Goals - Search, Sparse Matrix Multiplications, & Flash Attention folded into the graph walk.
  • βœ… Many Modalities - Dense Vectors, Sequences, Shapes, & Geospatial Sets in every binding, with all but Dense still experimental.
  • βœ… Three Residencies - RAM, VRAM, & NVMe, exchanging portable SafeGraphs files.
  • βœ… 128-bit Keys - Built around UUIDs for large-scale systems, with several vectors allowed under one key.
  • βœ… Atomic Visibility - RAM insertion batches publish complete entries & keys behind each shard's watermark.
  • βœ… Concurrent Mutability - RAM queries overlap indexing & refinement, which take turns with each other.
  • βœ… 14 Programming Languages - From IoT & mobile to GPU neoclouds, through one C ABI & a lower-level C++ core.

One of the most important features of USearch is using the hardware your machine already has, but most software leaves idle. Even SIMD, the most vanilla of those features, often means multiplying dense f32 vectors with AVX2. For USearch, it meant developing one of the largest collections of mixed-precision numerical kernels & algebraic transforms in NumKong: i8 dot-products with i32 accumulation, packed single-bit arithmetic, & FP8 computations on CPUs that have no native FP8 instructions. In slightly more detail:

  • βœ… SIMD - AVX2, WASM v128, LASX, AVX-512, NEON, RVV, Power VSX, Intel AMX, Arm SME, & Power MMA across NumKong's kernel collection.
  • βœ… Extended Atomics - Beyond the standard libraries of C++, Rust, or Zig, with verification models for the index's concurrent protocols.
  • βœ… GPGPU - Generation-specific kits for NVIDIA Ampere, Ada, Hopper, Blackwell, & Blackwell RTX, AMD CDNA 3-5 through ROCm, & Apple GPUs through Metal, with GPUDirect Storage between NVMe drives and GPU memory.
  • βœ… I/O Mechanisms - Blocking POSIX reads, Windows overlapped I/O, Linux AIO, io_uring, & SPDK in the storage engines.
  • βœ… Memory Pinning - Explicit NUMA placement for shards & workers; linking a different allocator doesn't place the graph near the threads walking it.

That barely begins to describe how many flavors of AVX-512 USearch distinguishes & dispatches under the hood. The templates guide goes deeper into the kits, residency layers, & core components you can use beyond the default public API. The verification notes cover the ordering & publication rules that a language's memory-safety guarantees alone cannot establish.

Performance

Cross-engine comparisons need matched datasets, recall, hardware, & query batches. RetriEval compares USearch with FAISS, cuVS, & full database products through one harness.

On one NVIDIA B300 SXM6, SIFT 100M builds at 431,520 vectors/s & searches at 604,490 QPS, with u8 storage & Euclidean distance. On 192 AWS Graviton5 cores, it builds at 161,952 vectors/s & searches at 173,823 QPS, while FAISS HNSW builds at 84,536 & searches at 178,600. Their 1-recall@10, the share of queries whose true nearest neighbor is among ten results, is 0.9913, 0.9925 & 0.9917 respectively. The benchmark tables record each row's expansions.

Quickstart

The example below is in Python, whose wheels on PyPI cover Linux, macOS and Windows on x86 and Arm:

pip install usearch

Index ten thousand vectors, then search the first hundred of them on an executor, into memory the results own:

import numpy as np
import usearch
from usearch import DenseIndex, DenseMetric, Scalar

index = DenseIndex.init_ram(
    dimensions=256,  # Scalars per vector
    metric=DenseMetric.ANGULAR,  # INNER, ANGULAR, EUCLIDEAN, HAMMING or JACCARD
    quantization=Scalar.BF16,  # The stored scalar type: BF16...E2M3, I8, U8, U1X8
    connectivity=16,  # Connections per node; 0 derives it from the geometry
)

vectors = np.random.rand(10_000, 256).astype(np.float32)
index.reserve(len(vectors))  # Optional capacity hint; inserts grow on demand
index.insert(np.arange(len(vectors)), vectors)  # On the calling thread

pool = usearch.Executor.for_ram()  # The workers a receiver names
matches = index.on(pool).search(vectors[:100], 10)  # Blocking, on the pool; pass an Arena to reuse memory
assert len(index) == 10_000
assert np.asarray(matches.distances).shape == (100, 10)
key, distance = matches[0][0]
assert distance < 0.001

Most calls name an Index, an Executor for scheduling, & an Arena for outputs whose size grows with the input. Typed buffers cross the ABI directly; arenas own the returned buffers & can be reused once their results are consumed. Every binding's guide opens with its own Quickstart: C, C++, Python, Rust, JavaScript, Go, Swift, Java, C#, Zig, Mojo & Wolfram. See contributing for building from source, & benchmarks for measuring it.

Architecture

An index dispatches on its Modality, Residency, stored scalar type, metric, & available hardware. The build selects the kernel families it includes; runtime detection picks the newest CPU, GPU, & NVMe classes the machine admits, unless the caller pins one. A description reports the classes an index dispatches as & the shards_count it spans. The graph & its traversal are templated on those kits, so a walk inlines the matching vector loads, dot-products, norms, atomics, & wait instructions together.

Residency

RAM shards follow memory domains, VRAM shards follow devices, & NVMe views follow checkpoint parts. Sharding partitions the indexed entries rather than replicating the entire graph. SafeGraphs holds the keys, vectors, norms, & links between those layers.

The useful unit of parallelism changes with residency. CPU workers overlap independent walks; GPU warps cooperate on their candidates & vector fragments; NVMe workers keep many pending walks alive while reads complete. Blackwell kits score candidate batches in mma.sync tiles fed by 256-bit loads, while storage walks explicitly yield the reads they need next. io_uring submits those reads through kernel-managed rings; SPDK uses user-space storage drivers & polling. The traversal's latency hiding depends on keeping useful work ready between memory accesses, device instructions, or I/O completions.

search_if makes sense in RAM & NVMe because a host predicate can admit results while excluded entries still route the walk. An arbitrary host callback cannot run inside a device-resident GPU traversal. insert grows RAM & VRAM indexes; NVMe views serve immutable parts, with separate build & refinement operations writing new parts. See the templates guide for the layers & the C guide for the verbs served by each residency.

Modalities

Modality Inputs Similarities & Distances Status
Dense Vectors Equal-width rows or bit setsΒΉ Inner-Product, Angular, & 3 moreΒ² RAM, VRAM, & NVMe
Sequences Byte strings & UTF-8 text Alignment, containment, & overlap³ Experimental⁴
Shapes 3D point clouds of any size Chamfer, Hausdorff, & 5 more⁡ Experimental⁴
Geospatial Sets Observations⁢ Near, visible, sees, & seen Experimental⁷

¹ Numeric rows of one width, or packed bit sets. ² Euclidean, Hamming, & Jaccard. ³ Global alignment, window containment, & shifted overlap. ⁴ In every binding, on NVIDIA, AMD, & Apple GPUs too. ⁡ Wasserstein-Procrustes, Gromov-Wasserstein, Warping-Procrustes, & protein & RNA backbone superposition. ⁢ Positions, view cones, & time. ⁷ In every binding, on NVIDIA & AMD GPUs too.

Building Indexes

Indexes are built in two very different regimes, & USearch keeps them as separate operations. Insertion is online & greedy: each entry commits to its neighbors once, against the graph as it stands. Refinement & absorption are macro-level: they revisit entries already in the graph, judge the graph as a whole, & may spend more compute per entry in exchange for throughput. A workflow that bulk-indexes first & bulk-serves later should run both; a workflow that streams entries into a live index may never refine at all.

Incremental Insertions

insert walks the graph from its entry points with a beam as wide as the expansion, picks a diverse subset of what the walk scored, & back-links each pick to the new entry. It answers one question per entry - the approximate nearest neighbors of a new point in a fixed graph - so its cost is one latency-bound walk per entry, & entries become searchable as soon as their batch publishes. The greediness is the price: the first entries chose their neighbors from a small graph, & no insertion revisits them. A narrow insertion expansion ingests cheaply & leaves picks a wider walk would improve on. An index grows as it inserts; reserve is only a hint of the capacity to come.

Macro-Level Refinements

refine makes every entry findable. It solves a different problem from insertion: building an approximate nearest-neighbor graph over every entry at once, plus the global properties no single walk can see.

  • Navigability is the goal. A reachable entry is not enough: a greedy search, starting where searches start, must arrive at it.
  • Fewer islands. Every strong component outside the root's is an island, and re-stitching islands into the root's component is the core of a round, so the island count is what it drives down.
  • Diagnose all, re-stitch all. One sweep that computes no distance measures every entry; one streamed pass then gathers every entry into a neighborhood of near entries.
  • Scan, never guess. Neighborhoods come from streaming the stored entries past a pack of drawn hubs, many at once. A sequential scan costs far less than the random reads a walk makes, so no walk decides what an entry may link to.
  • Mend the neighborhood. A neighborhood is re-stitched as a unit, every entry against every other, in one core's cache. A tiled many-to-many kernel computes far more distances per byte it loads than one query against many, so the round spends that compute.
  • Keep the diverse, leave the rest free. An entry keeps the links that lead somewhere new; a slot no such link claims stays empty.
  • Reach never shrinks. A link is dropped only while an entry of smaller depth still links to its target.
  • Chance, not position. Hubs are seeded draws, new each round, so no entry's fate rests on where it is stored.
  • Nothing to tune. Every size comes from the graph or the device: its connectivity, the cache a core has.
  • Says when it is done. Each round reports what it found and changed, and whether another can help.
  • Watchable, stoppable, resumable. Every phase reports its progress; a stop keeps the work done and leaves a graph that saves; a plan resumes where it stopped.
  • One writer, readers never wait. On NVMe a plan rewrites a private copy of a part and publishes it whole.
  • Move, then rounds. Resharding moves entries with their links and rewrites links only within the parts it moves, then runs rounds; none walks.

A round opens with a health check from a root, measuring every entry's component, in-links & depth without a distance, & a heal links each island it names to the root's component, again without a distance. The round then draws about the square root of the neighborhoods it needs as hubs & streams every stored entry past them once, so each entry joins the neighborhood of its nearest hub; a neighborhood over its capacity, what one core's cache holds, draws hubs among its own entries & gathers again, so each entry scores about twice that square root rather than a whole pack, & one whose entries all tie, as duplicates do, is cut into pieces by ID. Each neighborhood is then re-stitched in one core's cache: every entry is scored against every other, & each keeps the diverse links among its own & its nearest neighborhood-mates, leaving the other slots empty. A closing health check from the same root decides the verdict: converged once a round changes no entry's links, improved while it changes some, stalled when full entries leave no slot to lower anything that stands, & stopped when the caller stopped it. Every residency runs the same round with the same phases, report & verdicts: RAM on the executor's cores, NVIDIA, AMD & Apple GPUs on their devices, & NVMe one part at a time, in RAM when the part fits or streamed from the drives when it does not. Like compaction in a database, refinement is optional & never changes what the index contains, only how well it is connected, & it must never lower recall.

Resharding

reshard moves the entries of its sources into its targets, keeps their links, & runs one round on every target that took entries, which heals what arrived into the target's graph without a distance & re-stitches the neighborhoods they share. Several sources into one target is a gather: the other sources end empty & stay the caller's to free. One source into several targets is a cut into graph-local parts, each grown from a seeded root over the links. One index as its own only source & target is a recut in place: shards hold at most about 4 billion entries, so a collection past that size grows by adding shards, & a recut packs small shards into larger ones while each stays under the bound. NVMe parts are immutable, so a reshard writes new parts beside the manifests & leaves every index serving its own until the manifests are replaced. Like a refinement, a reshard is watchable, stoppable & resumable: the handler reports & cancels the closing rounds, never a move, & a plan carries a stopped reshard into the next call, which moves what is still pending & continues the rounds. While the plan lives, every index it names admits no insertion & no save.

Dense Modality

Each shard supports up to roughly 4 billion entries through 32-bit internal node IDs. Public keys remain 128-bit UUIDs; adjacency lists store those compact node IDs rather than repeating UUIDs on every edge. Several shards extend the collection beyond one shard's address space: shard_capacity bounds each, & a full generation of shards opens a new one on the same memory domains or devices.

USEARCH_DENSE_DTYPES lists the storage types a build compiles, & the rest answer usearch_status_unsupported_k. The default four are bf16, u1x8, i8, & e4m3; the full eleven add f16, u8, e5m2, i4x2, u4x2, e3m2, & e2m3. Inputs can arrive as f32 or f64 & convert on ingestion. Bit sets suit fingerprints; byte integers suit quantized embeddings; e4m3 & bf16 offer floating-point range at different memory costs.

Most dense measures reuse a dot-product & precomputed norms. Squared Euclidean distance is $\lVert a\rVert^2 + \lVert b\rVert^2 - 2\langle a,b\rangle$; Angular distance derives from the normalized product; packed-bit intersections yield Hamming & Jaccard distances. Geometry freezes when the index opens, while the graph's population grows. refine improves its links & health checks reachability, making islands visible in the same reports that measure recall & throughput.

Search & MaxSim

search returns keys & distances from the walk's retained candidates. search_if applies a result-admission predicate without severing the routing paths through rejected nodes. Expansion controls the candidates, & connectivity controls the adjacency width; neither promises an exact nearest neighbor.

maxsim ranks multi-vector documents, with token rows sharing one document key. For query tokens $q_i$ & document tokens $d_j$, it sums each query token's best similarity: $\sum_i \max_j \langle q_i,d_j\rangle$. The implementation walks the query rows to nominate documents, sharing the graph machinery with ordinary retrieval, then scores every token row of each nominated document exactly. Each query lands a ragged run of its best wanted documents, or of every scored document when wanted is zero. This avoids flattening a document's token geometry into one pooled vector.

Sparse Linear Algebra

Sparsity appears at several levels: fixed patterns in Tensor Cores, routed experts in MoE models, & structured operators in State Space Models. USearch adds a data-dependent computation mask to an $M \times N \times K$ product: Dense M, Sparse N, Dense K. The $M$ query rows choose a subset of the $N$ indexed rows through the graph, while each chosen product consumes all $K$ stored coordinates.

multiply exposes those products as a graph-selected portion of $A B^{\mathsf{T}}$. It returns every pair scored by the traversal, including candidates the nearest-neighbor walk rejected, subject to an optional output bound. Products are computed over the stored representation; unvisited entries remain unknown. The returned offsets delimit query rows, keys identify the selected indexed rows, & scores contain their dot-products.

Exporting entries is one use of the walk. A custom C++ fold can accumulate $\sum_{j\in S(q)} \langle q,b_j\rangle v_j$ directly, avoiding the product tape & its key exports. With $v_j = w_j b_j$, a fixed selected set defines a sparse bilinear operator $B_S^{\mathsf{T}} W B_S$; applying a final vector forms $x^{\mathsf{T}} B_S^{\mathsf{T}} W B_S q$. When the graph chooses $S(q)$ from the query, the resulting operation is adaptive rather than globally linear.

An index-to-index join could add sparsity along $M$ as well; that public operation is planned. Sparsity along $K$ needs a compatible custom metric & representation through the core C++ components, beyond the current dense public API.

Subquadratic Attention

attend folds values into an online Softmax as the graph scores keys. Every scored key contributes, including keys outside the retained nearest-neighbor candidates. The fold maintains a running maximum, partition, & weighted value sum, so it materializes neither a full score matrix nor an intermediate top-k selection. Several query heads share one traversal & one value lookup, with separate accumulators per head.

For the scored set $S(q)$, the output is $\frac{\sum_{j\in S(q)} \exp(s_j-m)v_j}{\sum_{j\in S(q)} \exp(s_j-m)}$. It is normalized over that set & approximates full attention; the unvisited mass determines the remaining error. The maximum, partition, & weighted sums can merge across shards without averaging already-normalized outputs.

With $T$ queries, $H$ heads, width $D$, & $W$ scored keys per query, the attention work scales with $T H W D$ instead of $T H N D$ for a dense scan. That becomes subquadratic when $W$ grows sublinearly with the indexed population $N$. Construction & maintenance have their own cost, & neither arbitrary data nor arbitrary attention distributions guarantee a small $W$ at a chosen accuracy.

Sequence Modality

A metric names what the sequences are: protein_alignment scores global alignments, dna_overlap aligns reads sliding over each other on either strand, & utf8_containment finds the text holding most of a query's windows, in any case, & the C interface exports them. Sequence search is useful when edit operations & local matches hold more meaning than a dense embedding's geometry. Protein alignments & containments keep a sketch in front of every sequence, sketch_bytes long, 512 unless the index names another multiple of four. Builds link the graph by the sketches, & every search walks twice: first by the sketches, then by the exact score from the nearest nodes that walk found, as many as a neighbor list holds.

Geospatial Modality

Warning

Experimental: every binding & NVIDIA and AMD GPUs serve it today, while its interfaces, the default binaries' contents & its relations may still change.

Every entry is one observation: where a device was, how sure it was, which way it looked, how far it saw, & when, like a photo, a video frame or a sensor fix. The native index converts WGS-84 coordinates into Earth-Centered, Earth-Fixed positions stored as three centimeter-scale i32 coordinates, 12 of the 32 bytes per observation, quantizing the rest so that every rounding only widens a test. Multiple observations can share one key to represent a camera's frames, a vehicle's fixes, or geographic sets. Every ordering & score is the straight-line chord in meters, which ranks like the great-circle arc on a sphere & reads 1 mm short of the surface geodesic at 10 km; callers wanting geodesics compute them for the reported matches. One walk around each query position answers four relations: near widens the radius by both positions' uncertainty, visible adds a clear line of sight over the index's terrain, sees asks which cameras see a place, & seen what a camera sees.

Integrations

USearch is used in databases, frameworks & applications:

USearch builds on sibling libraries: NumKong supplies every dense kernel, StringZilla the sequence kernels, & ForkUnion the thread pools behind RAM & NVMe executors. UStore pairing documents with their vectors, so both become visible in one transaction, is planned.

Related applications include SwiftSemanticSearch for multimodal retrieval & USearch Molecules, indexing 7 billion molecules through 28 billion fingerprints.

Build Variants

USearch grows with the parts you pull in, & every part left out is refused at runtime rather than failing to link: a member or an engine with usearch_status_unsupported_k, a GPU the build holds no kernels for with usearch_status_device_k.

  • One header target. usearch::header is the in-RAM basic graph index & the utilities under it, ten headers over any metric you write, the standard library & the C types of usearch::abi, with nothing to compile.
  • The engine library. usearch_static & usearch_shared add the C ABI, every residency & the sibling libraries. Each numeric type in USEARCH_DENSE_DTYPES, & each member of the shape, sequence & geospatial lists, adds kernels for every CPU & GPU class built.
  • GPUs. USEARCH_CUDA_ARCH, USEARCH_ROCM_ARCH & USEARCH_METAL_ARCH embed device kernels & load the vendor runtime only when a device is used, growing the binary & the compile time but adding no runtime dependency.
  • Storage. io_uring, Linux AIO, Windows IoRing & GPUDirect Storage need no switch, while USEARCH_WITH_LINUX_SPDK links external SPDK & DPDK archives & needs huge pages at runtime.

Multiversioned and Monoversioned Builds

USearch compiles in one of two shapes, picked by USEARCH_MULTIVERSIONED.

  • Multiversioned builds are for distribution. One binary runs well across diverse machines, because each CPU and each GPU picks its own class at runtime. This is the default, and the shape of the Python wheels, the Rust crate and the JavaScript, Swift, Go, Java and C# packages.
  • Monoversioned builds are for throughput. For common hardware and data-center deployments, the binary holds only the best code for one machine. These are the leanest binaries: they start fast and take little memory and disk. Outside that machine they refuse cleanly with usearch_status_unsupported_k, never crashing and never falling back to slower code in silence.
  • The switches. USEARCH_MULTIVERSIONED=OFF picks the second shape and USEARCH_MARCH names its CPU floor. The xeon4_hopper, xeon6_blackwell, grace_hopper, vera_rubin and venice_mi450 presets spell whole machines.

A monoversioned build compiles the single monoversioned CPU class in place of the ladder of named ones. It needs no monoversioned GPU class, as a preset's one GPU architecture already matches a named class, and CMake builds only the class units holding code for it.

Compatibility

Every modality is served in every residency, with the exceptions the notes under the table name.

Modality RAM NVMe NVIDIA VRAM AMD VRAM Apple VRAM
Dense Vectors βœ… βœ… βœ… βœ… βœ…
Sequences βœ… read-only ΒΉ βœ… βœ… βœ…
Shapes βœ… read-only ΒΉ βœ… βœ… f16 only Β²
Geospatial Sets βœ… read-only ΒΉ βœ… βœ… Β· Β²

ΒΉ Sequence, shape & geospatial checkpoints open on NVMe as read-only views, while a dense one loaded there writes new parts as it refines & reshards.

Β² Apple GPUs refuse geospatial sets & f32 shapes with usearch_status_unsupported_k, as no Metal kernel meets their f64 & f32 numerics contract.

Every GPU refuses filtered search, since a host predicate cannot narrow a device walk; Apple GPUs refuse attention.

The C guide lists the verbs each residency serves.

Modality C & C++ Python Rust JavaScript Go Swift Java C# Zig Mojo Wolfram
Dense Vectors βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ…
Sequences βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ…
Shapes βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ…
Geospatial Sets βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ… βœ…

Every binding is a thin layer over the same C ABI, so each exposes every modality the C headers declare, & the engine decides what a residency serves. The C & C++ column covers the C ABI & the C++ wrapper over it in cpp/, while Kotlin & Scala consume the Java surface directly & match its column. The C++ core also exposes lower-level kits & custom folds, & each binding's guide lists what it does not expose.

Default packages compile only the dense defaults, so the sequence, shapes & geospatial members need a build that names them: the USEARCH_SEQUENCE_METRICS, USEARCH_SHAPES_METRICS & USEARCH_GEOSPATIAL_RELATIONS lists, or a preset such as release, which inherits features_full. Every binding reports what its library holds through the *_compiled queries of the C ABI, & a left-out member answers usearch_status_unsupported_k.

Experimental Parts

Experimental parts work today. What we reserve is the right to change them before the final release: their ABI, what the default binaries include, the compilation matrix, & the set of metrics & backends.

  • Sequence, Shape & Geospatial indexes. They serve every binding, RAM, read-only NVMe views & GPUs: sequences & shapes on NVIDIA, AMD & Apple, geospatial sets on NVIDIA & AMD. The default packages leave them out, & their member lists may still change, while the Dense modality is stable.
  • Declared verbs. Some verbs are declared ahead of their engines & answer usearch_status_unsupported_k in every residency today: search streams & geospatial terrains read from a path. Others wait on one residency, like cursors on GPUs & saving a sequence, shape or geospatial VRAM index to a buffer.

Repository Layout

The templates, the C ABI over them & each binding over that ABI keep a top-level folder of their own:

usearch/
β”œβ”€β”€ include/usearch/  the core C++ 23 templates & containers, one folder per layer & modality
β”‚   β”œβ”€β”€ utilities/    devices, shards, walks, buffers, sorts & the SafeGraphs format
β”‚   β”œβ”€β”€ basic/        the reference graph index the other three modalities instantiate
β”‚   β”œβ”€β”€ dense/        dense vectors in RAM, on NVMe & on NVIDIA, AMD & Apple GPUs
β”‚   β”œβ”€β”€ sequence/     edit distances & alignments over byte strings
β”‚   β”œβ”€β”€ shapes/       distances between 3D point clouds
β”‚   └── geospatial/   relations between observations on the Earth
β”œβ”€β”€ c/                the C ABI in usearch/*.h, shared by every binding, & its test
β”œβ”€β”€ cpp/              the C++ wrappers of the C ABI in usearch/*.hpp
β”œβ”€β”€ src/              the instantiations, dispatch & per-class units behind the C ABI
β”œβ”€β”€ src_stub/         a brute-force stand-in answering the same verbs
β”œβ”€β”€ tools/            the `usearch` & `usearch-mpi` command-line tools
β”œβ”€β”€ bench/            benchmarks of search, algebra & NVMe reads
β”œβ”€β”€ test/             the C++ suites & the Python suites
β”œβ”€β”€ verification/     Promela & GenMC models of the concurrent protocols
β”œβ”€β”€ docs/             the SafeGraphs format & the Doxygen configuration
β”œβ”€β”€ explorer/         a browser map of an index's neighborhoods
β”œβ”€β”€ python/           the CPython extension
β”œβ”€β”€ rust/             the crate, over `extern "C"` declarations
β”œβ”€β”€ javascript/       the Node-API addon
β”œβ”€β”€ golang/           the Go package, through cgo
β”œβ”€β”€ swift/            the Swift package, through a Clang module map
β”œβ”€β”€ java/             the Java, Kotlin & Scala SDK, through the FFM API
β”œβ”€β”€ csharp/           the .NET package, through `[LibraryImport]` stubs
β”œβ”€β”€ zig/              the Zig SDK, over `extern fn` declarations
β”œβ”€β”€ mojo/             the Mojo package, opening the shared library at runtime
β”œβ”€β”€ wolfram/          the Wolfram Language package, through LibraryLink
β”œβ”€β”€ numkong/          the dense kernels & tensors, as a git submodule
β”œβ”€β”€ stringzilla/      the sequence kernels, as a git submodule
β”œβ”€β”€ forkunion/        the thread pools & memory topology, as a git submodule
└── smashtable/       the row directories of NVMe indexes, as a git submodule

Each binding folder holds its package, its suite & its guide, all over the C ABI in c/usearch/. Conventions, hooks & the commit format are described in CONTRIBUTING.md.

Citation

If USearch helps your work, please cite it:

@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}
}

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

About

One proximity graph for vector search, sparse products & attention across RAM, VRAM & NVMe, over dense vectors, sequences, shapes & geospatial sets in 14 languages πŸ”

Topics

Resources

Code of conduct

Contributing

Stars

4.4k stars

Watchers

45 watching

Forks

Releases

Packages

Used by

Contributors

Languages