arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2404.12096cs.CLcs.LG
收藏

LongEmbed:扩展嵌入模型以支持长上下文检索

LongEmbed: Extending Embedding Models for Long Context Retrieval

Microsoft Corporation(微软公司);School of Computer Science, Peking University(北京大学计算机学院);Jiangsu Normal University(江苏师范大学)

Dawei Zhu, Liang Wang, Nan Yang, Yifan Song, Wenhao Wu, Furu Wei, Sujian Li

AI总结:

本文提出LongEmbed基准,评估并扩展嵌入模型至32k上下文,免训练策略如位置插值有效,RoPE优于APE,发布模型与基准。

摘要:

嵌入模型在现代自然语言处理应用中扮演着关键角色,例如信息检索(IR)和检索增强生成(RAG)。虽然大语言模型(LLM)的上下文限制已被推至超过100万token,但嵌入模型仍局限于不超过8k token的狭窄上下文窗口,无法应用于需要长输入的场景,如法律合同。本文探索了现有嵌入模型的上下文窗口扩展,在不进行额外训练的情况下将限制推至32k。首先,我们在新构建的LongEmbed基准上检验了当前嵌入模型在长上下文检索中的性能。LongEmbed包含两个合成任务和四个精心选择的真实世界任务,其特点是文档长度各异且目标信息分散。基准测试结果凸显了这些模型存在巨大的改进空间。基于此,综合实验表明,诸如位置插值(position interpolation)等免训练的上下文窗口扩展策略能够有效地将现有嵌入模型的上下文窗口扩展数倍,无论其原始上下文是512还是超过4k。此外,对于采用绝对位置编码(APE)的模型,我们展示了进一步微调以获取显著性能提升的可能性,同时严格保持短输入时的原始行为。对于使用旋转位置嵌入(RoPE)的模型,在采用RoPE特定方法(如NTK和SelfExtend)时观察到显著增强,表明RoPE在上下文窗口扩展方面优于APE。为促进未来研究,我们发布了E5-Base-4k和E5-RoPE-Base,以及LongEmbed基准。

英文摘要:

Embedding models play a pivot role in modern NLP applications such as IR and RAG. While the context limit of LLMs has been pushed beyond 1 million tokens, embedding models are still confined to a narrow context window not exceeding 8k tokens, refrained from application scenarios requiring long inputs such as legal contracts. This paper explores context window extension of existing embedding models, pushing the limit to 32k without requiring additional training. First, we examine the performance of current embedding models for long context retrieval on our newly constructed LongEmbed benchmark. LongEmbed comprises two synthetic tasks and four carefully chosen real-world tasks, featuring documents of varying length and dispersed target information. Benchmarking results underscore huge room for improvement in these models. Based on this, comprehensive experiments show that training-free context window extension strategies like position interpolation can effectively extend the context window of existing embedding models by several folds, regardless of their original context being 512 or beyond 4k. Furthermore, for models employing absolute position encoding (APE), we show the possibility of further fine-tuning to harvest notable performance gains while strictly preserving original behavior for short inputs. For models using rotary position embedding (RoPE), significant enhancements are observed when employing RoPE-specific methods, such as NTK and SelfExtend, indicating RoPE's superiority over APE for context window extension. To facilitate future research, we release E5-Base-4k and E5-RoPE-Base, along with the LongEmbed benchmark.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑