TL;DR
This paper introduces "prompt obfuscation," a novel technique to protect the intellectual property of system prompts for Large Language Models (LLMs). By creating an obfuscated prompt that maintains functionality but is unintelligible to attackers, the authors safeguard proprietary instructions from leakage, even under sophisticated deobfuscation attempts.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly customized for specific tasks using "system prompts" – detailed instructions that guide the model's behavior. These prompts are crucial for functionality and are often considered valuable intellectual property, akin to software code. However, existing methods for extracting these system prompts, particularly through prompt injection attacks, are highly effective, leaving companies vulnerable to IP theft and the exposure of sensitive information. Current defenses are often reactive and can be bypassed. This paper addresses the critical need for a proactive and robust method to protect system prompts without sacrificing their intended functionality.
Methods
The core of the paper is the proposed "prompt obfuscation" technique, which aims to create a surrogate system prompt that preserves functionality while preventing information leakage about the original prompt. The authors explore two main approaches:
- Hard Prompt Obfuscation: This method operates directly on the tokenized text of the prompt. It involves optimizing a randomly initialized token sequence to produce similar outputs to the original prompt for a given set of user inputs. This is achieved using a modified Greedy Coordinate Gradient (GCG) algorithm.
- Soft Prompt Obfuscation: This approach works in the continuous embedding space of the LLM. It optimizes an embedding vector that, when passed through the model's embedding layer, generates outputs comparable to the original prompt. This method offers more flexibility due to the complex reverse mapping from embedding space to token space, making it harder to interpret.
Both methods involve an optimization process where the obfuscated prompt is iteratively refined to minimize the divergence in model outputs compared to the original prompt. They also explore adding a fluency regularization term to make the obfuscated prompts less readable.
Datasets
The authors utilize several publicly available datasets for their experiments, covering different tasks:
- Question Answering (QA):
- TruthfulQA: Used for preliminary experiments and the main evaluation of hard prompt obfuscation.
- TriviaQA: Used for evaluating soft prompt obfuscation.
- Summarization:
- CNN/DailyMail: Used for evaluating soft prompt obfuscation.
- Samsum: Used for evaluating soft prompt obfuscation.
These datasets were used to generate model outputs that served as the target behavior for the obfuscation process.
Key Insights and Ideas
- Soft Prompts Offer Superior Obfuscation: The paper strongly suggests that operating in the continuous embedding space (soft prompts) provides significantly better obfuscation and utility preservation compared to manipulating the discrete token space (hard prompts). This is attributed to the inherent complexity of reverse mapping from embeddings.
- Functionality Preservation is Key: The primary challenge is to obfuscate prompts without degrading their performance. The authors demonstrate that their methods can achieve comparable output similarity to the original prompts across various metrics.
- Deobfuscation is Difficult in Realistic Scenarios: While white-box attacks (where the attacker has full model knowledge) can reveal some information, the obfuscated prompts are designed to be unintelligible and not easily transferable to different models or settings. In practical black-box scenarios, prompt injection attacks are largely unsuccessful in extracting meaningful information.
- Real-World Applicability: The authors successfully demonstrate their method on a leaked custom GPT system prompt, showing its effectiveness even with complex, stylized prompts.
- Trade-offs Exist: While soft prompt obfuscation is effective, it requires access to the model's embedding layer, which might not always be feasible. Hard prompt obfuscation is more accessible but offers less robust obfuscation.
Key Results
- Utility: Across various datasets and scenarios (Full, Style, Task), the obfuscated prompts consistently achieved output similarity scores comparable to, and sometimes even better than, the original prompts, as measured by eight different metrics (lexical, character-level, and semantic).
- Confidentiality (Hard Prompt Obfuscation): In hard prompt obfuscation, while some similarity to the original prompt was observed, the addition of fluency regularization helped reduce readability. However, the authors noted that this approach had limitations in achieving both high utility and strong confidentiality simultaneously.
- Confidentiality (Soft Prompt Obfuscation): Prompt injection attacks against soft-prompts were largely unsuccessful. For the conventional system prompt, prompt injection attacks frequently leaked the full prompt. In contrast, with obfuscated prompts, no successful leaks were observed under exact-match or approximate-match criteria, indicating a significant mitigation of prompt injection risks.
- Deobfuscation Attacks:
- Token Space Projection: Reconstructed prompts from projected embeddings were largely comparable to a random baseline, showing no significant advantage in recovering meaningful text.
- Fluency Optimization: While this method could recover some partially understandable information (e.g., "pirate accent"), it did not retain the same semantic meaning and was practically impossible to use without prior knowledge of the original prompt.
- Comparison to Finetuning: Soft prompt obfuscation achieved comparable utility to finetuning (LoRA adapters) but with significantly smaller storage overhead and simpler integration.
Limitations and Future Work
- Output Dependency: The obfuscation methods require input samples to optimize and test the prompts. While this is a limitation, the authors argue it requires less data than finetuning and can be generated using the original system prompt.
- White-Box Access for Deobfuscation: The most effective deobfuscation attacks require white-box access to the model and its embeddings, which is not always realistic for attackers.
- Potential for Misuse: The authors acknowledge that prompt obfuscation could potentially be used to hide malicious intentions, emphasizing the need for responsible deployment and ethical oversight.
- Future Work: The paper suggests exploring more advanced deobfuscation techniques and investigating the trade-offs between confidentiality and functionality in greater detail. They also highlight the potential of soft prompt obfuscation for system adaptation and its reusability.
Summary updated