NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generative Representational Instruction Tuning

Niklas Muennighoff, Hongjin Su, Liang Wang, Nan Yang, Furu Wei, Tao Yu, Amanpreet Singh, Douwe Kiela

Introduction

The "Generative Representational Instruction Tuning" (GRIT) paper introduces a unified approach to training Large Language Models (LLMs) to excel at both text generation and text embedding simultaneously. By using specialized instructions to switch between these modes, the resulting GritLM models achieve state-of-the-art performance on the Massive Text Embedding Benchmark (MTEB) while outperforming much larger models on generative tasks. Crucially, this unification speeds up Retrieval-Augmented Generation (RAG) pipelines by over 60%.

Performance comparison of GritLM against specialized embedding and generative models.

The Bottleneck in Current NLP

In the current NLP landscape, models are typically specialists. "Representational" models (like BERT or E5) turn text into mathematical vectors (embeddings) for search and clustering, while "generative" models (like Llama or GPT) write text.

This split creates a massive bottleneck in systems like Retrieval-Augmented Generation (RAG). In a standard RAG pipeline, a document must first pass through an embedding model to be stored and retrieved, and then pass through a different generative model to answer a user's question. This is computationally redundant and prevents the two "halves" of the AI from sharing knowledge. Previous attempts to unify them usually resulted in a "jack of all trades, master of none" scenario, where the model's generative performance degraded once it was trained to embed.

Methodology: Generative Representational Instruction Tuning

The authors introduce Generative Representational Instruction Tuning (GRIT). The core idea is to treat embedding and generation as two distinct "skills" triggered by specific formatting and instructions.

GRIT unifies representational and generative instruction tuning, allowing a single model to output either embeddings or text based on the prompt.
  1. Instruction-Based Switching: The model uses specific formatting to distinguish tasks. For embeddings, it uses an <|embed|> token; for generation, it uses standard chat headers like <|user|> and <|assistant|>.
  2. Architectural Flexibility: While the base model is a standard decoder-only LLM (Mistral 7B or Mixtral 8x7B), the authors apply bidirectional attention during the embedding phase. This allows the model to look at the entire sentence at once to create a better representation, rather than just looking backward as generative models typically do.
  3. Unified Loss Function: The model is trained using a weighted sum of two losses: a contrastive loss for embeddings (learning to pull similar meanings together and push different ones apart) and a standard language modeling loss for generation.
  4. RAG Caching: Because the retriever and the generator are the same model, the system can utilize Query and Document Caching. It caches the Key-Value (KV) states during the embedding/retrieval step and reuses them during the generation step, skipping a massive amount of redundant computation.

Datasets and Evaluation

The authors utilized a mix of high-quality representational and generative data, including an adapted version of the E5 embedding dataset (E5S), the Tulu 2 instruction-tuning dataset, and MEDI2 (a new version of the Multi-task Embedding Data Inventory with improved "hard negatives").

Evaluation was conducted on the MTEB (56 datasets for embedding) and a suite of generative benchmarks including MMLU, GSM8K, BBH, and AlpacaEval.

Key Results and Insights

  • State-of-the-Art Embedding: GritLM-7B reached an average score of 66.8 on MTEB, making it one of the best open-source embedding models available, even beating specialized models like E5 Mistral 7B.
  • Strong Generation: Despite the dual-training, GritLM-7B outperformed Llama 2 70B on several generative benchmarks, despite being 10 times smaller.
  • Massive RAG Speedup: The unification led to a >60% increase in RAG speed for long documents. By caching the KV states, the model effectively halves the number of forward passes required for the query and context.
  • Synergy Over Compromise: The most profound insight is that generative and representational capabilities are not mutually exclusive. Training on both can actually improve embedding performance compared to training on embedding data alone.

Limitations and Future Work

While highly effective, GritLM-7B produces 4096-dimensional embeddings. This is significantly larger than the 768 or 1024 dimensions used by models like BERT or BGE, meaning users will need more storage for their vector databases. Additionally, while the model shows some cross-lingual capability, it remains primarily optimized for English.

Looking forward, the authors suggest the potential for "GritLM Agents." These agents could autonomously decide to invoke their own embedding capability to search an internal index when they realize they lack specific knowledge—essentially creating an LLM with a built-in, self-managed memory.

Summary updated

BibTeX
@inproceedings{muennighoff2025generative,
  author = {Niklas Muennighoff and Hongjin SU and Liang Wang and Nan Yang and Furu Wei and Tao Yu and Amanpreet Singh and Douwe Kiela},
  title = {{Generative Representational Instruction Tuning}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=BC4lIvfSzv},
}
Figure