链载Ai

标题: RAG 真的能“不暴露私有数据”吗?答案是:可以 [打印本页]

作者: 链载Ai    时间: 昨天 22:36
标题: RAG 真的能“不暴露私有数据”吗?答案是:可以

你是否认真考虑过 RAG 流水线中的文档隐私?这篇文章也许能提供一个有帮助的方向。

为什么“Standard RAG → Cloud Search”在隐私上行不通

Standard RAG 的做法是把明文文档塞进 prompt。对于企业合同、病历或个人笔记等输入,这是完全不可行的——从设计上你就在暴露敏感数据。

Parametric RAG (PRAG) 试图把知识“烘进”LoRA 权重,但在实践中碰上两堵墙:

  1. 运维负担与时延。每份文档都需要各自的 synthetic Q&A 生成以及定制化的 LoRA 微调。在线服务时还要在这些 adapter 之间周转切换,真实世界的时延与运维开销难以接受。

  2. 表示不对齐。模型从 synthetic Q&A 学到的内容,往往与 Standard RAG 的表征与检索方式对不上,导致在 OOD 输入上的泛化较弱。

什么是 DistilledPRAG?(一句话版)

通过知识蒸馏,让“学生模型”(parametric RAG)在对齐文档结构与内部激活的前提下,逼近“教师模型”(standard RAG)的推理能力,并且全程不发送明文。

实操要点

Figure 1: Inference Paradigms for standard RAG, PRAG, DyPRAG, and DistilledPRAG. (1) Standard RAG inputs the plaintext documents and question. (2) PRAG generates QA pairs per document to fine-tune LoRA adapters, and sums them to obtain document aggregated representations for LLM injection. (3) DyPRAG translates individual documents to its LoRA and averages them to achieve document aggregation for LLM injection. (4) DistilledPRAG concatenates documents to parameter generator to create cross-document LoRA, and masks documents with question as input, more similar to standard RAG. [Source].

Figure 1 对比了 Standard RAG、PRAG、DyPRAG 与 DistilledPRAG 的推理模式。DistilledPRAG 会检索并拼接多份文档,然后“一次性”生成单个跨文档 LoRA——其输入流更接近 Standard RAG。

深入解析:DistilledPRAG 的三个核心组件

Figure 2: The Architecture of DistilledPRAG Model. 1. Use <a href=DeepSeek-V3 to mine knowledge from a single document and augmented cross-documents by random concatenation. 2. Train a parameter generator to map documents to a LoRA for student LLM, enabling it to mimic a teacher RAG's reasoning by minimizing differences in hidden states and logits on synthetic data. [Source]." class="rich_pages wxw-img" data-ratio="0.29907407407407405" data-type="jpeg" data-w="1080" style="max-width: 100%;height: auto;display: block;margin: 1.5em auto;border-radius: 5px;" data-imgfileid="100002890">

Figure 2 展示了 DistilledPRAG 中的 parameter generator 的工作方式:LongT5 对文档编码 → 按层索引的可学习 queries 执行 cross-attention pooling → self-attention encoder 进一步提炼信号 → FFN 产生目标 LoRA。仅训练 generator;base LLM 与 document encoder 均冻结。

合成数据:让跨文档推理成为默认模式

parameter generator:从长文档到单个 LoRA 包

对齐目标:generation、hidden states 与 logits

推理范式:与训练严格同构

用 BM25 检索 top-3 文档 → 按检索顺序拼接 → 用特殊的 mask tokens 替换文档得到 x~ → parameter generator 产出单个 LoRA Δθ → 使用适配后的基础模型 fθ+Δθ 回答。全程不暴露明文。

评价

Figure 3: Overall F1(%) performance of DistilledPRAG and baselines on 2WQA, HQA, PQA and CWQ datasets. Bold indicates the best performance, and underlined indicates the second best. [Source].

设置。以各子任务 dev 集的前 300 个问题计算 F1 (%)。检索固定为 BM25(top-3)。训练仅使用 2WQA。基线包括 Standard RAG、PRAG、DyPRAG 与 PISCO。

主要结果:

结论。即便只在 2WQA 上训练,DistilledPRAG 在 HQA、PQA、CWQ 等 OOD 数据集上也能保持竞争力,甚至领先。证据表明,同时对齐结构与激活比单靠 synthetic QA 的迁移更有效。

思考

关键洞见在于把多文档证据压缩为一个跨文档的 LoRA,并用“二重对齐”(hidden states + logits)让学生模型在从未见过明文的情况下逼近教师的决策边界。本质上,这是把检索上下文从显式的 context window 转移到了隐式的 parameter channel。

两项现实成本值得注意:计算量随 mask 长度与 base model 规模增长;同时 generator 在 OOD 输入上的鲁棒性仍需压测。可以通过两点改进权衡:(a) 将单一、统计初始化的 mask 升级为分层、可组合的 token 集合;(b) 在 generator 中加入结构化稀疏与可验证的信息流约束——两者都旨在获得更好的延迟-隐私 Pareto。

进一步地,把“single LoRA”泛化为一个 task-graph-aware 的 LoRA 组件混合体,其中不同的证据簇激活可解释的低秩子空间;并行配套一个可审计的 retrieval trace,使多跳推理在可解释性与误差控制上同步增强,而非在多跳中累积失真。






欢迎光临 链载Ai (https://www.lianzai.com/) Powered by Discuz! X3.5