Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discovery
By Yuxin Wen, Neel Jain, John Kirchenbauer, Micah Goldblum, Jonas Geiping, Tom Goldstein. Neural Information Processing Systems, 2023
425 citations recorded by the source corpus.
The strength of modern generative models lies in their ability to be controlled through text-based prompts. Typical"hard"prompts are made from interpretable words and tokens, and must be hand-crafted by humans. There are also"soft"prompts, which consist of continuous feature vectors. These can be discovered using powerful optimization methods, but they cannot be easily interpreted, re-used across models, or plugged into a text-based interface. We describe an approach to robustly optimize hard text prompts through efficient gradient-based optimization. Our approach automatically generates hard text-based prompts for both text-to-image and text-to-text applications. In the text-to-image setting, the method creates hard prompts for diffusion models, allowing API users to easily generate, discover, and mix and match image concepts without prior knowledge on how to prompt the model. In the text-to-text setting, we show that hard prompts can be automatically discovered that are effective in tuning LMs for classification.
Subfields: Artificial Intelligence, Molecular Biology
View Paper: https://www.semanticscholar.org/paper/0c26bfc15a7caecce0ed4567dc2f2909b80e5bdd
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Denny Zhou
- Quoc V. Le
- Xinyun Chen
- Hanxiao Liu
- Luke S. Zettlemoyer
- Danqi Chen
- Mohit Bansal
- Percy Liang
In Molecular Biology
Citations in the corpus
- Large Language Models as Optimizers (2023, background): “…(Lester et al., 2021; Li & Liang, 2021; Liu et al., 2021; Qin & Eisner, 2021), as well as performing discrete prompt optimization by gradient-guided search (Shin et al., 2020; Wen et al., 2023; Gao et al., 2020; Chen et al., 2023d) and reinforcement learning (Deng et al., 2022; Zhang et al., 2023).”
- Baseline Defenses for Adversarial Attacks Against Aligned Language Models (2023, background): “In this work, we study defenses against an emerging category of adversarial attacks on LLMs.”
- Universal and Transferable Adversarial Attacks on Aligned Language Models (2023, neutral): “The Prompts Made Easy (PEZ) algorithm [Wen et al., 2023], for instance, uses a quantized optimization approach to adjust a continuous embedding via gradients taken at projected points, then additionally projects the final solution back into the hard prompt space.”
- GLAZE: Protecting Artists from Style Mimicry by Text-to-Image Models (2023, methodology): “The first attack [51] leverages a newer style mimicry method [94], reverse engineering with PEZ.”
- Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation (2023, background): “Further work demonstrates it is possible to automatically discover such inputs, known as adversarial prompts (Wen et al., 2023; Jones et al., 2023; Carlini et al., 2023; Zou et al., 2023; Shen et al., 2023).”
- Many-shot Jailbreaking (2024, neutral): “We used the same refusal classification methodology we used in our experiments in Section 3.1.”