边写:长上下文检索的更佳推理模式
计算与语言
2024-08-28 v1 信息检索
摘要
本文介绍了一种名为 Writing in the Margins(WiM)的新型推理模式,用于优化大型语言模型在检索导向任务中处理长输入序列的方式。该方法利用键值缓存的分块预填充(chunked prefill)进行分段推理,从而高效处理大规模上下文,同时生成和分类“边缘”(margins)中的中间信息,以引导模型针对特定任务发挥作用。该方法仅增加极少的计算开销,却显著提升了无需微调即能使用的模型性能。具体而言,我们观察到 WiM 在推理技能方面(HotpotQA、MultiHop-RAG)可实现平均提升 7.5% 的准确率,在聚合类任务(CWE)上 F1 分数提升超过 30.0%。此外,我们展示了该提议模式如何融入交互式检索设计,为最终用户提供关于上下文处理进度的持续更新,并精确定位相关信息如何整合到最终响应中。我们在 Hugging Face Transformers 库中发布了 WiM 的实现,地址为 https://github.com/writer/writing-in-the-margins。
引用
@article{arxiv.2408.14906,
title = {Writing in the Margins: Better Inference Pattern for Long Context Retrieval},
author = {Melisa Russak and Umar Jamil and Christopher Bryant and Kiran Kamble and Axel Magnuson and Mateusz Russak and Waseem AlShikh},
journal= {arXiv preprint arXiv:2408.14906},
year = {2024}
}