UNREAL:用单一模型统一检索与长上下文

·

研究论文 · 2026/10/07

长上下文推理与检索增强生成(RAG)在证据选择上处理的规模差异巨大,从单个长提示到整个语料库。我们探究单一模型内部机制能否跨此范围选择证据。我们提出UNREAL(用单一模型统一检索与长上下文),一种模型原生的证据选择框架,以覆盖语料检索与长上下文推理。UNREAL编码块并直接从冻结LLM的内部表示中导出检索查询。它添加少于50万可训练参数,且保持主干不变。在30亿token、2100万块的维基百科索引上,所有四个密集和混合UNREAL主干均优于最先进的检索器-重排器系统。最佳模型将HotpotQA的召回率从49.1%提升至73.2%,2WikiMultiHopQA从31.7%提升至60.1%,MuSiQue从8.8%提升至14.4%。应用于长上下文任务时,同一选择机制在生成前移除干扰项,将NoLiMa在最大上下文长度128K token下的准确率从1.0%提升至24.83%,LV-Eval在256K下的F1分数从49.97%提升至54.66%。UNREAL还从约32K token起减少FLOPs和首token时间,且随上下文增长收益更大。这些结果共同确立了模型内部证据选择作为语料检索和证据稀疏长上下文推理的共同基础。

该工作提出了一种参数高效的方法,用单一模型内部机制统一检索与长上下文推理,在多个基准上显著超越现有系统,并降低计算开销,对RAG和长上下文处理有重要启示。

Long-context inference and Retrieval-Augmented Generation (RAG) handle evidence selection at vastly different scales, from a single long prompt to an entire corpus. We ask whether a single model-internal mechanism can select evidence across this range. We introduce UNifying REtrieval And Long-Context with a Single Model (UNREAL), a model-native evidence selection framework to span corpus retrieval and long-context inference. UNREAL encodes chunks and derives retrieval queries directly from the frozen LLM's internal representations. It adds fewer than 500K trainable parameters and leaves the backbone unchanged. On a 3B-token, 21M-chunk Wikipedia index, all four dense and hybrid UNREAL backbones outperform state-of-the-art retriever-reranker systems. The best model raises recall from 49.1% to 73.2% on HotpotQA, from 31.7% to 60.1% on 2WikiMultiHopQA, and from 8.8% to 14.4% on MuSiQue. Applied to long-context tasks, the same selection mechanism removes distractors before generation, raising NoLiMa accuracy from 1.0% to 24.83% at its maximum context length of 128K tokens, and LV-Eval's F1 score from 49.97% to 54.66% at 256K. UNREAL also reduces FLOPs and time-to-first-token relative to full-context inference from roughly 32K tokens onward, with larger gains as context grows. Together, these results establish model-internal evidence selection as a common foundation for corpus retrieval and evidence-sparse long-context inference.

阅读原文

参与讨论