Although boosting software development performance, large language model (LLM)-powered code generation introduces intellectual property and data security risks rooted in the fact that a service provider (cloud) observes a client's prompts and generated code, which can be proprietary in commercial systems. To mitigate this problem, we propose NOIR, the first framework to protect the client's prompts and generated code from the cloud. NOIR uses an encoder and a decoder at the client to encode and send the prompts' embeddings to the cloud to get enriched embeddings from the LLM, which are then decoded to generate the code locally at the client. Since the cloud can use the embeddings to infer the prompt and the generated code, NOIR introduces a new mechanism to achieve indistinguishability, a local differential privacy protection at the token embedding level, in the vocabulary used in the prompts and code, and a data-independent and randomized tokenizer on the client side. These components effectively defend against reconstruction and frequency analysis attacks by an honest-but-curious cloud. Extensive analysis and results using open-source LLMs show that NOIR significantly outperforms existing baselines on benchmarks, including the Evalplus (MBPP and HumanEval, Pass@1 of 76.7 and 77.4), and BigCodeBench (Pass@1 of 38.7, only a 1.77% drop from the original LLM) under strong privacy against attacks.


翻译:尽管大语言模型(LLM)驱动的代码生成显著提升了软件开发效率,但其引入了知识产权与数据安全风险,根源在于服务提供商(云端)能够观测到用户的提示词及生成的代码,而这些内容在商业系统中可能具有专有性。为缓解此问题,我们提出了NOIR——首个能够保护用户提示词与生成代码免受云端窥探的框架。NOIR在客户端部署编码器与解码器:编码器将提示词转换为嵌入向量并发送至云端,云端LLM对嵌入进行增强后返回客户端,再由本地解码器生成代码。鉴于云端可能通过嵌入向量推断提示词及生成代码内容,NOIR创新性地实现了嵌入层面的不可区分性保护机制,具体包括:在提示词与代码词汇表中实施词元嵌入级的本地差分隐私保护,以及在客户端采用数据无关的随机化分词器。这些组件能有效防御诚实但好奇的云端发起的重构攻击与频率分析攻击。基于开源LLM的广泛分析与实验结果表明,在强隐私攻击防护下,NOIR在多项基准测试中显著优于现有基线,包括Evalplus(MBPP与HumanEval的Pass@1分别达到76.7%与77.4%)以及BigCodeBench(Pass@1为38.7%,仅比原始LLM性能下降1.77%)。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
综述:面向移动端大语言模型的隐私与安全
专知会员服务
19+阅读 · 2025年9月7日
【新书】大规模语言模型的隐私与安全,
专知会员服务
29+阅读 · 2024年12月4日
大型语言模型代理的安全与隐私综述
专知会员服务
29+阅读 · 2024年8月5日
大语言模型中的提示隐私保护
专知会员服务
24+阅读 · 2024年7月24日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
Deformable Kernels,用于图像/视频去噪,即将开源
极市平台
13+阅读 · 2019年8月29日
NLG ≠ 机器写作 | 专家专栏
量子位
13+阅读 · 2018年9月10日
语义分割+视频分割开源代码集合
极市平台
35+阅读 · 2018年3月5日
资源 | 清华大学开源OpenKE:知识表示学习平台
机器之心
10+阅读 · 2017年11月4日
YesOfCourse团队在Kaggle文本匹配竞赛中获得优异成绩
中国科学院网络数据重点实验室
10+阅读 · 2017年6月15日
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
Deformable Kernels,用于图像/视频去噪,即将开源
极市平台
13+阅读 · 2019年8月29日
NLG ≠ 机器写作 | 专家专栏
量子位
13+阅读 · 2018年9月10日
语义分割+视频分割开源代码集合
极市平台
35+阅读 · 2018年3月5日
资源 | 清华大学开源OpenKE:知识表示学习平台
机器之心
10+阅读 · 2017年11月4日
YesOfCourse团队在Kaggle文本匹配竞赛中获得优异成绩
中国科学院网络数据重点实验室
10+阅读 · 2017年6月15日
相关基金
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员