arXiv:2412.15605cs.CL2024-12中稿 · the Web Conference…被引 80

用预加载缓存代替实时检索,提升知识问答效率

Don't Do RAG: When Cache-Augmented Generation is All You Need for Knowledge Tasks

  • 将知识库预先加载至长上下文,推理时直接调用缓存参数
  • 在多个基准测试中表现优于或媲美传统RAG,无检索延迟
  • 适合知识库有限、追求低延迟的场景,系统更简洁

检索增强生成(RAG)虽能提升语言模型的外部知识能力,但存在检索延迟、文档选择错误及系统复杂度高等问题。随着大语言模型上下文窗口显著扩展,本文提出一种替代方案——缓存增强生成(CAG),避免实时检索。该方法将所有相关资源(尤其当知识来源规模有限且可管理时)预先加载至模型上下文,并缓存运行时参数。推理时,模型直接利用预加载内容回答问题,无需额外检索。对比分析显示,CAG有效消除检索延迟,减少检索误差,同时保持上下文相关性。在多个基准测试中,长上下文LLM在部分场景下超越或补充传统RAG流程。结果表明,对于特定应用(如知识库受限的情况),CAG提供了一种更简洁高效的替代路径,实现相当或更优性能的同时降低系统复杂度。

原文摘要 · Abstract (English)

Retrieval-augmented generation (RAG) has gained traction as a powerful approach for enhancing language models by integrating external knowledge sources. However, RAG introduces challenges such as retrieval latency, potential errors in document selection, and increased system complexity. With the advent of large language models (LLMs) featuring significantly extended context windows, this paper proposes an alternative paradigm, cache-augmented generation (CAG) that bypasses real-time retrieval. Our method involves preloading all relevant resources, especially when the documents or knowledge for retrieval are of a limited and manageable size, into the LLM's extended context and caching its runtime parameters. During inference, the model utilizes these preloaded parameters to answer queries without additional retrieval steps. Comparative analyses reveal that CAG eliminates retrieval latency and minimizes retrieval errors while maintaining context relevance. Performance evaluations across multiple benchmarks highlight scenarios where long-context LLMs either outperform or complement traditional RAG pipelines. These findings suggest that, for certain applications, particularly those with a constrained knowledge base, CAG provide a streamlined and efficient alternative to RAG, achieving comparable or superior results with reduced complexity.

大模型知识增强缓存机制

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