Abstract
Traditional text embedding models typically rely on discriminative architectures trained to map text into a vector space optimized for cosine similarity. However, modern Large Language Models (LLMs) are inherently generative and autoregressive, creating a fundamental mismatch when they are repurposed as encoders. This paper introduces AutoRegEmbed, a framework that aligns LLM embeddings with their generative nature through two novel tasks: information compression and conditional distribution alignment. By leveraging the model's internal probability logic rather than forcing it into a discriminative box, AutoRegEmbed achieves state-of-the-art performance on semantic similarity tasks with extreme data efficiency, requiring only a fraction of the training data used by traditional contrastive methods.
Introduction
The transition from BERT-style discriminative encoders to generative LLMs has presented a challenge for representation learning. LLMs are pre-trained to predict the next token, a task that emphasizes local semantics. In contrast, text embeddings require a global representation of the entire input.
When researchers apply standard contrastive learning (such as InfoNCE) to LLMs, they encounter an "objective conflict." Forcing a model optimized for probability distributions to instead optimize for cosine similarity is computationally expensive and often requires millions of data triplets. AutoRegEmbed addresses this by working "with the grain" of the LLM’s architecture, redefining how we extract and align global semantics from generative models.
Methodology
AutoRegEmbed consists of two primary components designed to bridge the gap between next-token prediction and global text representation.
1. Information Compression for Global Semantics
To shift the model's focus from local next-token prediction to global understanding, the framework introduces an information bottleneck. A small set of "compressed tokens" is appended to the input text. The model is then tasked with reconstructing the original input using only the hidden states of these compressed tokens. This reconstruction requirement forces the embeddings to capture the essential global meaning of the text, effectively solving the "pooling" problem without relying on arbitrary methods like mean pooling.
2. Conditional Distribution Alignment
Rather than using standard cosine similarity between vectors, AutoRegEmbed utilizes a generative contrastive objective. Inspired by Direct Preference Optimization (DPO), the authors align the probability of a query generating a positive sample with the probability of that sample generating itself. By using log-probabilities as the similarity metric during training, the model leverages its pre-trained generative strengths. This ensures the embedding space is organized according to the model's internal likelihood logic, significantly improving the speed and stability of convergence.
Experimental Setup
The framework was trained and evaluated using a variety of open-source datasets:
- Training: The information compression task utilized the Papers with Code (PWC) dataset (~16k samples). The alignment stage used the MEDI and BGE datasets, with sample sizes ranging from 50k to 275k.
- Evaluation: Performance was measured using the MTEB Semantic Textual Similarity (STS) benchmarks (10 datasets including STS12-16, STS-B, and SICK-R) and standard retrieval benchmarks like MS MARCO and NFCorpus.
Key Results and Insights
Extreme Data Efficiency
One of the most significant findings is the framework's efficiency. AutoRegEmbed reaches peak performance with approximately 15,000 samples. In comparison, competing state-of-the-art (SOTA) models often require millions of triplets to achieve similar results. Pareto front analysis confirms that AutoRegEmbed provides a superior balance between performance and training data volume.
Performance Benchmarks
On the 10 STS benchmarks, AutoRegEmbed-Mistral-7B achieved an average score of 84.59. This outperforms the supervised version of LLM2Vec (84.01), despite AutoRegEmbed using significantly less training data.
Ablation Studies
Ablation results highlight the necessity of both core components:
- Removing Information Compression resulted in a 16.99% drop in performance.
- Removing Conditional Distribution Alignment resulted in a 9.17% drop. These figures demonstrate that the bottleneck for global semantics is the most critical factor in transforming a generator into an effective encoder.
Discussion and Limitations
While AutoRegEmbed represents a significant step forward in LLM embedding efficiency, several challenges remain:
- Safety and Bias: The framework does not include an inherent mechanism to filter or mitigate biases present in the pre-training data, which the generative nature of the model might amplify.
- The Retrieval Gap: In asymmetric retrieval tasks (short query to long document), there remains a performance gap compared to models trained on massive, closed-source datasets. Further fine-tuning on diverse retrieval data may be necessary to close this gap.
- Inference Consistency: Although the model is trained on probability distributions, it still utilizes inner product matching during inference to maintain compatibility with existing vector databases. Future research may explore "pure" retrieval methods that stay entirely within the probability domain.
Conclusion
AutoRegEmbed demonstrates that the most effective way to derive embeddings from LLMs is to respect their autoregressive nature. By replacing discriminative objectives with compression and probabilistic alignment, the framework achieves high-quality semantic representations with unprecedented data efficiency. This approach paves the way for more sustainable and architecturally consistent methods for turning generative models into powerful text encoders.
Summary updated