将外部知识注入模型参数,提升大模型问答效率与准确性
Parametric Retrieval Augmented Generation
- 通过文档参数化将知识直接融入模型前馈网络参数
- 减少输入上下文长度,计算成本降低40%以上
- 适合需要高效知识更新的工业级应用
检索增强生成(RAG)技术通过从外部语料库中检索相关文档并注入大语言模型(LLM)输入,以提升其可靠性,缓解幻觉、知识过时和领域适应问题。然而,该方法在复杂推理任务中因上下文长度增加导致性能下降,且仅在输入层操作,未能深入整合到模型参数中。为此,本文提出参数化检索增强生成(Parametric RAG),通过文档参数化将外部知识直接嵌入LLM前馈网络(FFN)的参数中。该方法避免了在输入中注入多篇文档带来的计算开销,同时深化了外部知识与模型内在参数空间的融合。实验表明,该方法显著提升了知识增强的效果与效率,并可与传统RAG结合实现更优性能。代码、数据与模型已开源。
原文摘要 · Abstract (English)
Retrieval-augmented generation (RAG) techniques have emerged as a promising solution to enhance the reliability of large language models (LLMs) by addressing issues like hallucinations, outdated knowledge, and domain adaptation. In particular, existing RAG methods append relevant documents retrieved from external corpus or databases to the input of LLMs to guide their generation process, which we refer to as the in-context knowledge injection method. While this approach is simple and often effective, it has inherent limitations. Firstly, increasing the context length and number of relevant documents can lead to higher computational overhead and degraded performance, especially in complex reasoning tasks. More importantly, in-context knowledge injection operates primarily at the input level, but LLMs store their internal knowledge in their parameters. This gap fundamentally limits the capacity of in-context methods. To this end, we introduce Parametric retrieval-augmented generation (Parametric RAG), a new RAG paradigm that integrates external knowledge directly into the parameters of feed-forward networks (FFN) of an LLM through document parameterization. This approach not only saves online computational costs by eliminating the need to inject multiple documents into the LLMs' input context, but also deepens the integration of external knowledge into the parametric knowledge space of the LLM. Experimental results demonstrate that Parametric RAG substantially enhances both the effectiveness and efficiency of knowledge augmentation in LLMs. Also, it can be combined with in-context RAG methods to achieve even better performance. We have open-sourced all the code, data, and models in the following anonymized GitHub link: https://github.com/oneal2000/PRAG
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。