Grafy News
Try Grafy free

Rewind-HNSW enables memory-efficient historical vector searches

Researchers have introduced Rewind-HNSW, a new method for querying previous states of vector indexes without the massive memory overhead of prior models.

Illustration for the news story: Rewind-HNSW enables memory-efficient historical vector searchesSource: Grafy Research Lab

Researchers have developed a new method for managing evolving vector collections that allows users to query historical states without the massive memory costs typically associated with versioning. The new approach, called Rewind-HNSW, addresses a critical bottleneck in approximate nearest neighbor search where maintaining a history of data updates often leads to significant storage bloat.

Why do vector indexes need versioning?

As AI applications become more complex, they increasingly require the ability to inspect or roll back previous states of their memory. According to the research paper by Victor Harry Shea and colleagues, agent memory services are a primary example of this need. These services must be able to access revisions of long-term memories to ensure consistency or to audit how an agent's knowledge has evolved over time.

In a Hierarchical Navigable Small World (HNSW) index, search performance depends on the graph topology—the specific way nodes are connected to one another. When new vectors are inserted or existing ones are replaced, the graph is "rewired," meaning the connections change. Consequently, searching for an earlier version of a dataset requires more than just access to the old vectors; it requires access to the specific graph structure that existed at that exact moment in time.

What are the limitations of current HNSW versioning?

Existing methods for versioning HNSW indexes generally fall into two categories, both of which present significant trade-offs. The first is "naïve versioning," which involves duplicating the entire index for every update batch. While this maintains high query performance for the most recent data, it is extremely inefficient in terms of storage. The authors note that retaining 20 versions of the BIGANN dataset can result in 90.5% of the stored nodes being redundant duplicates.

The second category is "fine-grained versioning," which attempts to save space by sharing vectors across versions. However, this approach often comes at the cost of speed. The researchers found that fine-grained versioning can be approximately 2×2\times slower than naïve versioning. This happens because the system must manage complex, timestamped neighbor lists within a single graph, adding overhead to the search process even when querying the latest data.

How does Rewind-HNSW solve the memory problem?

Rewind-HNSW introduces a middle ground by versioning the graph at the granularity of individual adjacency lists rather than duplicating the entire structure or eagerly materializing every state. The system stores each vector and its most recent adjacency list only once. To access historical data, the system uses "reverse deltas"—records that store how an older adjacency list differs from the current one.

When a user performs a historical query, the system "rewinds" the specific adjacency lists required for that search on demand. This lazy materialization ensures that the memory footprint remains low because the system only reconstructs the necessary parts of the graph topology during the actual search process. This design allows the index to maintain the performance characteristics of a standard HNSW index for the latest version while still providing access to the past.

What are the performance benefits of this approach?

In evaluations conducted across several datasets, including BIGANN, DEEP, and GloVe, Rewind-HNSW demonstrated significant improvements over existing state-of-the-art methods. The researchers reported that the method uses between 45% and 86.9% less memory than prior approaches.

Beyond memory efficiency, the system also maintains high query speeds. For queries targeting the most recent version of the index, performance remains high because the latest adjacency lists are stored in place. When querying historical versions, Rewind-HNSW was found to be up to 40% to 60% faster than previous methods that attempted to retain multiple versions. This suggests that the reverse delta approach effectively mitigates the performance penalties typically seen in fine-grained versioning systems.

How can researchers apply these concepts?

Understanding the mechanics of vector indexing and the challenges of managing long-term AI memory is vital for anyone working with large-scale retrieval systems. While Rewind-HNSW is a specialized database optimization, the core problem it solves—managing evolving information—is a central theme in modern AI research.

For those looking to explore how AI handles complex, multi-document information or how to query specific datasets, the Reader app in Grafy provides a practical environment. Users can upload various PDFs and research papers to perform semantic searches, effectively interacting with a managed vector space to extract insights from large volumes of text.

Frequently asked questions

What is an HNSW index?

An HNSW index is a structure used for approximate nearest neighbor search in high-dimensional vector spaces. It works by creating a hierarchy of proximity graphs, where higher levels act as shortcuts to help the search algorithm navigate quickly toward the most similar data points in the lower, denser levels of the graph.

Why is versioning difficult in HNSW?

Versioning is difficult because search accuracy depends on the specific connections, or topology, of the graph. When data changes, the graph is rewired. To search an older version accurately, a system must preserve not just the old data points, but also the specific way those points were connected to each other at that time.

How does Rewind-HNSW reduce memory usage?

Rewind-HNSW reduces memory usage by storing the latest version of the graph normally and using reverse deltas to represent older versions. Instead of duplicating the entire index, it only stores the differences between the current adjacency lists and their previous states, allowing historical versions to be reconstructed only when needed.


Source: Grafy Research Lab — Rewind-HNSW: Memory-Efficient Rewindable HNSW