arXiv:2503.00353cs.CLcs.IR2025-03被引 26

提出统一评估框架,对比大模型与检索增强在长文本中的表现。

U-NIAH: Unified RAG and LLM Evaluation for Long Context Needle-In-A-Haystack

  • 构建多配置长文本测试框架,涵盖多种复杂场景。
  • 小模型用检索后胜率提升至82.58%,显著缓解中间丢失问题。
  • 发现高级模型反被干扰,适合优化部署策略的团队参考。

近期大语言模型(LLMs)的上下文窗口扩展至前所未有的长度,引发了对检索增强生成(RAG)必要性的讨论。为解决现有针堆中找针(NIAH)测试范式碎片化和案例有限的问题,本文提出U-NIAH统一框架,在受控的长上下文环境中系统比较LLM与RAG方法。该框架拓展了传统NIAH,引入多针、长针、针中针等配置及不同检索设置,并基于虚构的魔法世界数据集Starlight Academy,消除预训练知识带来的偏差。通过大量实验,研究三个问题:(1) LLM与RAG的性能权衡,(2) RAG的错误模式,(3) 复杂场景下RAG的局限性。结果表明,RAG显著提升小型LLM表现,缓解“中间丢失”效应,胜率达82.58%;但检索噪声和反向分块顺序会降低效果,而高级推理模型因对语义干扰敏感,反而表现出更低的RAG兼容性。识别出典型错误模式包括噪声导致遗漏、高噪声关键条件下幻觉,以及自我怀疑行为。本工作揭示了RAG与LLM的互补角色,为实际部署提供可操作洞察。代码已开源。

原文摘要 · Abstract (English)

Recent advancements in Large Language Models (LLMs) have expanded their context windows to unprecedented lengths, sparking debates about the necessity of Retrieval-Augmented Generation (RAG). To address the fragmented evaluation paradigms and limited cases in existing Needle-in-a-Haystack (NIAH), this paper introduces U-NIAH, a unified framework that systematically compares LLMs and RAG methods in controlled long context settings. Our framework extends beyond traditional NIAH by incorporating multi-needle, long-needle, and needle-in-needle configurations, along with different retrieval settings, while leveraging the synthetic Starlight Academy dataset-a fictional magical universe-to eliminate biases from pre-trained knowledge. Through extensive experiments, we investigate three research questions: (1) performance trade-offs between LLMs and RAG, (2) error patterns in RAG, and (3) RAG's limitations in complex settings. Our findings show that RAG significantly enhances smaller LLMs by mitigating the "lost-in-the-middle" effect and improving robustness, achieving an 82.58% win-rate over LLMs. However, we observe that retrieval noise and reverse chunk ordering degrade performance, while surprisingly, advanced reasoning LLMs exhibit reduced RAG compatibility due to sensitivity to semantic distractors. We identify typical error patterns including omission due to noise, hallucination under high noise critical condition, and self-doubt behaviors. Our work not only highlights the complementary roles of RAG and LLMs, but also provides actionable insights for optimizing deployments. Code: https://github.com/Tongji-KGLLM/U-NIAH.

RAG长上下文评估框架大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。