DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design
Open Access
- 30 June 2026
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 3 (FSE) , 1059-1081
Abstract
The proliferation of large language models for code (CodeLMs) and open-source contributions has heightened concerns over unauthorized use of source code datasets. While watermarking provides a viable protection mechanism by embedding ownership signals, existing methods rely on detectable trigger-target patterns and are limited to source-code tasks, overlooking other scenarios such as decompilation tasks. In this paper, we propose DuCodeMark, a stealthy and robust dual-purpose watermarking method for code datasets that generalizes across both source-code tasks and decompilation tasks. DuCodeMark parses each code sample into an abstract syntax tree (AST), applies language-specific style transformations to construct stealthy trigger-target pairs, and injects repressible poisoned features into a subset of return-typed samples to enhance robustness against watermark removal or evasion. These features remain inactive during normal training but are activated upon watermark removal, degrading model performance. For verification, DuCodeMark employs a black-box method based on the independent-samples t -test. We conduct a comprehensive evaluation of DuCodeMark across 72 settings spanning two code tasks, two programming languages, three CodeLMs, and six decoding temperatures. The results demonstrate that it consistently achieves strong verifiability ( p < 0.05), high stealthiness (suspicion rate ≤ 0.36), robustness against both watermark and poisoning attacks (recall ≤ 0.57), and a substantial drop in model performance upon watermark removal (Pass@1 drops by 28.6Keywords
Funding Information
- National Natural Science Foundation of China (U24A20337)
- National Natural Science Foundation of China (62372228)
This publication has 31 references indexed in Scilit:
- Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalness2025
- Esale: Enhancing Code-Summary Alignment Learning for Source Code SummarizationIEEE Transactions on Software Engineering, 2024
- Stealthy Backdoor Attack for Code ModelsIEEE Transactions on Software Engineering, 2024
- ANGHABENCH: A Suite with One Million Compilable C Benchmarks for Code-Size Reduction2021
- Multi-modal Attention Network Learning for Semantic Source Code Retrieval2019
- Pythia: AI-assisted Code Completion System2019
- A Survey of Machine Learning for Big Code and NaturalnessACM Computing Surveys, 2018
- Public git archive2018
- Identifying and Filtering Near-Duplicate Documents2000
- THE GENERALIZATION OF ‘STUDENT'S’ PROBLEM WHEN SEVERAL DIFFERENT POPULATION VARLANCES ARE INVOLVEDBiometrika, 1947