NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Inverse Prompt Engineering for Task-Specific LLM Safety

Stewart Slocum, Dylan Hadfield-MenellOpenReview 2025 · Submission to ICLR 2025 · Rejected

Abstract

Most real-world deployments of large language models (LLMs) operate within well-scoped tasks, yet current safety measures are general-purpose and fail to leverage this information. As a result, even in narrowly-scoped tasks, LLM applications remain vulnerable to adversarial jailbreaks. In these settings, we argue that task-specific safety guardrails solve a more tractable problem than general-purpose methods. We introduce Inverse Prompt Engineering (IPE) as an initial approach to building automatic, task-specific safety guardrails around LLMs. Our key insight is that robust safety guardrails can be derived from prompt engineering data that is already on hand. IPE operationalizes the principle of least privilege from computer security, restricting LLM functionality to only what is necessary for the task. We evaluate our approach in two settings. First, in an example chatbot application, where IPE outperforms existing methods against both human-written and automated adversarial attacks. Second, on TensorTrust, a crowdsourced dataset of prompt-based attacks and defenses. Here, IPE improves average defense robustness by 93\%, using real-world prompt engineering data.
BibTeX
@misc{slocum2025inverse,
  author = {Stewart Slocum and Dylan Hadfield-Menell},
  title = {{Inverse Prompt Engineering for Task-Specific LLM Safety}},
  year = {2025},
  url = {https://openreview.net/forum?id=3MDmM0rMPQ},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2025},
}

Loading related content...

Figure