Skip to main content
QUICK REVIEW

[论文解读] Generative Representational Instruction Tuning

Niklas Muennighoff, Hongjin Su|arXiv (Cornell University)|Feb 15, 2024
Innovative Teaching and Learning Methods被引用 13
一句话总结

GRIT 将嵌入与生成在一个大型语言模型中统一实现,在嵌入性能上达到最先进水平并具备强生成能力,同时实现更快的检索增强生成。该方法通过指令信号和两种并发损失来训练模型以处理两种任务。

ABSTRACT

All text-based language problems can be reduced to either generation or embedding. Current models only perform well at one or the other. We introduce generative representational instruction tuning (GRIT) whereby a large language model is trained to handle both generative and embedding tasks by distinguishing between them through instructions. Compared to other open models, our resulting GritLM 7B sets a new state of the art on the Massive Text Embedding Benchmark (MTEB) and outperforms all models up to its size on a range of generative tasks. By scaling up further, GritLM 8x7B outperforms all open generative language models that we tried while still being among the best embedding models. Notably, we find that GRIT matches training on only generative or embedding data, thus we can unify both at no performance loss. Among other benefits, the unification via GRIT speeds up Retrieval-Augmented Generation (RAG) by > 60% for long documents, by no longer requiring separate retrieval and generation models. Models, code, etc. are freely available at https://github.com/ContextualAI/gritlm.

研究动机与目标

  • 为单一模型在文本嵌入和生成任务上都表现出色,而非分离系统的动机。
  • 开发一种将嵌入表示学习与生成指令微调相结合的训练范式。
  • 证明一个统一的 GRIT 模型在各类任务上可以达到或超过专门的嵌入与生成基线。
  • 展示 GRIT 对检索增强生成和模型服务基础设施的实际好处。

提出的方法

  • 用两条数据流对预训练的 LLM 进行微调:嵌入(表示学习)和生成指令数据。
  • 对嵌入使用双向注意力与均值池化,对生成使用因果注意力和语言建模头。
  • 以可控的损失权重和样本级/标记级生成损失的混合,优化联合损失 L_GRIT = lambda_Rep L_Rep + lambda_Gen L_Gen。
  • 在数据源方面进行实验(嵌入:MEDI、MEDI2、E5;生成:Tülu 2、UltraChat、OpenAssistant)以及基础模型(Mistral 7B、Mixtral 8x7B 等)。
  • 在 56 个数据集的 MTEB 上评估嵌入,在如 MMLU、GSM8K、BBH、TyDi QA 及 HumanEval 变体等标准上评估生成。
  • 研究注意力类型、池化、嵌入头、批量大小、精度等架构选择,以及训练 regime,以在双目标之间取得平衡。

实验结果

研究问题

  • RQ1单一模型是否能在文本嵌入方面达到最先进水平,同时保持强的生成能力?
  • RQ2联合优化是否对性能至关重要,还是仅嵌入模型和仅生成模型就足够?
  • RQ3使用统一的 GRIT 模型在检索增强生成中的实际收益如何?
  • RQ4数据源、注意力方案和损失配置如何影响双任务性能?
  • RQ5统一模型的训练效率和推理成本有哪些权衡?

主要发现

  • GritLM 7B 在 Massive Text Embedding Benchmark (MTEB) 的开放模型中创造了新的一流水平。
  • GritLM 7B 还在若干生成任务上优于更大的开放生成模型。
  • GritLM 8x7B 成为在任务平均上的最佳开放生成模型,同时在推理阶段使用 13B。
  • 统一 GRIT 训练可以达到嵌入仅模型和生成仅模型的效果,ablations 显示联合损失对双任务性能至关重要。
  • 使用 GRIT 的 RAG 对长文档的推理速度提升 >60%,通过实现缓存并使用同一模型进行检索和生成。
  • 使用更大的嵌入批量(如 2048)可在不损害生成的情况下提升嵌入性能。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。