Skip to main content
QUICK REVIEW

[论文解读] Jina Embeddings 2: 8192-Token General-Purpose Text Embeddings for Long Documents

Michael Günther, Jackmin Ong|arXiv (Cornell University)|Oct 30, 2023
Topic ModelingComputer Science被引用 10
一句话总结

Jina Embeddings v2 引入了基于开源 BERT 的编码器,能够对多达 8192 token 进行编码,提升长文档嵌入,并在 MTEB 上达到与最先进检索性能的匹配,同时保持强劲的 GLUE 结果。

ABSTRACT

Text embedding models have emerged as powerful tools for transforming sentences into fixed-sized feature vectors that encapsulate semantic information. While these models are essential for tasks like information retrieval, semantic clustering, and text re-ranking, most existing open-source models, especially those built on architectures like BERT, struggle to represent lengthy documents and often resort to truncation. One common approach to mitigate this challenge involves splitting documents into smaller paragraphs for embedding. However, this strategy results in a much larger set of vectors, consequently leading to increased memory consumption and computationally intensive vector searches with elevated latency. To address these challenges, we introduce Jina Embeddings 2, an open-source text embedding model capable of accommodating up to 8192 tokens. This model is designed to transcend the conventional 512-token limit and adeptly process long documents. Jina Embeddings 2 not only achieves state-of-the-art performance on a range of embedding-related tasks in the MTEB benchmark but also matches the performance of OpenAI's proprietary ada-002 model. Additionally, our experiments indicate that an extended context can enhance performance in tasks such as NarrativeQA.

研究动机与目标

  • 解决在不截断或避免产生过多向量的情况下,用固定大小的嵌入表示长文档的挑战。
  • 基于改良的 BERT 主干,开发并微调一系列支持 8192 token 的编码器模型。
  • 利用 ALiBi 双向注意力在不使用传统位置嵌入的情况下实现长上下文编码。
  • 在标准基准上展示嵌入在检索、聚类和长文档任务中的有效性。
  • 通过 Hugging Face 发布模型和数据集,以实现广泛可访问性。

提出的方法

  • 在编码器中使用 ALiBi 双向注意力,修改类似 BERT 的主干以支持高达 8192 个 token,替代标准位置嵌入。
  • 在英文 C4 语料库上进行掩码语言模型预训练(MLM),不使用 NSP,采用整词掩码,掩码率为 30%。
  • 嵌入进行两阶段微调:(a) 文本对对比微调,以均值池化产生单向量表示;(b) 采用强负样本的监督微调,以提升排序和检索性能。
  • 使用基于 InfoNCE 的配对和跨对方向损失,温度 τ = 0.05,双向目标。
  • 采用大批量训练,混合精度与 DeepSpeed,并使用激活检查点来管理内存。
Figure 1: With ALiBi attention, a linear bias is incorporated into each attention score preceding the softmax operation. Each attention head employs a distinct constant scalar, $m$ , which diversifies its computation. Our model adopts the encoder variant where all tokens mutually attend during calcu
Figure 1: With ALiBi attention, a linear bias is incorporated into each attention score preceding the softmax operation. Each attention head employs a distinct constant scalar, $m$ , which diversifies its computation. Our model adopts the encoder variant where all tokens mutually attend during calcu

实验结果

研究问题

  • RQ1基于 ALiBi 的双向注意力是否能够在不截断到 512 token 的情况下实现长文档的双编码器嵌入?
  • RQ28192-token 的嵌入能否在 MTEB 基准上超越先前的开源模型并接近 OpenAI 的 ada-002 性能?
  • RQ3增加上下文长度对 NarrativeQA 等下游任务以及长文档聚类/检索有何影响?
  • RQ4两阶段微调(文本对与强负样本)对检索与非检索任务有何影响?
  • RQ5Jina Embeddings v2 模型是否开源并可通过 Hugging Face 使用,在各基准上具有竞争力的性能?

主要发现

  • 8192-token 的 Jina 基于 BERT 的编码器在多项 MTEB 任务上取得了最先进的结果,并在该基准上与 ada-002 相抗衡。
  • ALiBi 双向注意力使长上下文编码在无需位置嵌入的情况下成为可能,并在高达 8192 token 时保持 MLM 的准确性。
  • 对长上下文进行带强负样本的微调,提升了面向检索任务的检索和排序性能。
  • 在 NarrativeQA 等长上下文情境下的评估显示性能提升,并在长文档聚类任务中亦有提升,部分任务因文档结构不同而呈现混合效应。
  • 模型和数据集已在 Hugging Face 上开源发布。
Figure 2: Variation of model MLM accuracy w.r.t. the sequence length
Figure 2: Variation of model MLM accuracy w.r.t. the sequence length

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。