Code datasets are of immense value for training neural-network-based code completion models, where companies or organizations have made substantial investments to establish and process these datasets. Unluckily, these datasets, either built for proprietary or public usage, face the high risk of unauthorized exploits, resulting from data leakages, license violations, etc. Even worse, the ``black-box'' nature of neural models sets a high barrier for externals to audit their training datasets, which further connives these unauthorized usages. Currently, watermarking methods have been proposed to prohibit inappropriate usage of image and natural language datasets. However, due to domain specificity, they are not directly applicable to code datasets, leaving the copyright protection of this emerging and important field of code data still exposed to threats. To fill this gap, we propose a method, named CodeMark, to embed user-defined imperceptible watermarks into code datasets to trace their usage in training neural code completion models. CodeMark is based on adaptive semantic-preserving transformations, which preserve the exact functionality of the code data and keep the changes covert against rule-breakers. We implement CodeMark in a toolkit and conduct an extensive evaluation of code completion models. CodeMark is validated to fulfill all desired properties of practical watermarks, including harmlessness to model accuracy, verifiability, robustness, and imperceptibility.
翻译:[translated abstract in Chinese]
代码数据集对于训练基于神经网络的代码补全模型具有巨大价值,企业或组织已投入大量资金构建和处理这些数据集。不幸的是,无论是专有用途还是公开用途的数据集,都面临着数据泄露、许可证违规等导致的未授权利用的高风险。更严重的是,神经模型的"黑箱"特性为外部人员审计其训练数据集设置了高门槛,进一步纵容了这些未授权使用。目前,水印方法已被提出用于禁止图像和自然语言数据集的不当使用。然而,由于领域特异性,这些方法无法直接应用于代码数据集,使得代码数据这一新兴且重要领域的版权保护仍面临威胁。为填补这一空白,我们提出名为CodeMark的方法,通过将用户定义的隐形水印嵌入代码数据集,以追踪其在神经代码补全模型训练中的使用情况。CodeMark基于自适应语义保留变换,既能保留代码数据的确切功能,又能对违规者隐藏变换行为。我们将CodeMark实现为一个工具包,并对代码补全模型进行了广泛评估。实验验证表明,CodeMark满足实用水印的所有期望特性,包括对模型准确率无害、可验证性、鲁棒性和不可感知性。