Abstract
Embedding models can generate high-dimensional vectors whose similarity reflects semantic affinities. Thus, accurately and timely retrieving those vectors in a large collection that are similar to a given query has become a critical component of a wide range of applications. In particular, cross-modal retrieval (e.g., where a text query is used to find images) is gaining momentum rapidly. Here, it is challenging to achieve high accuracy as the queries often have different statistical distributions than the database vectors. Moreover, the high vector dimensionality puts these search systems under compute and memory pressure, leading to subpar performance. In this work, we present new linear and nonlinear methods for dimensionality reduction to accelerate high-dimensional vector search while maintaining accuracy in settings with in-distribution (ID) and out-of-distribution (OOD) queries. The linear LeanVec-Sphering outperforms other linear methods, trains faster, comes with no hyperparameters, and allows to set the target dimensionality more flexibly. The nonlinear Generalized LeanVec (GleanVec) uses a piecewise linear scheme to further improve the search accuracy while remaining computationally nimble. Initial experimental results show that LeanVec-Sphering and GleanVec push the state of the art for vector search.
Problem Statement: The Memory Bottleneck and OOD Challenges
Modern AI applications rely on high-dimensional embeddings—vectors representing the semantic meaning of images, text, or audio. As dimensionality scales to 768 or 1024 dimensions, vector search performance often hits a wall. This bottleneck is primarily driven by memory latency rather than raw compute; fetching large vectors from RAM in random patterns significantly slows down graph-based indices.
While dimensionality reduction (compression) can mitigate this, standard techniques like PCA often fail in "Out-of-Distribution" (OOD) scenarios. For example, in cross-modal tasks where a text query is used to search an image database, the queries and data exhibit different statistical distributions. Ignoring these discrepancies leads to significant accuracy drops after compression.
Proposed Methodology
To address these challenges, we introduce two distinct but related approaches:
1. LeanVec-Sphering (Linear)
LeanVec-Sphering is a refined linear projection method that utilizes a "sphering" (or whitening) transformation based on the query distribution to flatten its spectrum. Unlike previous iterations, this version features a closed-form solution based on Singular Value Decomposition (SVD), resulting in faster training and zero hyperparameter tuning.
A key advantage of LeanVec-Sphering is its flexibility. While most methods require committing to a target dimensionality ($d$) during index construction, LeanVec-Sphering allows users to tune $d$ at search time to dynamically trade off accuracy for speed.
2. GleanVec (Nonlinear)
Short for "Generalized LeanVec," this method employs a piecewise linear approach. By partitioning the database into clusters using spherical k-means, GleanVec learns specific local linear projections for each cluster. This captures complex local structures in high-dimensional space that a global linear projection would miss, mimicking the power of deep neural networks while remaining computationally efficient for live search.
Experimental Evaluation
We evaluated these methods on a massive suite of datasets (1M to 13M vectors) covering both ID and OOD scenarios, including GIST-1M, Google Open Images (OI-13M), and cross-modal benchmarks like LAION-1M.
- OOD Superiority: LeanVec-Sphering outperformed state-of-the-art linear methods in every OOD test, proving that "sphering" the query space before projection is critical for cross-modal accuracy.
- Nonlinear Gains: GleanVec consistently outperformed LeanVec-Sphering, particularly at very low target dimensionalities. On the LAION-1M-OOD dataset, GleanVec maintained significantly higher recall at 64 dimensions compared to linear alternatives.
- Efficiency: LeanVec-Sphering is highly scalable, with complexity that is cubic in $D$ and linear in $n$.
Discussion and Future Work
While LeanVec-Sphering and GleanVec establish a new state-of-the-art, future work will focus on integrating these algorithms into production libraries like FAISS or HNSW to measure real-world Queries Per Second (QPS) gains. Additionally, we aim to explore end-to-end training—optimizing clustering and projections simultaneously—to further unlock accuracy improvements. Engineering efforts will also address potential cache contention issues when using a high number of clusters in GleanVec.
Summary updated