Ozon’s Recommendation Systems: Evolving from ANN to GPU-Accelerated KNN
The Ozon recommendation system team has announced a significant technological shift, transitioning from approximate nearest neighbor (ANN) search to precise K-nearest neighbor (KNN) search utilizing graphics processing units (GPU). This strategic move aims to maximize hardware performance without compromising the quality of recommendations, a crucial consideration for professionals involved with recommendation systems, search algorithms, or large-scale vector spaces.
Operating within the Russian e-commerce landscape, which serves tens of millions of users and hundreds of millions of products, every percentage point of recall and every hour in the pipeline holds substantial value. Ozon’s experience demonstrates how industry trends, moving from standard ANN indexes to specialized GPU-based scoring solutions, can be effectively adapted and scaled. The company has already conducted A/B tests, confirming the efficiency of this new approach.
Justification: Why Not pgvector?
A common inquiry often concerns the choice between a proprietary implementation and readily available solutions like pgvector. While pgvector excels at candidate generation, such as finding the top-k nearest items by cosine similarity, the Ozon team opted to develop their own solution for several key reasons:
- Availability: pgvector is not universally available across all segments of Ozon’s infrastructure where their memory system needs to operate.
- Task Priority: Although candidate generation is important, it is not the most critical aspect of Ozon’s overall task. The primary value lies in more in-depth processing and selection, necessitating specialized approaches.
Consequently, the transition to precise KNN on GPU represents a strategic step for Ozon, enabling the achievement of maximum accuracy and efficiency in their recommendation systems, which are designed for substantial production workloads.
This move to precise KNN on GPU for recommendations is something I’ve been experimenting with myself, especially for cold-start problems. While ANN is faster for initial candidate generation, the precision of KNN on GPU has genuinely improved my recall metrics for niche items. I’ve found that managing GPU memory can be tricky, especially with larger embedding spaces, but the performance boost is undeniable. A practical tip: pre-quantize your embeddings if you’re hitting memory limits; it can make a huge difference without a significant hit to quality.