UPRISE : Universal Prompt Retrieval for Improving Zero-Shot Evaluation (2023)

Abstract: Large Language Models (LLMs) are popular for their impressive abilities, but the need for model-specific fine-tuning or task-specific prompt engineering can hinder their generalization. We propose UPRISE (Universal Prompt Retrieval for Improving zero-Shot Evaluation), which tunes a lightweight and versatile retriever that automatically retrieves prompts for a given zero-shot task input. Specifically, we demonstrate universality in a cross-task and cross-model scenario: the retriever is tuned on diverse tasks, but tested on unseen task types; we use a small frozen LLM, GPT-Neo-2.7B, for tuning the retriever, but test the retriever on different LLMs of much larger scales, such as BLOOM-7.1B, OPT-66B and GPT3-175B. Additionally, we show that UPRISE mitigates the hallucination problem in our experiments with ChatGPT, suggesting its potential to improve even the strongest LLMs. Our model and code are available at https://github.com/microsoft/LMOps.

## introduction large language models (llms) such as @xcite , opt @xcite , and bloom @xcite have shown impressive capabilities across a wide range of tasks. recent research proposes two main approaches to further improve their performance: fine-tuning llms to follow prompts @xcite @xcite @xcite and developing prompt engineering techniques to guide the llms @xcite @xcite . fine-tuning llms adjusts their weights to fit specific prompts. however, this can be constrained by computational limitations or the unavailability of model weights @xcite . multi-task tuning provides an alternative approach to improve zeroshot task generalization @xcite , which partially justifies the tuning cost. yet, the constant evolution of llms creates the need for tuning new models, making the cumulative fine-tuning cost a big concern. prompt engineering constructs prompts to guide frozen llms. prompt design adds an engineered natural language prompt to teach the llm to learn in context @xcite or to induce the llm to reason @xcite . prompt tuning adds a soft prompt represented by continuous parameters, and optimizes it through gradient propagation @xcite @xcite . while these methods can improve performance for specific tasks, it is uncertain whether the prompts designed for one task can generalize to unseen task types, as prompt designers are blind in strict zero-shot settings (van de @xcite . in this paper, we propose uprise (universal prompt retrieval for improving zero-shot evaluation), which tunes a lightweight and versatile retriever that automatically retrieves prompts from a pre-constructed pool, given a zero-shot task input. as illustrated in figure 1 , the retriever is trained to retrieve prompts for multiple tasks, enabling it to generalize to un-seen task types during inference. in addition, we demonstrate that the cross-task capabilities can generalize well from a small llm to different llms of much larger scales: we use gpt-neo-2.7b @xcite to guide the tuning of the retriever and evaluate the retriever's performance on bloom-7.1b @xcite , opt-66b @xcite , and gpt3-175b @xcite . the cross-model and cross-task generalization of up-rise makes it a promising and practical solution for real-world applications. furthermore, our approach demonstrates the potential for enhancing even the most powerful llms, as shown in our experiments with chatgpt. despite its impressive abilities, chatgpt has been found to struggle with serious hallucination problems, leading to responses that are factually inaccurate @xcite . however, uprise is able to address this issue on fact-checking tasks by prompting the model to draw correct inferences from its built-in knowledge. in summary, our contributions include: • we introduce uprise, a lightweight and versatile approach to improve zero-shot performance of llms in the cross-task and cross-model scenario. ## problem definition we aim to improve zero-shot performance of llms by training a prompt retriever to retrieve prompts foot_0 for any given task input. specifically, uprise decomposes the prompting process into two steps: retrieve then predict. given an input x, we first retrieve a set of positive prompts p + from a preconstructed pool p: then we concatenate p + with x to form an input sequence for a frozen llm, which generates a predicted output: ## method as shown in figure 3 , uprise uses a frozen llm to supervise the fine-tuning of a prompt retriever on diverse tasks, and then uses this trained retriever to retrieve prompts for unseen task types with different llms during inference. in this section, we elaborate on our data construction, prompt scoring, retriever tuning and inference pipeline. ## experiment settings task clustering. we group the tasks used in our method into clusters, including reading comprehension, closed-book qa, paraphrase detection, natural language inference, sentiment analysis, commonsense reasoning, coreference resolution, structure to text, and summarization. the datasets used in each cluster are listed in appendix a. ## main results we evaluate our prompt retriever on natural language understanding tasks where generative llms are known to need improvement @xcite . ## hallucination mitigation of chatgpt despite the strong abilities of chatgpt, recent reports have shown that it suffers from hallucination: providing factually incorrect responses @xcite . to assess the versatility of uprise, we also investigate whether it can mitigate the hallucination problem. we evaluate on three tasks: truthfulqa @xcite for detecting human falsehood, fever2.0 @xcite and covid-19 @xcite for fact-checking. ## analysis on training data diversity impact of reducing diversity. we reduce the range of trained task types to see the impact on the testing performance: for each testing task type, we randomly select 50% of the remaining task types to train a retriever. the results in figure 7 do indicate a decline in performance as diversity decreases. nonetheless, the retriever trained on 50% remaining task types continues to demonstrate better performance than 0-shot across most task types. ## exploration of few-shot learning we compare uprise with vanilla few-shot prompting and apply uprise to few-shot prompt retrieval in ## conclusion this paper explores training a lightweight and versatile prompt retriever to improve the zero-shot performance of llms. we investigate the retriever's ability to generalize from the trained task types to unseen task types, and from a small llm to different llms of much larger scales. we hope our paper will spur further research on developing a universal assistant for the ever-expanding landscape of tasks and large language models.