PromptCARE: Prompt Copyright Protection by Watermark Injection and Verification

Hongwei Yao, Jian Lou, Kui Ren, Zhan Qin · DOI

Abstract

Prompt engineering has emerged as a critical component of the Large Language Model (LLM) ecosystem, yet high-quality prompts are vulnerable to unauthorized redistribution. We present PromptCARE, the first framework designed to protect prompt copyright through watermark injection and verification. By employing a bi-level optimization strategy, PromptCARE embeds a hidden signature into prompts that is activated only by specific secret keys. Our evaluation across multiple benchmarks and models, including the LLaMA family, demonstrates that PromptCARE is effective, robust against removal attacks, and maintains high task utility.

As Large Language Models (LLMs) become central to modern AI applications, "Prompt Engineering"—the specialized task of crafting token sequences to optimize model performance—has become a valuable commercial asset. This value has fostered the growth of Prompt-as-a-Service (PraaS) and dedicated prompt marketplaces. However, these assets are easily stolen and repurposed by unauthorized service providers.

The Prompt-as-a-Service (PraaS) ecosystem and the risk of prompt theft.

Protecting prompts presents unique challenges compared to traditional model or dataset watermarking. First, prompts often have low entropy due to their short length, making it difficult to embed information without degrading performance. Second, many tasks involve output constraints (e.g., binary sentiment classification), providing minimal bandwidth for complex watermark signatures. PromptCARE addresses these hurdles by ensuring protection is effective, harmless to the primary task, robust to attacks, and stealthy to the end-user.

Methodology: The PromptCARE Framework

PromptCARE operates through a two-phase process: watermark injection during the prompt development stage and verification when theft is suspected.

The PromptCARE framework: Watermark injection via bi-level optimization and verification through hypothesis testing.

Watermark Injection

The injection phase is formulated as a bi-level optimization problem. The lower-level objective ensures the prompt maintains high accuracy on its intended downstream task. Simultaneously, the upper-level objective optimizes a set of "trigger tokens" (the secret key). When these triggers are appended to a user query, they compel the LLM to produce specific, pre-selected "signal tokens" that serve as the watermark signature. To maintain stealth, signal tokens are chosen to be task-relevant but statistically infrequent, appearing as natural model behavior rather than anomalies.

Watermark Verification

Verification involves querying a suspected service with the secret triggers. The defender then applies a two-sample t-test to compare the output distribution of the suspect service against a baseline. A high p-value for the suspected copy versus a low p-value for independent prompts provides statistical proof of ownership. To counter adversaries who might filter suspicious inputs, a Synonym Trigger Swap strategy is used, replacing original query words with synonyms that function as triggers while preserving semantic consistency.

Experimental Evaluation

The framework was rigorously tested on six NLP benchmarks, including sentiment analysis (SST2, IMDb), topic classification (AG_News), and logical reasoning (QQP, QNLI, MNLI). Evaluations spanned various architectures, from BERT and RoBERTa to the LLaMA family (3b, 7b, and 13b).

Key Results

  • High Fidelity: Watermarked prompts typically experienced an accuracy drop of less than 5%. For continuous prompts (e.g., P-Tuning v2), the impact was negligible.
  • Strong Detection: The system consistently achieved p-values near 1.0 for unauthorized copies, while independent prompts yielded p-values as low as $10^{-9}$, creating a definitive boundary for verification.
  • Resilience: Watermarks remained detectable even after removal attempts involving synonym replacement or extensive fine-tuning (up to 2,500 iterations).
  • Efficiency: Reliable verification was achieved with as few as 128 queries, ensuring a cost-effective defense for prompt developers.

Discussion and Limitations

While PromptCARE is highly effective, it shows some sensitivity in discrete prompt scenarios (e.g., AutoPrompt), where accuracy can drop by up to 10% due to the limited capacity of discrete tokens to encode both task and watermark logic. Future research will investigate the transferability of continuous prompt watermarks across different model architectures and utilize interpretability techniques to map how watermarks are embedded within prompt representations.

Summary updated

BibTeX
@inproceedings{yao2024promptcare,
  author = {Hongwei Yao and Jian Lou and Kui Ren and Zhan Qin},
  title = {{PromptCARE: Prompt Copyright Protection by Watermark Injection and Verification}},
  booktitle = {SP},
  year = {2024},
  doi = {10.1109/sp54263.2024.00209},
}
Figure