arXiv:2508.16983cs.CLcs.AI2025-08中稿 · ISWC

让大模型用外部知识时更可靠,且无需额外工具

ReFactX: Scalable Reasoning with Reliable Facts via Constrained Generation

  • 用前缀树索引知识图谱事实,生成时只允许合法事实序列
  • 支持8亿条事实的快速检索,推理开销极小
  • 适合需要高可靠性的问答系统和领域专用模型

大语言模型在缺乏必要信息时易产生幻觉和知识空白。现有方法如检索增强生成(RAG)和工具调用依赖外部模型或服务,导致流程复杂、错误传播风险高,且需处理大量文本。本文提出ReFactX,一种无需检索器或辅助模型的可扩展方法。通过将知识图谱三元组转化为文本事实并构建前缀树索引,模型在推理时采用受限生成,仅允许生成已存在的事实序列。实验表明,该方法可扩展至包含8亿条事实的知识库,适应特定领域数据,在问答任务中取得有效性能,且生成阶段开销极低。

原文摘要 · Abstract (English)

Knowledge gaps and hallucinations are persistent challenges for Large Language Models (LLMs), which generate unreliable responses when lacking the necessary information to fulfill user instructions. Existing approaches, such as Retrieval-Augmented Generation (RAG) and tool use, aim to address these issues by incorporating external knowledge. Yet, they rely on additional models or services, resulting in complex pipelines, potential error propagation, and often requiring the model to process a large number of tokens. In this paper, we present a scalable method that enables LLMs to access external knowledge without depending on retrievers or auxiliary models. Our approach uses constrained generation with a pre-built prefix-tree index. Triples from a Knowledge Graph are verbalized in textual facts, tokenized, and indexed in a prefix tree for efficient access. During inference, to acquire external knowledge, the LLM generates facts with constrained generation which allows only sequences of tokens that form an existing fact. We evaluate our proposal on Question Answering and show that it scales to large knowledge bases (800 million facts), adapts to domain-specific data, and achieves effective results. These gains come with minimal generation-time overhead. ReFactX code is available at https://github.com/rpo19/ReFactX.

大模型知识图谱可靠生成

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