Code Large Language Models (Code LLMs) have revolutionized software development but raised critical concerns regarding code provenance, copyright protection, and security. Existing code watermarking approaches suffer from two fundamental limitations: black-box methods either exhibit detectable syntactic patterns vulnerable to statistical analysis or rely on implicit neural embedding behaviors that weaken interpretability, auditability, and precise control, while white-box methods lack code-aware capabilities that may compromise functionality. Moreover, current single-layer watermarking schemes fail to address increasingly complex provenance requirements such as multi-level attribution and version tracking. We present MATRIX, a novel code watermarking framework that formulates watermark encoding as solving constrained parity-check matrix equations. MATRIX employs dual-channel watermarking through variable naming and semantic-preserving transformations, enhancing watermark coverage across a wider range of code while ensuring mutual backup for robustness. By integrating BCH error-correction codes with solution space diversity, our approach achieves robustness against statistical analysis. Extensive evaluation on Python code generated by multiple Code LLMs demonstrates that MATRIX achieves an average watermark detection accuracy of 99.20% with minimal functionality loss (0-0.14%), improves robustness by 7.70-26.67% against various attacks, and increases watermarking applicability by 2-6x compared with existing methods. These results establish MATRIX as an effective solution for complex code provenance scenarios while balancing among detectability, fidelity, and robustness.


翻译:[translated abstract in Chinese] 代码大语言模型(Code LLMs)彻底改变了软件开发,但也引发了关于代码溯源、版权保护和安全性等关键问题。现有代码水印方法存在两个根本性局限:黑盒方法要么表现出易受统计分析的可检测句法模式,要么依赖削弱可解释性、可审计性和精确控制的隐式神经嵌入行为;而白盒方法则缺乏代码感知能力,可能损害功能完整性。此外,当前单层水印方案难以应对日益复杂的溯源需求(如多级归属验证和版本追踪)。本文提出MATRIX——一种新型代码水印框架,将水印编码形式化为求解约束奇偶校验矩阵方程。MATRIX通过变量命名和语义保持变换实现双通道水印,在更大范围的代码中增强水印覆盖率,同时通过互备机制保障鲁棒性。通过将BCH纠错码与解空间多样性相结合,本方法实现了对统计分析的抗干扰能力。在多个Code LLM生成的Python代码上的广泛评估表明,MATRIX实现了99.20%的平均水印检测精度,功能损失极小(0-0.14%),针对各类攻击的鲁棒性提升7.70-26.67%,水印适用性较现有方法提升2-6倍。这些结果证明了MATRIX在兼顾可检测性、保真度和鲁棒性的同时,为复杂代码溯源场景提供了有效解决方案。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
稀疏自编码器综述:解释大语言模型的内部机制
专知会员服务
17+阅读 · 2025年12月27日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
智能合约的形式化验证方法研究综述
专知
16+阅读 · 2021年5月8日
超全总结:神经网络加速之量化模型 | 附带代码
【干货】深入理解自编码器(附代码实现)
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
8+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关VIP内容
稀疏自编码器综述:解释大语言模型的内部机制
专知会员服务
17+阅读 · 2025年12月27日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员