Announcing our new Paper: The Prompt Report, with Co-authors from OpenAI & Microsoft!

Check it out →
🔓 Prompt Hacking🟢 Defensive Measures🟢 Random Sequence Enclosure

🟢 Random Sequence Enclosure

Last updated on August 7, 2024 by Sander Schulhoff

What is Random Sequence Enclosure?

Random sequence enclosure is yet another defense. This method encloses the user input between two random sequences of characters1.

An Example of Random Sequence Enclosure

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.

Conclusion

Random sequence enclosure can help disallow user attempts to input instruction overrides by helping the LLM identify a clear distinction between user input and developer prompts.

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

Word count: 0

Get AI Certified by Learn Prompting


Copyright © 2024 Learn Prompting.