arXiv:2509.23459cs.CRcs.CL2025-09中稿 · NeurIPS被引 5

用抽象代替删除或泛化,保护隐私同时提升文本转SQL效果

MaskSQL: Safeguarding Privacy for LLM-Based Text-to-SQL via Abstraction

  • 通过信息抽象保留关键语义,屏蔽敏感内容
  • 在Text-to-SQL任务上性能接近顶尖LLM模型
  • 支持灵活调节隐私与效果平衡,适合高合规场景

大语言模型(LLMs)在需要推理的任务中表现优异,如文本转SQL、代码生成和调试。然而,严格的隐私监管限制了其在敏感系统中的应用。当前主流LLMs为专有模型,成本高且资源消耗大,本地部署不现实,使用时常需将数据共享给第三方,引发隐私风险。尽管微调的小语言模型(SLMs)可本地部署以缓解隐私问题,但在复杂任务如文本转SQL上表现不足。本文提出MaskSQL框架,利用抽象机制在提示词中屏蔽敏感信息。与完全删除(红笔)或泛化词汇不同,抽象保留必要信息而去除冗余细节,在隐私与任务性能间取得良好平衡。此外,该框架支持控制隐私-效用权衡,适用于更广泛场景。实验表明,MaskSQL优于现有基于SLM的文本转SQL模型,性能接近最先进的基于LLM的模型,同时保障隐私。

原文摘要 · Abstract (English)

Large language models (LLMs) have shown promising performance on tasks that require reasoning, such as text-to-SQL, code generation, and debugging. However, regulatory frameworks with strict privacy requirements constrain their integration into sensitive systems. State-of-the-art LLMs are also proprietary, costly, and resource-intensive, making local deployment impractical. Consequently, utilizing such LLMs often requires sharing data with third-party providers, raising privacy concerns and risking noncompliance with regulations. Although fine-tuned small language models (SLMs) can outperform LLMs on certain tasks and be deployed locally to mitigate privacy concerns, they underperform on more complex tasks such as text-to-SQL translation. In this work, we introduce MaskSQL, a text-to-SQL framework that utilizes abstraction as a privacy protection mechanism to mask sensitive information in LLM prompts. Unlike redaction, which removes content entirely, or generalization, which broadens tokens, abstraction retains essential information while discarding unnecessary details, striking an effective privacy-utility balance for the text-to-SQL task. Moreover, by providing mechanisms to control the privacy-utility tradeoff, MaskSQL facilitates adoption across a broader range of use cases. Our experimental results show that MaskSQL outperforms leading SLM-based text-to-SQL models and achieves performance approaching state-of-the-art LLM-based models, while preserving privacy.

文本转SQL隐私保护大模型应用

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