PromptMark: 一种提示引导的迭代反馈框架用于源代码水印
PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking
AI总结:
提出PromptMark,一种黑盒提示引导的水印框架,通过结构化输入指令在AI生成代码中嵌入可检测信号,并利用迭代反馈优化嵌入,在保持代码正确性的同时实现强水印可检测性。
摘要:
水印已成为确保AI生成源代码来源和可追溯性的关键技术。随着大型语言模型(LLM)越来越多地集成到开发工作流程中,可靠的归属仍然具有挑战性。在实践中,大多数开发者依赖在黑盒约束下运行的商业LLM API,这使得需要访问解码过程的现有方法在现实集成中不太可行。为解决这一限制,我们提出PromptMark,一种黑盒、提示引导的水印框架,通过结构化输入指令在生成的代码中嵌入不可见但统计可检测的信号。该方法引导模型采用微妙的标识符和注释命名模式,同时保持生成代码的功能正确性和结构完整性。检测使用统计测试进行,这些测试设计为在不同代码长度和模型输出下保持可靠。通过迭代反馈循环进一步优化嵌入,其中基于水印检测分数更新提示。在MBPP和HumanEval基准上的实验表明,PromptMark在保持高代码正确性的同时,始终实现强水印可检测性,优于基线方法。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。