Learning How to Ask: Querying LMs with Mixtures of Soft Prompts

Guanghui Qin, Jason Eisner
4/14/2021
617 citations
cs.CLcs.LG

Official code: hiaoxui/soft-prompts (89 stars, Python, Apache-2.0, last commit 2022-09-07).

Abstract

Natural-language prompts have recently been used to coax pretrained language models into performing other AI tasks, using a fill-in-the-blank paradigm (Petroni et al., 2019) or a few-shot extrapolation paradigm (Brown et al., 2020). For example, language models retain factual knowledge from their training corpora that can be extracted by asking them to "fill in the blank" in a sentential prompt.

Show full abstract

However, where does this prompt come from? We explore the idea of learning prompts by gradient descent -- either fine-tuning prompts taken from previous work, or starting from random initialization. Our prompts consist of "soft words," i.e., continuous vectors that are not necessarily word type embeddings from the language model. Furthermore, for each task, we optimize a mixture of prompts, learning which prompts are most effective and how to ensemble them. Across multiple English LMs and tasks, our approach hugely outperforms previous methods, showing that the implicit factual knowledge in language models was previously underestimated. Moreover, this knowledge is cheap to elicit: random initialization is nearly as good as informed initialization.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
8911PythonApr 13, 20214 years agoApache-2.0

Similar Papers

Cite this paper

@article{qin2021learning,
  title  = {Learning How to Ask: Querying LMs with Mixtures of Soft Prompts},
  author = {Guanghui Qin and Jason Eisner},
  year   = {2021},
  eprint = {2104.06599},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2104.06599}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2104.06599.svg)](https://codeofpaper.com/paper/2104.06599)

Discussion