Table of Contents
Fetching ...

SMEC: Rethinking Matryoshka Representation Learning for Retrieval Embedding Compression

Biao Zhang, Lixin Chen, Tong Liu, Bo Zheng

TL;DR

SMEC tackles the challenge of deploying high-dimensional LLM embeddings by introducing three components: Sequential Matryoshka Representation Learning (SMRL) to reduce gradient variance, Adaptive Dimension Selection (ADS) to minimize information loss, and Selectable Cross-Batch Memory (S-XBM) to improve unsupervised alignment between high- and low-dimensional embeddings. The analysis shows gradient variance in parallel MRL training scales with $∂L^d/∂w_i ∝ 1/δ(d)^2$, and SMRL mitigates this through staged transitions, while ADS and S-XBM preserve information and promote cross-batch learning. Empirically, SMEC achieves substantial dimensionality reduction with minimal performance loss across text, image, and multimodal retrieval tasks, notably boosting BEIR performance at moderate compression (e.g., 128-d embeddings). These results suggest SMEC as a practical solution for scalable, real-world retrieval systems that require compact, high-quality embeddings.

Abstract

Large language models (LLMs) generate high-dimensional embeddings that capture rich semantic and syntactic information. However, high-dimensional embeddings exacerbate computational complexity and storage requirements, thereby hindering practical deployment. To address these challenges, we propose a novel training framework named Sequential Matryoshka Embedding Compression (SMEC). This framework introduces the Sequential Matryoshka Representation Learning(SMRL) method to mitigate gradient variance during training, the Adaptive Dimension Selection (ADS) module to reduce information degradation during dimension pruning, and the Selectable Cross-batch Memory (S-XBM) module to enhance unsupervised learning between high- and low-dimensional embeddings. Experiments on image, text, and multimodal datasets demonstrate that SMEC achieves significant dimensionality reduction while maintaining performance. For instance, on the BEIR dataset, our approach improves the performance of compressed LLM2Vec embeddings (256 dimensions) by 1.1 points and 2.7 points compared to the Matryoshka-Adaptor and Search-Adaptor models, respectively.

SMEC: Rethinking Matryoshka Representation Learning for Retrieval Embedding Compression

TL;DR

SMEC tackles the challenge of deploying high-dimensional LLM embeddings by introducing three components: Sequential Matryoshka Representation Learning (SMRL) to reduce gradient variance, Adaptive Dimension Selection (ADS) to minimize information loss, and Selectable Cross-Batch Memory (S-XBM) to improve unsupervised alignment between high- and low-dimensional embeddings. The analysis shows gradient variance in parallel MRL training scales with , and SMRL mitigates this through staged transitions, while ADS and S-XBM preserve information and promote cross-batch learning. Empirically, SMEC achieves substantial dimensionality reduction with minimal performance loss across text, image, and multimodal retrieval tasks, notably boosting BEIR performance at moderate compression (e.g., 128-d embeddings). These results suggest SMEC as a practical solution for scalable, real-world retrieval systems that require compact, high-quality embeddings.

Abstract

Large language models (LLMs) generate high-dimensional embeddings that capture rich semantic and syntactic information. However, high-dimensional embeddings exacerbate computational complexity and storage requirements, thereby hindering practical deployment. To address these challenges, we propose a novel training framework named Sequential Matryoshka Embedding Compression (SMEC). This framework introduces the Sequential Matryoshka Representation Learning(SMRL) method to mitigate gradient variance during training, the Adaptive Dimension Selection (ADS) module to reduce information degradation during dimension pruning, and the Selectable Cross-batch Memory (S-XBM) module to enhance unsupervised learning between high- and low-dimensional embeddings. Experiments on image, text, and multimodal datasets demonstrate that SMEC achieves significant dimensionality reduction while maintaining performance. For instance, on the BEIR dataset, our approach improves the performance of compressed LLM2Vec embeddings (256 dimensions) by 1.1 points and 2.7 points compared to the Matryoshka-Adaptor and Search-Adaptor models, respectively.
Paper Structure (23 sections, 19 equations, 8 figures, 4 tables)

This paper contains 23 sections, 19 equations, 8 figures, 4 tables.

Figures (8)

  • Figure 1: The effectiveness of the SMEC in dimensionality reduction. After customized training with the SMEC method on BEIR Quora dataset, the embeddings of LLM2Vec-7B (3584 dimensions) and LLM2Vec-1B (1536 dimensions) can achieve 14$\times$ and 12$\times$ lossless compression, respectively.
  • Figure 2: Illustration of embedding compression architectures and our proposed approach. (a) presents the direct feature dimensionality reduction performed by the Search-Adaptor using FC layers. (b) illustrates the Matryoshka-Adaptor, which employs a shared set of FC layers to generate low-dimensional embeddings with multiple output dimensions. A Matryoshka-like hierarchical inclusion relationship exists between the high- and low-dimensional embeddings. (c) presents our proposed Sequential Matryoshka Embedding Compression (SMEC) framework, which adopts a sequential approach to progressively reduce high-dimensional embeddings to the target dimension. The animated diagram in the upper-right corner vividly highlights the distinction between Matryoshka-Adaptor and SMEC.
  • Figure 3: The ADS module introduces a set of learnable parameters to dynamically select dimensions based on their importance during the dimensionality reduction process.
  • Figure 4: S-XBM maintains a queue during training to store historical features across batches. Rather than incorporating all stored features into the current batch, it selectively leverages hard samples that exhibit high similarity to the current batch samples.
  • Figure 5: Experimental results on the BEIR dataset comparing two models: OpenAI’s text-embedding-3-large (with 3072 dimensions) and LLM2Vec (with 3548 dimensions), the latter built upon the Qwen2-7B model. OpenAI text embeddings inherently contain multi-scale representations (enabled by MRL during pretraining), while LLM2Vec obtains its orignal low-dimensional representations via PCA.
  • ...and 3 more figures