DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design
- URL: http://arxiv.org/abs/2604.10611v2
- Date: Mon, 20 Apr 2026 06:32:47 GMT
- Title: DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design
- Abstract summary: We propose DuCodeMark, a stealthy and robust dual-purpose watermarking method for code datasets.<n>DuCodeMark parses each code sample into an abstract syntax tree (AST), applies language-specific style transformations to construct stealthy trigger-target pairs.<n>We conduct a comprehensive evaluation of DuCodeMark across 72 settings spanning two code tasks, two programming languages, three CodeLMs, and six decoding temperatures.
- Score: 18.636650706356008
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- 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 $\leq$ 0.36), robustness against both watermark and poisoning attacks (recall $\leq$ 0.57), and a substantial drop in model performance upon watermark removal (Pass@1 drops by 28.6%), underscoring its practicality and resilience.
Related papers
- DenMark: Robust Semantic Watermarking for Diffusion Language Models [56.836684262732994]
DenMark is a semantic watermarking framework for diffusion language models (DLMs)<n>It injects key-dependent signals directly into the DLM denoising process.<n>It partitions the output into fixed token regions and uses temporary rollouts as semantic lookahead.<n>For detection, DenMark uses calibrated scanning over candidate unit sizes to remain robust to boundary shifts introduced by semantic attacks.
arXiv Detail & Related papers (2026-09-13T03:37:48Z) - PuzzleMark: Implicit Jigsaw Learning for Robust Code Dataset Watermarking in Neural Code Completion Models [19.242274533804842]
We propose PuzzleMark, a robust watermarking method for code datasets.<n>We show that PuzzleMark exhibits strong imperceptibility, with an average suspicious rate $leq$ 0.24 and an average recall $leq$ 30.41%, respectively.
arXiv Detail & Related papers (2026-04-30T10:10:11Z) - MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding [11.231440860032388]
Existing code watermarking approaches suffer from two fundamental limitations.<n>We present MATRIX, a novel code watermarking framework that formulates watermark encoding as solving constrained parity-check matrix equations.
arXiv Detail & Related papers (2026-04-17T12:25:41Z) - CODE ACROSTIC: Robust Watermarking for Code Generation [49.125981508877565]
Existing methods for watermarking large language models (LLMs) fail to address comment removal attack.<n>Our approach involves leveraging prior knowledge to distinguish between low-entropy and high-entropy parts of the code.<n>We then inject the watermark guided by this Cue List, achieving higher detectability and usability than existing methods.
arXiv Detail & Related papers (2025-12-14T19:14:54Z) - Large Language Models Are Effective Code Watermarkers [23.085224961348015]
Watermarking has emerged as a promising solution for source attribution.<n>CodeMark-LLM embeds watermark into source code without compromising its semantics or readability.
arXiv Detail & Related papers (2025-10-13T10:40:24Z) - DMark: Order-Agnostic Watermarking for Diffusion Large Language Models [46.07844536066178]
Diffusion large language models (dLLMs) offer faster generation than autoregressive models while maintaining comparable quality.<n>We present DMark, the first watermarking framework designed specifically for dLLMs.
arXiv Detail & Related papers (2025-10-03T11:14:16Z) - TAG-WM: Tamper-Aware Generative Image Watermarking via Diffusion Inversion Sensitivity [76.98973481600002]
This paper proposes a Tamper-Aware Generative image WaterMarking method named TAG-WM.<n>The proposed method comprises four key modules: a dual-mark joint sampling (DMJS) algorithm for embedding copyright and localization watermarks into the latent space while preserving generative quality.<n>The experimental results demonstrate that TAG-WM achieves state-of-the-art performance in both tampering robustness and localization capability even under distortion.
arXiv Detail & Related papers (2025-06-30T03:14:07Z) - Towards Generalized and Stealthy Watermarking for Generative Code Models [35.78974773421725]
Experimental results demonstrate that CodeGuard achieves up to 100% watermark verification rates in both code summarization and code generation tasks.<n>In terms of stealthiness, CodeGuard performs exceptionally, with a maximum detection rate of only 0.078 against ONION detection methods.
arXiv Detail & Related papers (2025-06-26T01:14:35Z) - Beyond Dataset Watermarking: Model-Level Copyright Protection for Code Summarization Models [37.817691840557984]
CSMs face risks of exploitation by unauthorized users.<n>Traditional watermarking methods require separate design of triggers and watermark features.<n>We propose ModMark, a novel model-level digital watermark embedding method.
arXiv Detail & Related papers (2024-10-18T00:48:00Z) - WaterBench: Towards Holistic Evaluation of Watermarks for Large Language Models [48.19623266082828]
WaterBench is the first comprehensive benchmark for watermarks in large language models (LLMs)
We introduce WaterBench, the first comprehensive benchmark for LLM watermarks, in which we design three crucial factors.
We evaluate $4$ open-source watermarks on $2$ LLMs under $2$ watermarking strengths and observe the common struggles for current methods on maintaining the generation quality.
arXiv Detail & Related papers (2023-11-13T08:09:01Z) - ClearMark: Intuitive and Robust Model Watermarking via Transposed Model
Training [50.77001916246691]
This paper introduces ClearMark, the first DNN watermarking method designed for intuitive human assessment.
ClearMark embeds visible watermarks, enabling human decision-making without rigid value thresholds.
It shows an 8,544-bit watermark capacity comparable to the strongest existing work.
arXiv Detail & Related papers (2023-10-25T08:16:55Z) - Who Wrote this Code? Watermarking for Code Generation [53.24895162874416]
We propose Selective WatErmarking via Entropy Thresholding (SWEET) to detect machine-generated text.
Our experiments show that SWEET significantly improves code quality preservation while outperforming all baselines.
arXiv Detail & Related papers (2023-05-24T11:49:52Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.