Has My System Prompt Been Used? Large Language Model Prompt Membership Inference
Roman Levin, Valeriia Cherepanova, Abhimanyu Hans, Avi Schwarzschild, Tom Goldstein
TL;DR
Prompt Detective provides a training-free statistical framework for verified prompt membership inference by comparing output distributions from a target LLM to a reference model prompted with a known system prompt. Using a permutation test on $p$-values derived from cosine similarities of $n$-fold BERT embeddings of $k$ responses per task, the method detects differences between prompts across diverse models, including hard prompts and black-box settings. The results show that even minor system-prompt changes yield distinguishable response trajectories, enabling statistically significant prompt usage verification with practical budgets. This work offers a concrete tool for protecting proprietary prompts and informs design considerations for prompt privacy in real-world LLM deployments.
Abstract
Prompt engineering has emerged as a powerful technique for optimizing large language models (LLMs) for specific applications, enabling faster prototyping and improved performance, and giving rise to the interest of the community in protecting proprietary system prompts. In this work, we explore a novel perspective on prompt privacy through the lens of membership inference. We develop Prompt Detective, a statistical method to reliably determine whether a given system prompt was used by a third-party language model. Our approach relies on a statistical test comparing the distributions of two groups of model outputs corresponding to different system prompts. Through extensive experiments with a variety of language models, we demonstrate the effectiveness of Prompt Detective for prompt membership inference. Our work reveals that even minor changes in system prompts manifest in distinct response distributions, enabling us to verify prompt usage with statistical significance.
