Redis Unveils Vector Sets: A Game-Changer for AI Applications
Redis, a powerhouse in the world of in-memory data structure stores, has recently introduced an exciting new feature: Vector Sets. This groundbreaking data type is specifically designed for vector similarity, providing a robust option for various AI applications. The announcement marks a significant comeback contribution from Salvatore Sanfilippo, affectionately known as ‘antirez’, the original creator of Redis, who has rejoined the company.
What Are Vector Sets?
Vector Sets are innovative data structures that function similarly to Sorted Sets, yet instead of using a scalar score, they utilize string elements paired with vectors. This unique approach allows users to add items and efficiently retrieve subsets of these items that are most similar to a specified vector. The capability for filtered searches is also a standout feature, enabling the simultaneous use of vector similarity alongside scalar filters.
In a recent blog post, Sanfilippo elaborated on the purpose behind Vector Sets:
“The goal of the new data structure is, in short, to create a new ‘Set alike’ data type, similar to Sorted Sets, where instead of having a scalar as a score, you have a vector.”
This design philosophy aligns perfectly with Redis’s commitment to providing high-performance solutions without unnecessary complexity.
Underlying Technology: HNSW Data Structure
At the core of Vector Sets lies the HNSW (Hierarchical Navigable Small World) data structure, specifically implemented in the hnsw.c file. Sanfilippo’s version of HNSW is finely tuned for speed and functionality, allowing Redis to handle vector similarity requests with impressive efficiency. Rowan Trollope, CEO of Redis, praised Sanfilippo’s work, stating:
“His expertise has led to the creation of an API that is both simple and intuitive, reflecting Redis’s philosophy of delivering high-performance solutions with minimal complexity.”
Applications of Vector Sets in AI
The introduction of Vector Sets is particularly relevant for applications powered by Generative AI (GenAI). Vector databases play a critical role in retrieving semantically relevant information, which enriches the context of Large Language Models (LLMs) through techniques like Retrieval-Augmented Generation (RAG).
Some notable use cases for Vector Sets include:
- Semantic Caching for Chatbots: By leveraging vector similarity, chatbots can provide more relevant and contextually appropriate responses.
- Recommender Systems: Businesses can utilize Vector Sets to enhance their recommendation algorithms, offering users personalized suggestions based on their preferences and behavior.
- Face Recognition: As Mirko Ortensi, product manager at Redis, noted, face recognition relies heavily on vectors. By modeling known faces with embedding models and storing them in Redis, developers can perform efficient vector searches to identify test identities.
Ortensi adeptly summarized this approach:
“Face recognition is all about vectors. It’s about modeling known faces using a specialized embedding model, storing them in Redis, and performing face recognition by running a vector search of a test identity against the vectors stored in the database.”
Performance Enhancements in Vector Sets
Sanfilippo has not only reimagined the HNSW structure but has also introduced multithreading capabilities for all vector similarity requests, enhancing performance significantly. Moreover, Vector Sets support both 8-bit and binary quantization, making them versatile for diverse application needs.
He highlighted a crucial aspect of the Vector Sets implementation:
“The most interesting part of Vector Sets is the data model and the API supporting it. Many databases propose vector similarity as a kind of index, but that’s Redis, and things in Redis are data structures: no exception this time.”
This commitment to maintaining Redis’s core data structure philosophy ensures that developers can work with familiar concepts while benefiting from modern advancements.
Additional Features: LangCache
In tandem with Vector Sets, Redis has also rolled out LangCache, a semantic caching service tailored for AI applications and agents. This feature is designed to reduce the often costly and latency-prone calls to LLMs by caching their responses, thereby enhancing overall application performance and user experience.
Availability of Vector Sets
Vector Sets are currently available in preview with Redis 8 RC1 and can be accessed under the RSALv2 or SSPLv1 license. This new feature promises to reshape how developers approach vector similarity in their applications, paving the way for more sophisticated and efficient AI solutions.
Redis continues to push the boundaries of what is possible with data structures, and the introduction of Vector Sets is a testament to its innovative spirit and commitment to serving the evolving needs of developers and businesses alike.
Inspired by: Source

