Retrieval of Soft Prompt Enhances Zero-Shot Task Generalization

Seonghyeon Ye, Joel Jang, Doyoung Kim, Yongrae Jo, Minjoon Seo

Abstract

During zero-shot inference with language models (LMs), using hard prompts alone may not be able to fully describe the target task. In this paper, we explore how the retrieval of soft prompts obtained through prompt tuning can assist hard prompts in zero-shot task generalization. Specifically, we train soft prompt embeddings for each prompt through prompt tuning, store the samples of the training instances (hard prompt + input instances) mapped with the prompt embeddings, and retrieve the corresponding prompt embedding of the training instance closest to the query instance during inference. Results show this simple approach enhances the performance of T0 on unseen tasks by outperforming it on 10 out of 11 datasets as well as improving the mean accuracy of T0 on BIG-bench benchmark by 2.39% points while adding only 0.007% additional parameters. Also, using interpolation of multiple embeddings and variance-based ranking further improve accuracy and robustness to different evaluation prompts, widening the performance gap. Finally, we find that retrieving source embeddings trained on similar answer choice formats is more important than those on similar task types.

Introduction

Large Language Models (LLMs) have demonstrated remarkable zero-shot capabilities, allowing them to follow instructions for tasks they were not explicitly trained on. However, improving zero-shot performance typically necessitates massive scaling of model parameters or training data—both of which are computationally prohibitive. This paper introduces ROSPR (Retrieval of Soft Prompt), a lightweight method designed for efficient task generalization. By "reminding" a frozen model of similar tasks it has previously encountered through retrieved soft prompts, ROSPR significantly boosts performance without the need for full-model fine-tuning.

Methodology

The ROSPR framework operates in three distinct phases, as illustrated in the pipeline below:

  1. Source Prompt Library Construction: Using prompt tuning, the authors learn "soft prompts"—continuous vector embeddings that serve as prefixes to the input. These are trained for 230 prompts across various source tasks. Training instances are stored as "keys" and their corresponding soft prompts as "values."
  2. Dense Retrieval: At inference, a small dense retriever (T0-small encoder) identifies training instances in the library most similar to the query using Maximum Inner Product Search (MIPS).
  3. Soft Prompt Injection: The retrieved soft prompt is prepended to the frozen backbone model (T0-3B).

Advanced variants include ROSPR+INTER, which interpolates multiple retrieved prompts based on frequency, and ROSPR+VAR, which uses variance-based ranking to select prompts that maximize model confidence for specific answer choices.

The ROSPR framework: from source prompt training to inference with interpolation and variance-based ranking.

Experimental Setup

The source library was constructed using 230 prompts from 29 datasets in the T0 training mixture. Evaluation was conducted on 11 held-out datasets covering Natural Language Inference (RTE, CB, ANLI), Sentence Completion (COPA, Hellaswag, StoryCloze), Coreference Resolution (Winogrande, WSC), and Word Sense Disambiguation (WiC). Additionally, 14 tasks from the BIG-bench benchmark were used for broader validation.

Results and Discussion

ROSPR demonstrates exceptional efficiency and effectiveness. With only a 0.007% increase in parameters (approximately 204K per prompt), T0+ROSPR outperformed the base T0-3B model on 10 out of 11 evaluation datasets.

A key finding is that the answer choice format is a more critical retrieval signal than the task type. For instance, a target task requiring "Yes/No" answers benefits more from retrieving soft prompts of other "Yes/No" tasks, even if the underlying tasks are semantically different.

On the BIG-bench benchmark, ROSPR improved mean accuracy by 2.39 percentage points, effectively halving the performance gap between the 3B and 11B parameter versions of T0. In specific instances like RTE and CB, the enhanced 3B model even surpassed the performance of GPT-3 (175B), a model 60 times its size.

Mean accuracy vs. model parameters, highlighting how ROSPR allows a 3B model to approach the performance of much larger architectures.

Conclusion

ROSPR provides a highly parameter-efficient pathway to enhancing zero-shot generalization. By leveraging a library of learned soft prompts, it offers a stable and expressive signal that outperforms traditional hard prompts. Future work will explore the application of this method to decoder-only architectures and open-ended generation tasks.

Summary updated

Abstract

During zero-shot inference with language models (LMs), using hard prompts alone may not be able to fully describe the target task. In this paper, we explore how the retrieval of soft prompts obtained through prompt tuning can assist hard prompts in zero-shot task generalization. Specifically, we train soft prompt embeddings for each prompt through prompt tuning, store the samples of the training instances (hard prompt + input instances) mapped with the prompt embeddings, and retrieve the corresponding prompt embedding of the training instance closest to the query instance during inference. Results show this simple approach enhances the performance of T0 on unseen tasks by outperforming it on 10 out of 11 datasets as well as improving the mean accuracy of T0 on BIG-bench benchmark by 2.39% points while adding only 0.007% additional parameters. Also, using interpolation of multiple embeddings and variance-based ranking further improve accuracy and robustness to different evaluation prompts, widening the performance gap. Finally, we find that retrieving source embeddings trained on similar answer choice formats is more important than those on similar task types. Model checkpoints and code implementation are available at https://github.com/seonghyeonye/RoSPr.
BibTeX
@inproceedings{ye2023retrieval,
  author = {Seonghyeon Ye and Joel Jang and Doyoung Kim and Yongrae Jo and Minjoon Seo},
  title = {{Retrieval of Soft Prompt Enhances Zero-Shot Task Generalization}},
  booktitle = {ME-FoMo @ ICLR},
  year = {2023},
  url = {https://openreview.net/forum?id=UFtd8aGZCP},
}
Figure