🔓 破解提示
🟢 防御措施
🟢 介绍
🟢 Filtering
🟢 Instruction Defense
🟢 Post-Prompting
🟢 Random Sequence Enclosure
🟢 Sandwich Defense
🟢 XML Tagging
🟢 Separate LLM Evaluation
🟢 Other Approaches
🟢 Offensive Measures
🟢 Introduction
🟢 Obfuscation/Token Smuggling
🟢 Payload Splitting
🟢 Defined Dictionary Attack
🟢 Virtualization
🟢 Indirect Injection
🟢 Recursive Injection
🟢 Code Injection
🔨 Tooling
Prompt Engineering IDEs
🟢 Introduction
GPT-3 Playground
Dust
Soaked
Everyprompt
Prompt IDE
PromptTools
PromptSource
PromptChainer
Prompts.ai
Snorkel 🚧
Human Loop
Spellbook 🚧
Kolla Prompt 🚧
Lang Chain
OpenPrompt
OpenAI DALLE IDE
Dream Studio
Patience
Promptmetheus
PromptSandbox.io
The Forge AI
AnySolve
Conclusion
🔓 破解提示🟢 防御措施🟢 Random Sequence Enclosure

Random Sequence Enclosure

🟢 This article is rated easy
Reading Time: 1 minute
Last updated on August 7, 2024

Sander Schulhoff

Yet another defense is enclosing the user input between two random sequences of characters. Take this prompt as an example:

Translate the following user input to Spanish.

{{user_input}}

It can be improved by adding the random sequences:

Translate the following user input to Spanish (it is enclosed in random strings).

FJNKSJDNKFJOI
{{user_input}}
FJNKSJDNKFJOI
Note
Longer sequences will likely be more effective.

Footnotes

  1. Stuart Armstrong, R. G. (2022). Using GPT-Eliezer against ChatGPT Jailbreaking. https://www.alignmentforum.org/posts/pNcFYZnPdXyL2RfgA/using-gpt-eliezer-against-chatgpt-jailbreaking

Sander Schulhoff

Sander Schulhoff is the Founder of Learn Prompting and an ML Researcher at the University of Maryland. He created the first open-source Prompt Engineering guide, reaching 3M+ people and teaching them to use tools like ChatGPT. Sander also led a team behind Prompt Report, the most comprehensive study of prompting ever done, co-authored with researchers from the University of Maryland, OpenAI, Microsoft, Google, Princeton, Stanford, and other leading institutions. This 76-page survey analyzed 1,500+ academic papers and covered 200+ prompting techniques.