Skip to main content
QUICK REVIEW

[论文解读] Effective Prompt Extraction from Language Models

Yiming Zhang, Carlini, Nicholas|arXiv (Cornell University)|Jul 13, 2023
Information and Cyber SecurityComputer Science被引用 9
一句话总结

本文系统评估了提示词通过提示服务在跨多种LLM的API交互中被提取的难易程度,提出一个基于DeBERTa的置信度估计器来验证成功提取,并测试可以被绕过的简单文本防御。

ABSTRACT

The text generated by large language models is commonly controlled by prompting, where a prompt prepended to a user's query guides the model's output. The prompts used by companies to guide their models are often treated as secrets, to be hidden from the user making the query. They have even been treated as commodities to be bought and sold on marketplaces. However, anecdotal reports have shown adversarial users employing prompt extraction attacks to recover these prompts. In this paper, we present a framework for systematically measuring the effectiveness of these attacks. In experiments with 3 different sources of prompts and 11 underlying large language models, we find that simple text-based attacks can in fact reveal prompts with high probability. Our framework determines with high precision whether an extracted prompt is the actual secret prompt, rather than a model hallucination. Prompt extraction from real systems such as Claude 3 and ChatGPT further suggest that system prompts can be revealed by an adversary despite existing defenses in place.

研究动机与目标

  • Motivate and formalize the risk that prompts embedded in LLM-based services are not secrets but can be extracted.
  • Develop a systematic attack framework and quantitative metric to assess prompt extraction success.
  • Evaluate prompt extraction across multiple datasets and models to establish generality of the vulnerability.
  • Propose a verification mechanism to estimate the likelihood that an extracted prompt matches the ground truth.

提出的方法

  • Define a threat model where a service f_p takes a secret prompt p and a user query q to generate a response.
  • Assemble attack queries a_1,...,a_k designed to elicit the prompt from model outputs.
  • Measure extraction success using BLEU(p, f_p(a_i)) with a threshold of 0.6.
  • Train a DeBERTa-based classifier to estimate the probability that an extraction matches the groundtruth, conditioned on other extractions, yielding P_DeBERTa(e_i).
  • Compare extraction success across ShareGPT and Awesome prompts with GPT-3.5, GPT-4, and Vicuna-13B.
  • Explore a text-based 5-gram defense and demonstrate its circumvention by modified attacks.
Figure 1: A single prompt extraction attack query on a Spanish translation service. The attacker chooses an attack query $a$ and sends it to the service $f_{p}$ . Upon observing the extractions, the attacker uses a classifier-based heuristic to guess whether an extraction is successful.
Figure 1: A single prompt extraction attack query on a Spanish translation service. The attacker chooses an attack query $a$ and sends it to the service $f_{p}$ . Upon observing the extractions, the attacker uses a classifier-based heuristic to guess whether an extraction is successful.

实验结果

研究问题

  • RQ1Can prompts used by prompt-based services be reliably extracted from model outputs across multiple LLMs?
  • RQ2How effective are simple attack queries at exposing secret prompts, and does model choice influence success rate?
  • RQ3How can one verify that an extracted prompt truly matches the ground truth, given limited access to ground truth in real deployments?
  • RQ4Are simple defenses (like 5-gram filtering) sufficient to block prompt extraction attacks, or can attackers circumvent them?

主要发现

  • Prompt extraction attacks reveal prompts with high probability across models and datasets (e.g., averages above 60% extractability).
  • GPT-3.5 shows the highest extractability (89% average across two heldout datasets), with GPT-4 slightly lower (81.9% average).
  • Vicuna-13B is harder to extract but still yields substantial leakage (62.5% and 83.6% on ShareGPT and Awesome, respectively).
  • A DeBERTa-based confidence estimator achieves high precision in verifying extracted prompts (precision > 75%), enabling reliable confirmation of successful extractions.
  • A simple 5-gram defense drastically reduces unmodified attacks but can be circumvented by attackers using modified attack strategies.
Figure 2: Successful extractions can be verified with high precision using the proposed heuristic $\mathrm{P}_{\text{DeBERTa}}$ , demonstrated by the precision-recall curves. Circles represent precision and recall at the decision boundary ( $\mathrm{P}_{\text{DeBERTa}}>$ 95%).
Figure 2: Successful extractions can be verified with high precision using the proposed heuristic $\mathrm{P}_{\text{DeBERTa}}$ , demonstrated by the precision-recall curves. Circles represent precision and recall at the decision boundary ( $\mathrm{P}_{\text{DeBERTa}}>$ 95%).

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。