# Scaling HNSWs

DevFeed: [Scaling HNSWs](<https://devfeed.tech/articles/scaling-hnsws-20647.md>)

Original publisher: [Read original article](<http://antirez.com/news/156>)

Author: Antirez

Published: 2025-11-11T12:53:38Z

Content type: article

Language: en

Sources: [Antirez](<https://devfeed.tech/sources/antirez.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [vector embeddings in AI](<https://devfeed.tech/topics/vector-embeddings-in-ai.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [in-memory database](<https://devfeed.tech/topics/in-memory-database.md>)

Tags: [high-performance](<https://devfeed.tech/tags/high-performance.md>), [hnsw](<https://devfeed.tech/tags/hnsw.md>), [optimizations](<https://devfeed.tech/tags/optimizations.md>), [redis](<https://devfeed.tech/tags/redis.md>), [scaling](<https://devfeed.tech/tags/scaling.md>), [searching](<https://devfeed.tech/tags/searching.md>), [similarity](<https://devfeed.tech/tags/similarity.md>), [vector](<https://devfeed.tech/tags/vector.md>)

## AI overview

The author's Redis Vector Sets implementation focuses on making HNSWs practical for low latency, memory use, deletion, and scaling. Per-vector signed 8-bit quantization reduces vector storage about fourfold and reportedly gives nearly the same recall in real workloads; the author says it also yields almost 4x speedup, while pointers still consume substantial space. Threaded searches use per-thread visit epochs, and inserts separate neighbor search from a locked commit. Bidirectional links support immediate deletion; the remaining neighbors are paired greedily to reconnect the graph. The data-structure API enables clients to query multiple instances in parallel and merge scored results, or partition writes across instances. Serializing nodes and links directly instead of rebuilding from vectors reportedly speeds loading by 100x; loading also checks and repairs graph validity. The excerpt additionally describes bounded JSON-expression filtering during search. Reported throughput and recall figures are implementation- and workload-specific, and the author presents several findings as early results.

## Source excerpt

I'm taking a few weeks of pause on my HNSWs developments (now working on some other data structure, news soon). At this point, the new type I added to Redis is stable and complete enough, it's the perfect moment to reason about what I learned about HNSWs, and turn it into a blog post. That kind of brain dump that was so common pre-AI era, and now has become, maybe, a bit more rare. Well, after almost one year of thinking and implementing HNSWs and vector similarity stuff, it is time for some writing. However this is not going to be an intro on HNSWs: too many are present already. This is the "extra mile" instead. If you know HNSWs, I want to share with you my more "advanced" findings, especially in the context of making them fast enough to allow for a "Redis" experience: you know, Redis is designed for low latency and high performance, and HNSWs are kinda resistant to that, so there were challenges to expose HNSWs as an abstract data structure. This blog post will be split into several sections. Think of them as pages of the same book, different chapters of the same experience. Oh and, by the way, I already wrote and subsequently lost this blog post :D [long, sad story about MacOS and bad habits - I hadn't lost something like that since the 90s, during blackouts], so here most of the problem will be to recall what I wrote a few days ago and, while I'm at it, to better rephrase what I didn't like very much. ## A few words about the state of HNSW Before digging into the HNSWs internals and optimizations, I want to say a few things about HNSWs. The original paper introducing HNSWs is a great piece of computer science literature, and HNSWs are amazing data structures, but: I don't believe they are the last word for searching, in a greedy way, for nearby vectors according to a distance function. The paper gives the feeling it lacks some "pieces", almost like if the researchers, given six months more, had a lot more to explore and say. For instance, I modified the paper m