Memory-efficient rewindable graph indexes speed vector searches

Rewind-HNSW: Memory-Efficient Rewindable HNSW

Databases

Summary

Many applications use special networks called HNSW graphs to quickly find similar items stored in memory. Sometimes, it’s important to look back at earlier versions of these networks as they change over time, but doing this usually needs a lot of extra memory or makes searching slower. The authors present Rewind-HNSW, a way to store and access different versions of these networks efficiently by only saving changes between versions. This method uses much less memory while keeping searches fast, even for older versions.

What this means in practice

Authors

Victor Harry Shea, Qi Chen, Baotong Lu, Qianxi Zhang, Tianzheng Wang, Kaisong Huang

Abstract

Hierarchical navigable small world (HNSW) indexes are widely used for in-memory approximate nearest neighbor search. Increasingly, many applications also require support for querying earlier states of an evolving vector collection, such as agent memory services whose revisions need to be inspected or rolled back. However, providing such versioning support in HNSW is non-trivial: search follows graph topology which is rewired by vector inserts and replacements, so searching for an earlier version requires that version's topology, not only visible vectors. Existing approaches often keep a full index per version or per update, which bloat memory usage and add non-trivial performance overhead. We present Rewind-HNSW, a memory-efficient, multi-version HNSW index that retains high query performance. The key idea is to version the graph at the granularity of individual adjacency lists. Rewind-HNSW stores each vector and its latest adjacency list only once, and rolls back to older versions on demand using reverse deltas that store older adjacency lists as differences from newer ones. Each historical query traverses exactly the graph of its target version. Rewind-HNSW uses on average 86.9% less memory than prior approaches on various datasets, while retaining high performance for querying the latest index version.