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日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
反制无人机:乌克兰提供的五点启示
专知会员服务
4+阅读 · 9月23日
《各指挥层级均亟需红队能力》报告
专知会员服务
6+阅读 · 9月23日
《航电任务系统框架(FAMOS)》50页报告
专知会员服务
4+阅读 · 9月22日
《对抗行动中的人工智能与自主性》智库报告
专知会员服务
7+阅读 · 9月22日
《从数据到胜利:战争中的分析优势之争》
专知会员服务
10+阅读 · 9月22日
战争不仅需要机器人:人类仍不可或缺
专知会员服务
5+阅读 · 9月21日
《描绘美国防部创新基础设施的未来蓝图》100页
专知会员服务
10+阅读 · 9月21日
相关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日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员