Repetition Improves Language Model Embeddings

Jacob Mitchell Springer, Suhas Kotha, Daniel Fried, Graham Neubig, Aditi Raghunathan

Introduction

Text embeddings—vector representations of meaning—are the backbone of modern AI tasks like semantic search and Retrieval-Augmented Generation (RAG). Historically, the best embeddings came from bidirectional models like BERT, where every word can "see" every other word in a sentence.

Modern Large Language Models (LLMs) like Llama or Mistral, however, are autoregressive. They use a causal mask, meaning early words cannot attend to later words. Researchers from Carnegie Mellon University have discovered a surprisingly simple way to turn standard autoregressive language models into top-tier embedding models: just feed the input twice. By "echoing" the text and extracting embeddings from the second occurrence, the model gains the bidirectional context it usually lacks, improving zero-shot performance by over 5% without any architectural changes or fine-tuning.

The Problem: The Causal Blind Spot

If the most important information in a sentence is at the end, the embeddings for the beginning of the sentence in an autoregressive model are "blind" to it. To fix this, researchers usually have to "cast" the model to be bidirectional and then perform expensive fine-tuning (like masked-language modeling). This paper asks: Can we get bidirectional quality from a causal model without changing a single weight?

The Solution: Echo Embeddings

The authors introduce Echo Embeddings, treating the LLM as an autoencoder via a simple prompting strategy.

Concept of Echo Embeddings
  1. The Prompt: Instead of feeding the sentence $x$ once, you feed it twice. For example: Rewrite the sentence: [x]; The rewritten sentence: [x].
  2. The Mechanism: Because the model is causal, the tokens in the second occurrence of $x$ can attend to all tokens in the first occurrence. This effectively gives the second pass a full, bidirectional view of the entire input.
  3. Extraction: Hidden states are extracted from the second occurrence of the text.
  4. Pooling: For zero-shot tasks, mean pooling (averaging the hidden states) works best. For fine-tuned models, last-token pooling (using the final hidden state) is superior.

Evaluation and Key Insights

The researchers evaluated their method using the Massive Text Embedding Benchmark (MTEB), a faster MTEB-MINI subset, and custom synthetic toy datasets designed to highlight the failure modes of causal models.

  • The Causal Blind Spot Confirmed: The synthetic datasets prove that "classical" causal embeddings fail miserably when discriminatory information is at the end of a string.
  • Prompt Robustness: Unlike many LLM techniques that are highly sensitive to prompt phrasing, Echo Embeddings are robust. Whether the model is asked to "Repeat," "Rewrite," or "Rephrase," performance gains remain consistent.
  • Unified Architecture: This approach paves the way for a single model that can generate text and produce high-quality embeddings simultaneously, without switching attention masks.

Key Results

Echo embeddings yield substantial improvements across the board, particularly in zero-shot settings.

MTEB-mini Scores
  • Zero-Shot Excellence: On the full MTEB benchmark using Mistral-7B, Echo Embeddings achieved an average score of 48.64, compared to 42.38 for the classical single-pass approach.
  • Beating the Classics: Echo embeddings outperformed established bidirectional encoders like BERT-large and RoBERTa-large in zero-shot settings. They also nearly match models like LLM2Vec, which require an entire stage of unsupervised training to achieve bidirectionality.
  • Fine-Tuning: When fine-tuned, Echo models matched or slightly outperformed state-of-the-art models like GritLM-7B (64.68 vs 64.23 average MTEB score), even when compute-matched (halving the input length of the Echo model to match the total token count of a standard single-pass model).
  • The 64-Token Threshold: For sequences longer than ~64 tokens, Echo Embeddings consistently outperform bidirectional "casted" models, suggesting that the "echo" better preserves the model's original pre-trained knowledge.

Limitations and Future Work

The primary drawback of Echo Embeddings is computational cost. Repeating the input doubles the number of tokens. Since attention scales quadratically ($O(N^2)$), this significantly increases latency and memory usage for very long documents. Furthermore, for very short inputs (under 64 tokens), the benefit of the echo is marginal and may not justify the extra compute.

Future directions include exploring more sophisticated "reconstruction" tasks beyond simple repetition to extract richer semantic information, and investigating KV-caching optimizations to reduce the overhead of the first "pass" of the echo.

Summary updated

BibTeX
@inproceedings{springer2025repetition,
  author = {Jacob Mitchell Springer and Suhas Kotha and Daniel Fried and Graham Neubig and Aditi Raghunathan},
  title = {{Repetition Improves Language Model Embeddings}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=Ahlrf2HGJR},
}
Figure