arXiv:2508.03098cs.CL2025-08KDD被引 11

给大模型生成加隐私保护,不让敏感信息泄露。

Privacy-Aware Decoding: Mitigating Privacy Leakage of Large Language Models in Retrieval-Augmented Generation

  • 生成时动态注入高斯噪声,只保护高风险词元
  • 实测能大幅减少隐私泄露,同时保持回答质量
  • 无需重训练,适合医疗金融等敏感场景使用

检索增强生成(RAG)通过引入外部知识提升大语言模型的事实准确性,但当检索涉及私密数据时,生成结果可能被攻击者提取出敏感信息。本文提出隐私感知解码(PAD),一种轻量级、推理阶段的防御方法,在生成过程中自适应地向词元逻辑值注入校准后的高斯噪声。PAD结合置信度筛选机制,仅对高风险词元进行保护;通过高效敏感度估计减少不必要的噪声;并采用上下文感知的噪声校准策略,在隐私与生成质量间取得平衡。基于瑞尼差分隐私(RDP)会计追踪累积隐私损失,可为每条响应提供明确的(ε, δ)-差分隐私保证。与需重训练或语料过滤的现有方法不同,PAD无需模型修改,完全在解码阶段运行,计算开销极小。在三个真实数据集上的实验表明,PAD显著降低隐私泄露风险,同时保持输出实用性,优于现有基于检索或后处理的防御方案。本工作为缓解RAG中的隐私风险提供了有效的解码策略,推动了敏感领域中通用且可扩展的隐私保护解决方案的发展。代码已开源:https://github.com/wang2226/PAD。

原文摘要 · Abstract (English)

Retrieval-Augmented Generation (RAG) enhances the factual accuracy of large language models (LLMs) by conditioning outputs on external knowledge sources. However, when retrieval involves private or sensitive data, RAG systems are susceptible to extraction attacks that can leak confidential information through generated responses. We propose Privacy-Aware Decoding (PAD), a lightweight, inference-time defense that adaptively injects calibrated Gaussian noise into token logits during generation. PAD integrates confidence-based screening to selectively protect high-risk tokens, efficient sensitivity estimation to minimize unnecessary noise, and context-aware noise calibration to balance privacy with generation quality. A \renyi Differential Privacy (RDP) accountant rigorously tracks cumulative privacy loss, enabling explicit per-response $(\varepsilon, δ)$-DP guarantees for sensitive outputs. Unlike prior approaches requiring retraining or corpus-level filtering, PAD is model-agnostic and operates entirely at decoding time with minimal computational overhead. Experiments on three real-world datasets demonstrate that PAD substantially reduces private information leakage while preserving response utility, outperforming existing retrieval- and post-processing-based defenses. Our work takes an important step toward mitigating privacy risks in RAG via decoding strategies, paving the way for universal and scalable privacy solutions in sensitive domains. Our code is available: https://github.com/wang2226/PAD.

隐私保护大模型安全RAG差分隐私

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