Research paper and models for generative representational instruction tuning
Top 51.6% on sourcepulse
This repository provides the code and resources for Generative Representational Instruction Tuning (GRIT), a novel method for training large language models to excel at both text generation and embedding tasks. It targets researchers and developers seeking to unify these capabilities in a single model, offering significant speedups for applications like Retrieval-Augmented Generation (RAG).
How It Works
GRIT trains a single model to handle both generative and embedding tasks by using specific instructions to differentiate between them. This approach, implemented via custom modeling files that enable bidirectional attention for embeddings and causal attention for generation, allows for a unified model that achieves state-of-the-art performance on embedding benchmarks (MTEB) and competitive results on generative tasks, without performance degradation compared to specialized models.
Quick Start & Requirements
pip install gritlm
device_map="auto"
is recommended.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
--mode unified
with gradient_accumulation_steps > 1
is not supported.torch.compile
fails in unified mode.accelerate
and transformers
.1 month ago
1 day