Introduction
GIRCSE (Generative Iterative Refinement for Contrastive Sentence Embeddings) is a novel framework that treats Large Language Models (LLMs) as active reasoners rather than static feature extractors for text embeddings. By allowing LLMs to "speak" an internal, differentiable "embedding language" through autoregressive generation, the model iteratively refines its semantic representations. This approach achieves state-of-the-art performance and introduces a unique test-time scaling property where more generation steps lead to better embeddings.
The Problem with Static Embeddings
Most current LLM-based embedding models use an "encoder-only" approach. They take a text input, run a single forward pass, and extract a hidden state (often from the last token) to serve as the embedding. This treats the LLM as a static dictionary, completely ignoring its most powerful feature: the ability to reason and refine thoughts through autoregressive generation.
A single pass is often insufficient to capture complex, latent semantics or follow intricate instructions. The challenge lies in integrating generation into the embedding process without breaking differentiability or falling into the trap of generating human-readable text that might not be optimal for semantic similarity.
The GIRCSE Framework
To bridge the gap between generative capacity and contrastive learning, GIRCSE introduces two main innovations:
- Soft Token Generation: Instead of sampling discrete words—which would break the gradient flow needed for training—GIRCSE generates "soft tokens." Each step produces a probability distribution over the entire vocabulary, and the "token" passed to the next step is a weighted sum of all token embeddings in that distribution. This keeps the entire process end-to-end differentiable.
- Iterative Contrastive Refinement (ICR): To ensure that generation actually improves the embedding, the authors use a two-part objective:
- Stepwise Contrastive Loss: Every intermediate generation step is supervised with a contrastive loss, forcing early tokens to capture core concepts and later tokens to refine them.
- Iterative Refinement Regularization: A specific loss term that encourages the model to monotonically improve its embedding quality at each successive step.
Key Insights
- "Speaking" an Embedding Language: The generated tokens do not have to be human-readable. After fine-tuning, the model learns to generate a sequence of internal "concepts" that act as a semantic chain-of-thought. For example, to represent emotion, it might generate soft tokens related to "frustrating" or "struggle" to steer the final embedding into the correct region of the vector space.
- Test-Time Scaling for Embeddings: Similar to how reasoning models improve with more "thought" tokens, GIRCSE embeddings get better as you increase the number of generation steps at inference time—even beyond what it saw during training.
- Efficiency via KV Caching: While iterative generation sounds slow, using standard KV caching techniques reduces the computational overhead to nearly the same level as standard single-pass models (approximately 1.0–1.1x FLOPs).
Datasets and Evaluation
The model was trained on a 20% sample (0.2M pairs) of a large-scale dataset containing supervised pairs and hard negatives. It was evaluated on the MTEB (English, v2) benchmark, which covers 41 datasets across 7 task types (retrieval, clustering, etc.), as well as specialized Instruction Following tasks to test how well the model adheres to specific embedding prompts.
Key Results
GIRCSE achieves top-tier results across multiple benchmarks, often outperforming models trained on significantly more data.
- MTEB Performance: With a Mistral-7B backbone, GIRCSE achieves an average score of 67.83, significantly outperforming its "fair baseline" (66.32) trained on the exact same data.
- Instruction Following: The model ranks highly on nuanced tasks where it must "understand" the intent of the embedding request, proving the value of iterative refinement.
- Ablation Success: The combination of generation, stepwise loss, and iterative refinement is crucial for peak performance, as removing any component degrades the results.
Limitations and Future Work
While KV caching mitigates much of the cost, generating multiple tokens still requires slightly more memory and compute than a single-pass encoder. Furthermore, the current models were trained on only 0.2M samples due to resource constraints; scaling to the multi-million sample regimes used by state-of-the-art models could yield even more dramatic gains. Future directions include exploring more sophisticated "embedding languages" and investigating whether this generative approach can help bridge the gap between text and other modalities in a unified embedding space.
Summary updated