Skip to main content

Module qgraph

Module qgraph 

Source
Expand description

Quantized graph index for approximate nearest-neighbour search on angular data, and (the Graph and VGraph only, see Metric) on Euclidean data.

Vectors are normalized and rotated (random sign flips and fast Walsh-Hadamard transforms), and a Vamana-style graph with alpha pruning and a fixed out-degree is built on exact inner products, inserting in deterministic batches. Each vertex owns one contiguous block holding its rotated vector, its neighbours’ ids, and for every edge a 1-bit RaBitQ code of the edge residual (neighbour minus vertex) with per-edge correction factors.

Search keeps a pool of ef candidates ordered by estimated distance. Expanding a vertex scores it exactly (this is the re-rank) and estimates all of its neighbours in one batch from the edge codes against a 4-bit query code. The result is the top-k of the exactly scored vertices. max_exact caps the number of expansions (0 = no cap).

Estimator (RaBitQ, Gao & Long 2024, applied per edge as in SymphonyQG, Gou et al. 2025): with w = u - v and s = sign(w), <q, u> ~= <q, v> + <v, w> + M (<s, q> - <s, v>) where M = |w|^2 / |w|_1. <q, v> is exact at expansion time; <s, q> comes from the bit planes.

VGraph is the compact alternative on the same Graph: one 8-bit code per vertex instead of one 1-bit code per edge (see vertex.rs).

Modules§

connectivity
Directed reachability of the bottom layer and a data-only repair for sink components.
filter
Label-filtered exact-metric nearest-neighbour search over 8-bit vectors (Euclidean).

Structs§

BuildParams
ConsolidationPolicy
Advisory thresholds; callers schedule consolidation outside their commit latency.
Graph
A built proximity graph, before any encoding: over normalized vectors (angular) or the vectors as given (Euclidean). Holds a full-precision copy of the data, so it is a build-time object; the indexes keep only their encodings.
HugePageStatus
What the huge-page advice of this process achieved.
MutableBase
A graph over capacity slots that is mutated in place.
MutableOptions
Knobs of a MutableBase, named as in section 2.7 of the design note.
MutableStats
Slot accounting and cumulative scan work.
QGraph
QueryLists
Candidate lists of a super::VGraph (see the module documentation).
RepairParams
RepairStats
ScanStats
What one repair scan did.
SearchKnobs
Runtime knobs of the search loop, each off by default so that the results are those of the plain search. VGraph::searcher reads them once per process from the environment (SearchKnobs::from_env); VGraph::searcher_with takes them explicitly.
SearchParams
Searcher
Per-thread search state for one index.
UpdatableVGraph
A mapped base plus a mutable graph delta, with atomic durable batches. insert, delete, and replace publish immediately; commit makes the batch durable. Only one process may open a directory, while any number of threads may search it.
VGraph
VGraphMemoryBreakdown
Logical payload bytes counted by VGraph::index_bytes, including row padding. Excludes allocation capacity, slab rounding, object/allocator metadata, rotations and query scratch. These are not resident, unique, proportional, or peak memory measures.
VSearchParams
Search parameters of a VGraph.
VSearcher
Per-thread search state for one VGraph.

Enums§

Allow
The original ids a filtered search may return.
BuildProfile
Insertion passes a build runs. Every profile searches the same way and prunes the same way; they differ in how many passes run and how wide the construction search is. Measured on SIFT-1M at 8 threads (benchmarks/results/qgraph_build_profiles_gcp_v1.json).
Consolidation
What a consolidation did.
ConsolidationMode
How UpdatableVGraph::consolidate_with publishes the next generation.
Metric
Distance a graph is built and searched for.
Residency
Where the arrays of an index opened with VGraph::open live.
RowStore
Where an open index keeps its full-precision base rows.
UpdateError
Failures at the update and persistence boundary.
VMetric
Scoring contract of the serving codes, independent of graph construction geometry.

Constants§

DEFAULT_DEGREE
Default out-degree of every vertex; one batch of edge codes per expansion.

Functions§

huge_page_status
The huge-page advice given so far and the huge pages the process holds.