The proliferation of open-source code and large language models (LLMs) for code generation has amplified the risks of unauthorized reuse and intellectual property infringement. Source code watermarking offers a potential solution, yet existing methods typically encode watermarks through identifiers, local code patterns, or limited handcrafted edits, leaving them vulnerable to renaming, refactoring, and adaptive watermark removal. These limitations hinder the joint achievement of robustness, capacity, generalization, and deployment efficiency. We propose CLASP, a Code LLM-Assisted Semantic-Preserving watermarking framework that enables training-free, plug-and-play watermarking for source code. CLASP embeds watermark bits within a fixed space of semantics-preserving transformations, enabling automated watermark insertion with higher capacity while remaining reusable across programming languages and less dependent on brittle lexical features. To recover the watermark, CLASP uses reference-code retrieval and differential comparison to identify transformation traces, avoiding task-specific model training while improving robustness to structural edits and adaptive attacks. Experiments across multiple programming languages show that CLASP consistently outperforms existing baselines in watermark extraction accuracy and robustness, while maintaining code quality under both random removal and adaptive de-watermarking attacks.


翻译:随着开源代码的激增以及用于代码生成的大语言模型的普及,未经授权的重用与知识产权侵权的风险显著增加。源代码水印提供了一种潜在的解决方案,然而现有方法通常通过标识符、局部代码模式或有限的手工编辑来嵌入水印,这使得它们易受重命名、重构以及自适应水印移除攻击的影响。这些局限性阻碍了在鲁棒性、容量、泛化能力和部署效率方面同时取得进展。我们提出CLASP,一种代码大语言模型辅助的语义保持水印框架,能够为源代码实现无训练、即插即用的水印嵌入。CLASP将水印比特嵌入到一个固定的语义保持变换空间中,从而能够以更高的容量自动插入水印,同时在不同的编程语言间可复用,且较少依赖脆弱的词法特征。为了提取水印,CLASP采用参考代码检索与差异比较来识别变换痕迹,避免了训练专用模型的同时,提升了对结构编辑和自适应攻击的鲁棒性。跨多种编程语言的实验表明,在随机移除和自适应去水印攻击下,CLASP在水印提取准确率和鲁棒性方面均持续优于现有基线方法,同时保持了代码质量。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
面向 AI 生成图像的安全与鲁棒水印:全面综述
专知会员服务
14+阅读 · 2025年10月6日
扩散模型时代的可视水印:进展与挑战
专知会员服务
7+阅读 · 2025年5月17日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
自动编程:大型语言模型及其他
专知会员服务
36+阅读 · 2024年5月12日
大模型时代下的文本水印综述
专知会员服务
35+阅读 · 2024年1月26日
专知会员服务
28+阅读 · 2021年7月16日
自然语言处理中的语言模型预训练方法
PaperWeekly
14+阅读 · 2018年10月21日
手把手教TensorFlow(附代码)
深度学习世界
15+阅读 · 2017年10月17日
NLP中自动生产文摘(auto text summarization)
机器学习研究会
14+阅读 · 2017年10月10日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
4+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
4+阅读 · 6月22日
美国从乌克兰无人机战争中学习经验
专知会员服务
7+阅读 · 6月21日
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
5+阅读 · 6月21日
相关VIP内容
面向 AI 生成图像的安全与鲁棒水印:全面综述
专知会员服务
14+阅读 · 2025年10月6日
扩散模型时代的可视水印:进展与挑战
专知会员服务
7+阅读 · 2025年5月17日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
自动编程:大型语言模型及其他
专知会员服务
36+阅读 · 2024年5月12日
大模型时代下的文本水印综述
专知会员服务
35+阅读 · 2024年1月26日
专知会员服务
28+阅读 · 2021年7月16日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员