用密码学设计防抄袭代码水印,确保生成代码可用且难伪造
Robust and Secure Code Watermarking for Large Language Models via ML/Crypto Codesign
- 端到端训练水印模块,保持代码功能不变
- 检测准确率高,对修改攻击仍具鲁棒性
- 零知识证明验证,不泄露水印信息,适合企业级应用
本文提出RoSeMary,首个将机器学习与密码学协同设计的代码水印框架,旨在防止大语言模型生成代码侵犯知识产权或被滥用。由于代码本身熵值低,高质量水印在可检测性、保真度和鲁棒性三方面难以兼顾。传统验证需暴露签名并重新编码,影响可用性。RoSeMary通过以预训练CodeT5为插入主干,端到端训练水印嵌入与提取模块,扩大语法变换和变量重命名搜索空间,实现(i)水印代码功能不变,(ii)提升检测力与鲁棒性。部署时采用零知识证明进行安全验证,无需揭示签名。大量实验表明,RoSeMary在保持代码功能性的同时,具备高检测准确率,对攻击具有强鲁棒性,并支持高效安全验证。
原文摘要 · Abstract (English)
This paper introduces RoSeMary, the first-of-its-kind ML/Crypto codesign watermarking framework that regulates LLM-generated code to avoid intellectual property rights violations and inappropriate misuse in software development. High-quality watermarks adhering to the detectability-fidelity-robustness tri-objective are limited due to codes' low-entropy nature. Watermark verification, however, often needs to reveal the signature and requires re-encoding new ones for code reuse, which potentially compromising the system's usability. To overcome these challenges, RoSeMary obtains high-quality watermarks by training the watermark insertion and extraction modules end-to-end to ensure (i) unaltered watermarked code functionality and (ii) enhanced detectability and robustness leveraging pre-trained CodeT5 as the insertion backbone to enlarge the code syntactic and variable rename transformation search space. In the deployment, RoSeMary uses zero-knowledge proofs for secure verification without revealing the underlying signatures. Extensive evaluations demonstrated RoSeMary achieves high detection accuracy while preserving the code functionality. RoSeMary is also robust against attacks and provides efficient secure watermark verification.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。