PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking
- URL: http://arxiv.org/abs/2606.20835v1
- Date: Thu, 18 Jun 2026 18:21:38 GMT
- Title: PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking
- Abstract summary: We propose PromptMark, a black-box, prompt-guided watermarking framework.<n>It embeds invisible yet statistically detectable signals into generated code via structured input instructions.<n>Experiments show that PromptMark consistently achieves strong watermark detectability while maintaining high code correctness.
- Score: 0.5798758080057375
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Watermarking has become a crucial technique for ensuring provenance and accountability in AI-generated source code. As large language models (LLMs) are increasingly integrated into development workflows, reliable attribution remains challenging. In practice, most developers rely on commercial LLM APIs operating under black-box constraints, making existing approaches that require access to the decoding process less feasible for real-world integration. To address this limitation, we propose PromptMark, a black-box, prompt-guided watermarking framework that embeds invisible yet statistically detectable signals into generated code via structured input instructions. The method steers models toward subtle identifier and comment naming patterns while preserving the functional correctness and structural integrity of the generated code. Detection is performed using statistical tests designed to remain reliable across varying code lengths and model outputs. The embedding is further refined through an iterative feedback loop, where prompts are updated based on watermark detection scores. Experiments on the MBPP and HumanEval benchmarks show that PromptMark consistently achieves strong watermark detectability while maintaining high code correctness, outperforming baseline approaches.
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) - Efficient Online LLM Watermark Detection via Rao-Blackwellized E-Processes [3.2639022787260266]
We develop an efficient online watermark detection framework with anytime-valid inference based on Rao-Blackwellized e-processes.<n> Simulations and experiments on real-generated text demonstrate efficient online detection with rigorous anytime-valid guarantees.
arXiv Detail & Related papers (2026-07-24T04:10:36Z) - Toward Stronger Code Watermarking: A Grammar-Driven Approach to Optimizing the Trade-off Between Quality and Detectability [43.59505715248063]
We propose a novel code watermarking approach called Grammar-Driven Watermark (GDW) for Large Language Models (LLMs)<n>GDW preserves syntactic validity through a grammar-guided three-level masking mechanism and injects watermark signals via structural role-aware modulation.<n>We show that GDW establishes a stronger quality-detectability trade-off frontier than existing methods, while maintaining robustness against variable-renaming attacks.
arXiv Detail & Related papers (2026-07-11T08:43:15Z) - StableGuard: Towards Unified Copyright Protection and Tamper Localization in Latent Diffusion Models [55.05404953041403]
We propose a novel framework that seamlessly integrates a binary watermark into the diffusion generation process.<n>We show that StableGuard consistently outperforms state-of-the-art methods in image fidelity, watermark verification, and tampering localization.
arXiv Detail & Related papers (2025-09-22T16:35:19Z) - Optimizing Token Choice for Code Watermarking: An RL Approach [41.184827829989494]
We introduce CodeTracer, an adaptive code watermarking framework underpinned by a novel reinforcement learning paradigm.<n>CodeTracer features a policy-driven approach that utilizes a parameterized model to intelligently bias token choices during next-token prediction.<n>To facilitate policy learning, we devise a comprehensive reward system that seamlessly integrates execution feedback with watermark embedding signals.
arXiv Detail & Related papers (2025-08-16T06:11:29Z) - Entropy-Guided Watermarking for LLMs: A Test-Time Framework for Robust and Traceable Text Generation [58.85645136534301]
Existing watermarking schemes for sampled text often face trade-offs between maintaining text quality and ensuring robust detection against various attacks.<n>We propose a novel watermarking scheme that improves both detectability and text quality by introducing a cumulative watermark entropy threshold.
arXiv Detail & Related papers (2025-04-16T14:16:38Z) - MarkLLM: An Open-Source Toolkit for LLM Watermarking [80.00466284110269]
MarkLLM is an open-source toolkit for implementing LLM watermarking algorithms.
For evaluation, MarkLLM offers a comprehensive suite of 12 tools spanning three perspectives, along with two types of automated evaluation pipelines.
arXiv Detail & Related papers (2024-05-16T12:40:01Z) - Token-Specific Watermarking with Enhanced Detectability and Semantic Coherence for Large Language Models [31.062753031312006]
Large language models generate high-quality responses with potential misinformation.
Watermarking is pivotal in this context, which involves embedding hidden markers in texts.
We introduce a novel multi-objective optimization (MOO) approach for watermarking.
Our method simultaneously achieves detectability and semantic integrity.
arXiv Detail & Related papers (2024-02-28T05:43:22Z) - An Unforgeable Publicly Verifiable Watermark for Large Language Models [84.2805275589553]
Current watermark detection algorithms require the secret key used in the watermark generation process, making them susceptible to security breaches and counterfeiting during public detection.
We propose an unforgeable publicly verifiable watermark algorithm named UPV that uses two different neural networks for watermark generation and detection, instead of using the same key at both stages.
arXiv Detail & Related papers (2023-07-30T13:43:27Z) - 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.