arXiv:2506.04202cs.CRcs.AI2025-06被引 13

提出首个长文本LLM溯源框架,精准定位生成结果的上下文来源。

TracLLM: A Generic Framework for Attributing Long Context LLMs

  • 基于智能搜索算法提升溯源效率,降低计算开销。
  • 融合贡献分集成与去噪技术,显著提高溯源准确性。
  • 适用于调试系统、攻击溯源和增强用户信任,实用性强。

长上下文大语言模型(LLMs)广泛应用于RAG、智能体及各类集成应用中。面对指令与长篇上下文(如文档、PDF、网页),这类模型可生成基于上下文的输出,提升准确性、时效性与可验证性,减少幻觉。这引出关键问题:如何精准定位导致输出的关键文本片段?我们称此过程为上下文溯源,具有重要实际价值,包括调试系统、分析攻击(如提示注入、知识污染)以及提升用户对模型输出的信任。现有特征归因方法(如Shapley值)在长上下文场景下效果不佳或成本过高。本文提出TracLLM,首个专为长上下文LLM设计的通用溯源框架。通过智能搜索算法提升效率,并引入贡献分集成与去噪技术增强精度。实验表明,TracLLM能有效识别影响输出的关键文本。代码与数据已公开于https://github.com/Wang-Yanting/TracLLM。

原文摘要 · Abstract (English)

Long context large language models (LLMs) are deployed in many real-world applications such as RAG, agent, and broad LLM-integrated applications. Given an instruction and a long context (e.g., documents, PDF files, webpages), a long context LLM can generate an output grounded in the provided context, aiming to provide more accurate, up-to-date, and verifiable outputs while reducing hallucinations and unsupported claims. This raises a research question: how to pinpoint the texts (e.g., sentences, passages, or paragraphs) in the context that contribute most to or are responsible for the generated output by an LLM? This process, which we call context traceback, has various real-world applications, such as 1) debugging LLM-based systems, 2) conducting post-attack forensic analysis for attacks (e.g., prompt injection attack, knowledge corruption attacks) to an LLM, and 3) highlighting knowledge sources to enhance the trust of users towards outputs generated by LLMs. When applied to context traceback for long context LLMs, existing feature attribution methods such as Shapley have sub-optimal performance and/or incur a large computational cost. In this work, we develop TracLLM, the first generic context traceback framework tailored to long context LLMs. Our framework can improve the effectiveness and efficiency of existing feature attribution methods. To improve the efficiency, we develop an informed search based algorithm in TracLLM. We also develop contribution score ensemble/denoising techniques to improve the accuracy of TracLLM. Our evaluation results show TracLLM can effectively identify texts in a long context that lead to the output of an LLM. Our code and data are at: https://github.com/Wang-Yanting/TracLLM.

LLM溯源长上下文可解释性智能推理

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