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.
翻译:现代生成模型的优势在于其能够通过基于文本的提示进行控制。典型的"硬"提示由可解释的单词和标记构成,需要人工精心设计。此外还存在"软"提示,由连续特征向量组成,可通过强大的优化方法发现,但这些提示难以被解释、跨模型复用,或集成到基于文本的交互界面中。我们提出了一种通过高效梯度优化方法鲁棒优化硬文本提示的技术方案。该方法能够自动为文本到图像和文本到文本应用生成硬文本提示。在文本到图像场景中,该方法可为扩散模型创建硬提示,使API用户无需预先了解如何对模型进行提示,即可轻松生成、发现和组合图像概念。在文本到文本场景中,我们证明硬提示可被自动发现,并能有效对语言模型进行分类任务调优。