arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.12461cs.CRcs.SE
收藏

通过代码水印技术追踪代码来源

Towards Tracing Code Provenance with Code Watermarking

Wei Li, Borui Yang, Yujie Sun, Suyu Chen, Ziyun Song, Liyao Xiang, Xinbing Wang, Chenghu Zhou

AI总结:

针对大语言模型生成代码的来源追踪问题,提出CodeMark水印系统,通过图神经网络和预训练模型在变量中嵌入比特串,保持代码自然与操作语义,在准确性、容量和效率上优于现有方法。

摘要:

大型语言模型的最新进展引发了广泛担忧,因为它们能生成大量未经审查的看似合理的源代码,因此追踪代码来源成为一个关键问题。为解决该问题,我们提出CodeMark,这是一个水印系统,它将比特串隐藏到变量中,同时尊重代码的自然语义和操作语义。为了保持自然性,我们创新性地引入上下文水印方案,在图神经网络之上生成在上下文中更连贯的水印变量。每个变量被视为图上的一个节点,节点特征通过学习收集邻域(上下文)信息。嵌入到特征中的水印因此不仅通过变量,也通过局部上下文反映出来。我们进一步引入源代码上的预训练模型作为教师,指导更自然的变量生成。在整个嵌入过程中,由于仅更改变量名,操作语义得以保留。除了保证代码特定属性外,由于生成了更多样化的模式,CodeMark在水印准确性、容量和效率方面表现优越。实验结果表明,CodeMark优于SOTA水印系统,在水印要求之间取得了更好的平衡。

英文摘要:

Recent advances in large language models have raised wide concern in generating abundant plausible source code without scrutiny, and thus tracing the provenance of code emerges as a critical issue. To solve the issue, we propose CodeMark, a watermarking system that hides bit strings into variables respecting the natural and operational semantics of the code. For naturalness, we novelly introduce a contextual watermarking scheme to generate watermarked variables more coherent in the context atop graph neural networks. Each variable is treated as a node on the graph and the node feature gathers neighborhood (context) information through learning. Watermarks embedded into the features are thus reflected not only by the variables but also by the local contexts. We further introduce a pre-trained model on source code as a teacher to guide more natural variable generation. Throughout the embedding, the operational semantics are preserved as only variable names are altered. Beyond guaranteeing code-specific properties, CodeMark is superior in watermarking accuracy, capacity, and efficiency due to a more diversified pattern generated. Experimental results show CodeMark outperforms the SOTA watermarking systems with a better balance of the watermarking requirements.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑