Zarc: Exact Nearest Neighbors over a Billion Vectors in Seconds
Exact k-nearest-neighbor vector search lies on the critical path of machine learning systems, from sparse attention in the latest large language models (LLMs) to long-context memories and training-data deduplication. Exhaustive GPU search scans the whole dataset for every query, while approximate indexes return inexact neighbors. Recent methods skip almost every vector with a cheap half-precision proof that it lies too far away, but only on one GPU that holds the whole dataset. Our insight is to keep only the short rows of these proofs in GPU memory and to fetch the few remaining full vectors from host memory. Our system, Zarc, answers Euclidean, cosine, inner-product, and filtered queries exactly under updates. On four H100 GPUs, it answers 10,000 exact queries over one billion vectors in 1.1 seconds instead of five minutes. On eleven open LLMs, it retrieves the exact top-10 attention keys 2.2× to 13.1× faster than exhaustive search. In sparse attention over one million tokens, it runs 3.1× faster than bf16 selection with FlashInfer, which misses the exact top-64 for most queries.
Authors
- Dongfang Zhao (ORCID: https://orcid.org/0000-0002-0677-634X)
Institutions
- University of Washington (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-10-26
- DOI
- https://doi.org/10.5281/zenodo.23674583
- Primary Topic
- Advanced Image and Video Retrieval Techniques
- Type
- preprint