Towards Generalized and Stealthy Watermarking for Generative Code Models
On the map: LLM safety and security → Watermarking generated content and models
Abstract (arXiv)
Generative code models (GCMs) significantly enhance development efficiency through automated code generation and code summarization. However, building and training these models require computational resources and time, necessitating effective digital copyright protection to prevent unauthorized leaks and misuse. Backdoor watermarking, by embedding hidden identifiers, simplifies copyright verification by breaking the model's black-box nature. Current backdoor watermarking techniques face two main challenges: first, limited generalization across different tasks and datasets, causing fluctuating verification rates; second, insufficient stealthiness, as watermarks are easily detected and removed by automated methods. To address these issues, we propose CodeGuard, a novel watermarking method combining attention mechanisms with distributed trigger embedding strategies. Specifically, CodeGuard employs attention mechanisms to identify watermark embedding positions, ensuring verifiability. Moreover, by using homomorphic character replacement, it avoids manual detection, while distributed trigger embedding reduces the likelihood of automated detection. Experimental results demonstrate that CodeGuard achieves up to 100% watermark verification rates in both code summarization and code generation tasks, with no impact on the primary task performance. In terms of stealthiness, CodeGuard performs exceptionally, with a maximum detection rate of only 0.078 against ONION detection methods, significantly lower than baseline methods.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Watermarking generated content and models, one of 12 directions in LLM safety and security. Builds on 32 of its 44 references that are in the map. First posted on arXiv 26 Jun 2025.
Builds on
32 of 44 references.
Closest ancestors · 2
Same direction, newest first
- 2024Beyond Dataset Watermarking: Model-Level Copyright Protection for Code Summarization Models18 Oct
- 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Models28 Aug
Other references · 30
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2016Practical Black-Box Attacks against Machine Learningcited by 903
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2018Spectral Signatures in Backdoor Attackscited by 484
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2020Invisible Backdoor Attack with Sample-Specific Triggerscited by 353
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
18 more
- 2020ONION: A Simple and Effective Defense Against Textual Backdoor Attackscited by 263
- 2023Self-collaboration Code Generation via ChatGPTcited by 258
- 2020Blind Backdoors in Deep Learning Modelscited by 182
- 2020A Transformer-based Approach for Source Code Summarizationcited by 133
- 2020You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completioncited by 131
- 2020Data-Free Model Extractioncited by 124
- 2022BppAttack: Stealthy and Efficient Trojan Attacks against Deep Neural Networks via Image Quantization and Contrastive Adversarial Learningcited by 86
- 2022Untargeted Backdoor Watermark: Towards Harmless and Stealthy Dataset Copyright Protectioncited by 86
- 2022Black-box Dataset Ownership Verification via Backdoor Watermarkingcited by 65
- 2020Big Code != Big Vocabulary: Open-Vocabulary Models for Source Codecited by 54
- 2023Stealthy Backdoor Attack for Code Modelscited by 49
- 2021On the Evaluation of Neural Code Summarizationcited by 48
- 2021CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoningcited by 47
- 2021In-IDE Code Generation from Natural Language: Promise and Challengescited by 42
- 2020Code to Comment "Translation": Data, Metrics, Baselining & Evaluationcited by 29
- 2020Neural Network Laundering: Removing Black-Box Backdoor Watermarks from Deep Neural Networkscited by 27
- 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 18
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 8
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025CLASP: Training-Free LLM-Assisted Source Code Watermarking via Semantic-Preserving Transformations
- 2026DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design ↗
- 2025DeCoMa: Detecting and Purifying Code Dataset Watermarks through Dual Channel Code Abstraction
- 2026PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking ↗
- 2023Towards Tracing Code Provenance with Code Watermarking
- 2026Preserving Structure, Strengthening Signals: A Grammar-Driven Approach to Optimize the Trade-off Between Quality and Detectability in Code Watermarking
- 2025Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice
- 2025Optimizing Token Choice for Code Watermarking: An RL Approach