mlsanityData to 7 Oct 2026

Why Are My Prompts Leaked? Unraveling Prompt Extraction Threats in Customized Large Language Models

arXiv 2408.02416 ↗First posted 5 Aug 2024cs.CL cs.CRcited by 8

Not on the map. Why?

Abstract (arXiv)

The drastic increase of large language models' (LLMs) parameters has led to a new research direction of fine-tuning-free downstream customization by prompts, i.e., task descriptions. While these prompt-based services (e.g. OpenAI's GPTs) play an important role in many businesses, there has emerged growing concerns about the prompt leakage, which undermines the intellectual properties of these services and causes downstream attacks. In this paper, we analyze the underlying mechanism of prompt leakage, which we refer to as prompt memorization, and develop corresponding defending strategies. By exploring the scaling laws in prompt extraction, we analyze key attributes that influence prompt extraction, including model sizes, prompt lengths, as well as the types of prompts. Then we propose two hypotheses that explain how LLMs expose their prompts. The first is attributed to the perplexity, i.e. the familiarity of LLMs to texts, whereas the second is based on the straightforward token translation path in attention matrices. To defend against such threats, we investigate whether alignments can undermine the extraction of prompts. We find that current LLMs, even those with safety alignments like GPT-4, are highly vulnerable to prompt extraction attacks, even under the most straightforward user attacks. Therefore, we put forward several defense strategies with the inspiration of our findings, which achieve 83.8% and 71.0% drop in the prompt extraction rate for Llama2-7B and GPT-3.5, respectively. Source code is avaliable at https://github.com/liangzid/PromptExtractionEval.

Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). Builds on 35 of its 55 references that are in the map. First posted on arXiv 5 Aug 2024.

Builds on

35 of 55 references.

References · 35

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2023GPT-4 Technical Reportcited by 18,132
  4. 2022Training language models to follow instructions with human feedbackcited by 15,712
  5. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  6. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  7. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  8. 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
  9. 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
  10. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
  11. 2023Qwen Technical Reportcited by 3,273
  12. 2023Mistral 7Bcited by 3,065
23 more
  1. 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
  2. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
  3. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
  4. 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
  5. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
  6. 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,326
  7. 2018Neural Network Acceptability Judgmentscited by 952
  8. 2022Discovering Language Model Behaviors with Model-Written Evaluationscited by 805
  9. 2023Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formattingcited by 778
  10. 2022A Survey on In-context Learningcited by 717
  11. 2021GPT Understands, Toocited by 715
  12. 2021P-Tuning v2: Prompt Tuning Can Be Comparable to Fine-tuning Universally Across Scales and Taskscited by 686
  13. 2023Instruction Tuning with GPT-4cited by 676
  14. 2023Textbooks Are All You Need II: phi-1.5 technical reportcited by 559
  15. 2022Improving alignment of dialogue agents via targeted human judgementscited by 527
  16. 2023DeepInception: Hypnotize Large Language Model to Be Jailbreakercited by 337
  17. 2023Exploiting Programmatic Behavior of LLMs: Dual-Use Through Standard Security Attackscited by 268
  18. 2023SafetyBench: Evaluating the Safety of Large Language Modelscited by 189
  19. 2023QA-LoRA: Quantization-Aware Low-Rank Adaptation of Large Language Modelscited by 154
  20. 2023Effective Prompt Extraction from Language Modelscited by 83
  21. 2019Natural Language Understanding with the Quora Question Pairs Datasetcited by 51
  22. 2023Assessing Prompt Injection Risks in 200+ Custom GPTscited by 49
  23. 2024Prompt Stealing Attacks Against Large Language Modelscited by 39

Built on by

Cited by year

Citing papers per year: 2024: 3; 2025: 5.

8 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Breaking to Build: A Threat Model of Prompt-Based Attacks for Securing LLMs
  2. 2024Undesirable Memorization in Large Language Models: A Survey
  3. 2026An Empirical Evaluation of Prompt Injection Vulnerabilities in Large Language Models Across Multilingual and Obfuscated Attack Scenarios
  4. 2023Unleashing the potential of prompt engineering for large language models
  5. 2025System Prompt Poisoning: Persistent Attacks on Large Language Models Beyond User Injection
  6. 2024Prompt-SAW: Leveraging Relation-Aware Graphs for Textual Prompt Compression
  7. 2026Beyond Prompt Engineering: A Systematic Analysis of Prompt Lexical Sensitivity and Its Impacts on Quality
  8. 2024Does Prompt Formatting Have Any Impact on LLM Performance?