Table of Contents
Fetching ...

Beyond Dataset Watermarking: Model-Level Copyright Protection for Code Summarization Models

Jiale Zhang, Haoxuan Li, Di Wu, Xiaobing Sun, Qinghua Lu, Guodong Long

TL;DR

The paper tackles copyright protection for Code Summarization Models by addressing the shortcomings of dataset-based watermarking methods. It introduces ModMark, a model-level watermarking approach that embeds watermarks via tokenizer fine-tuning with identifier obfuscation and noise injection, enabling cross-language generalization. Empirical results show ModMark achieves a 100% watermark verification rate across six programming languages with minimal impact on code summarization quality, outperforming CodeMark and CoProtector in several metrics. The work demonstrates a practical, stealthy, and generalizable defense against model theft and misuse in multilingual code understanding tasks.

Abstract

Code Summarization Model (CSM) has been widely used in code production, such as online and web programming for PHP and Javascript. CSMs are essential tools in code production, enhancing software development efficiency and driving innovation in automated code analysis. However, CSMs face risks of exploitation by unauthorized users, particularly in an online environment where CSMs can be easily shared and disseminated. To address these risks, digital watermarks offer a promising solution by embedding imperceptible signatures within the models to assert copyright ownership and track unauthorized usage. Traditional watermarking for CSM copyright protection faces two main challenges: 1) dataset watermarking methods require separate design of triggers and watermark features based on the characteristics of different programming languages, which not only increases the computation complexity but also leads to a lack of generalization, 2) existing watermarks based on code style transformation are easily identifiable by automated detection, demonstrating poor concealment. To tackle these issues, we propose ModMark , a novel model-level digital watermark embedding method. Specifically, by fine-tuning the tokenizer, ModMark achieves cross-language generalization while reducing the complexity of watermark design. Moreover, we employ code noise injection techniques to effectively prevent trigger detection. Experimental results show that our method can achieve 100% watermark verification rate across various programming languages' CSMs, and the concealment and effectiveness of ModMark can also be guaranteed.

Beyond Dataset Watermarking: Model-Level Copyright Protection for Code Summarization Models

TL;DR

The paper tackles copyright protection for Code Summarization Models by addressing the shortcomings of dataset-based watermarking methods. It introduces ModMark, a model-level watermarking approach that embeds watermarks via tokenizer fine-tuning with identifier obfuscation and noise injection, enabling cross-language generalization. Empirical results show ModMark achieves a 100% watermark verification rate across six programming languages with minimal impact on code summarization quality, outperforming CodeMark and CoProtector in several metrics. The work demonstrates a practical, stealthy, and generalizable defense against model theft and misuse in multilingual code understanding tasks.

Abstract

Code Summarization Model (CSM) has been widely used in code production, such as online and web programming for PHP and Javascript. CSMs are essential tools in code production, enhancing software development efficiency and driving innovation in automated code analysis. However, CSMs face risks of exploitation by unauthorized users, particularly in an online environment where CSMs can be easily shared and disseminated. To address these risks, digital watermarks offer a promising solution by embedding imperceptible signatures within the models to assert copyright ownership and track unauthorized usage. Traditional watermarking for CSM copyright protection faces two main challenges: 1) dataset watermarking methods require separate design of triggers and watermark features based on the characteristics of different programming languages, which not only increases the computation complexity but also leads to a lack of generalization, 2) existing watermarks based on code style transformation are easily identifiable by automated detection, demonstrating poor concealment. To tackle these issues, we propose ModMark , a novel model-level digital watermark embedding method. Specifically, by fine-tuning the tokenizer, ModMark achieves cross-language generalization while reducing the complexity of watermark design. Moreover, we employ code noise injection techniques to effectively prevent trigger detection. Experimental results show that our method can achieve 100% watermark verification rate across various programming languages' CSMs, and the concealment and effectiveness of ModMark can also be guaranteed.

Paper Structure

This paper contains 24 sections, 8 equations, 5 figures, 7 tables, 1 algorithm.

Figures (5)

  • Figure 1: Example of CSMs input and output, where (a) is the input code snippet, and (b) is the generated summary result.
  • Figure 2: The ModMark method consists of three steps: First, identifier obfuscation—randomly select a code snippet, convert it into an Abstract Syntax Tree ($AST$), and iteratively replace identifiers with a placeholder character ($unk$) to generate multiple code variants. Second, impact analysis—input the original code and its variants into the model, calculate the confidence score for each variant, and identify the identifier in the lowest-scoring variant as the key point. Third, token substitution—starting from the key points identified in the second step, randomly select 1500 pieces of data from the corresponding language dataset, extract identifiers, perform tokenization, calculate token frequencies, select low-frequency tokens for noise addition operations to generate trigger tokens. Finally, input the trigger tokens into the tokenizer to obtain the required merging rules, and fine-tune the tokenizer to embed the watermark.
  • Figure 3: Some examples demonstrate the necessity of conducting Identifier Obfuscation and Impact Analysis.
  • Figure 4: Diagram of Model Watermark Verification Method.
  • Figure 5: Two-Round Clustering Results of CoProtector, CodeMark, and Our Method.