Large language models (LLMs) have presented outstanding performance in code generation and completion. However, fine-tuning these models on private datasets can raise privacy and proprietary concerns, such as the leakage of sensitive personal information. Differentially private (DP) code generation provides theoretical guarantees for protecting sensitive code by generating synthetic datasets that preserve statistical properties while reducing privacy leakage concerns. However, DP code generation faces significant challenges due to the strict syntactic dependencies and the privacy-utility trade-off. We propose PrivCode, the first DP synthesizer specifically designed for code datasets. It incorporates a two-stage framework to improve both privacy and utility. In the first stage, termed "privacy-sanitizing", PrivCode generates DP-compliant synthetic code by training models using DP-SGD while introducing syntactic information to preserve code structure. The second stage, termed "utility-boosting", fine-tunes a larger pre-trained LLM on the synthetic privacy-free code to mitigate the utility loss caused by DP, enhancing the utility of the generated code. Extensive experiments on four LLMs show that PrivCode generates higher-utility code across various testing tasks under four benchmarks. The experiments also confirm its ability to protect sensitive data under varying privacy budgets. We provide the replication package at the anonymous link.


翻译:大型语言模型(LLMs)在代码生成与补全任务中展现出卓越性能。然而,在私有数据集上对这些模型进行微调可能引发隐私与所有权问题,例如敏感个人信息的泄露。差分隐私(DP)代码生成为保护敏感代码提供了理论保障,其通过生成在保留统计特性的同时降低隐私泄露风险的合成数据集来实现。然而,由于严格的语法依赖性与隐私-效用的权衡,DP代码生成面临显著挑战。我们提出PrivCode,这是首个专为代码数据集设计的差分隐私合成器。它采用两阶段框架以同时提升隐私性与效用性。在第一阶段(称为“隐私净化”),PrivCode通过使用DP-SGD训练模型并引入语法信息以保持代码结构,从而生成符合差分隐私要求的合成代码。第二阶段(称为“效用增强”)则在合成且无隐私风险的代码上对更大的预训练LLM进行微调,以缓解差分隐私带来的效用损失,从而提升生成代码的实用性。在四个LLM上进行的广泛实验表明,PrivCode在四种基准测试下的各类任务中均能生成更高实用性的代码。实验也证实了其在不同的隐私预算下保护敏感数据的能力。我们已在匿名链接中提供了复现资源包。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【新书】大规模语言模型的隐私与安全,
专知会员服务
29+阅读 · 2024年12月4日
大语言模型中的提示隐私保护
专知会员服务
24+阅读 · 2024年7月24日
【斯坦福博士论文】有效的差分隐私深度学习,153页pdf
专知会员服务
19+阅读 · 2024年7月10日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
专知会员服务
41+阅读 · 2020年12月1日
赛尔笔记 | 条件变分自编码器(CVAE)
AINLP
28+阅读 · 2019年11月8日
变分自编码器VAE:一步到位的聚类方案
PaperWeekly
25+阅读 · 2018年9月18日
差分隐私保护:从入门到脱坑
FreeBuf
17+阅读 · 2018年9月10日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
【干货】一文读懂什么是变分自编码器
专知
12+阅读 · 2018年2月11日
综述——隐私保护集合交集计算技术研究
计算机研究与发展
22+阅读 · 2017年10月24日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
VIP会员
相关VIP内容
【新书】大规模语言模型的隐私与安全,
专知会员服务
29+阅读 · 2024年12月4日
大语言模型中的提示隐私保护
专知会员服务
24+阅读 · 2024年7月24日
【斯坦福博士论文】有效的差分隐私深度学习,153页pdf
专知会员服务
19+阅读 · 2024年7月10日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
专知会员服务
41+阅读 · 2020年12月1日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员