Prompt Engineering Guide
πŸ˜ƒ Basics
πŸ’Ό Applications
πŸ§™β€β™‚οΈ Intermediate
🧠 Advanced
Special Topics
🌱 New Techniques
πŸ€– Agents
βš–οΈ Reliability
πŸ–ΌοΈ Image Prompting
πŸ”“ Prompt Hacking
πŸ”¨ Tooling
πŸ’ͺ Prompt Tuning
πŸ—‚οΈ RAG
🎲 Miscellaneous
Models
πŸ“ Language Models
Resources
πŸ“™ Vocabulary Resource
πŸ“š Bibliography
πŸ“¦ Prompted Products
πŸ›Έ Additional Resources
πŸ”₯ Hot Topics
✨ Credits
πŸ”“ Prompt Hacking🟒 Defensive Measures🟒 Post-Prompting

Post-Prompting

🟒 This article is rated easy
Reading Time: 1 minute

Last updated on August 7, 2024

Takeaways
  • Post-Prompting involves placing user input before the prompt-- the LLM is less likely to ignore the last instruction it sees, making hijacking more difficult.

What is Post-Prompting?

The post-prompting defense simply puts the user input before the prompt.

A Post-Prompting Example

Take this prompt as an example:

Astronaut

Prompt


Translate the following to French: {user_input}

It can be improved with post-prompting:

Astronaut

Prompt


{user_input}

Translate the above text to French.

This can help since ignore the above instruction... doesn't work as well. Even though a user could say ignore the below instruction... instead, LLMs often will follow the last instruction they see.

Conclusion

Post-prompting, although seemingly simple, is yet another effective defense against prompt hacking methods like prompt injection. This technique takes advantage of the fact that the model is more inclined to follow the last instruction it sees.

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.

Footnotes

  1. Mark, C. (2022). Talking to machines: prompt engineering & injection. https://artifact-research.com/artificial-intelligence/talking-to-machines-prompt-engineering-injection/ ↩

Copyright Β© 2024 Learn Prompting.