Source-linked AI summary

UPRISE: Universal Prompt Retrieval for Improving Zero-Shot Evaluation

Daixuan Cheng, Shaohan Huang, Junyu Bi, Yuefeng Zhan, Jianfeng Liu, Yujing Wang, Hao Sun, Furu Wei, Denvy Deng, Qi Zhang

arXiv:2303.08518v4cs.CL

TL;DR

Model-specific fine-tuning and task-specific prompt engineering can limit zero-shot generalization and impose repeated tuning costs. UPRISE learns a lightweight retriever that selects prompts for zero-shot inputs across unseen tasks and larger inference models, with reported potential to improve ChatGPT fact-checking and mitigate hallucinations.

  • Problem

    Repeated model-specific fine-tuning is costly, while task-specific prompts may not generalize to unseen task types.

    Source: §1 · p. 1
  • Method

    UPRISE tunes a lightweight retriever to retrieve natural-language prompts from a pre-constructed pool for zero-shot inputs across tasks and inference models.

    Source: §1 · pp. 1–2, §3.1 · p. 3
  • Results

    UPRISE generalizes from GPT-Neo-2.7B tuning to unseen tasks and larger LLMs, while ChatGPT experiments report mitigation of hallucinations on fact-checking tasks.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Prompt retrieval offers a universal approach that can improve zero-shot evaluation without separately tuning each inference LLM or task.

    Source: §1 · p. 2, §11 · p. 9

    UPRISE has limited or negative effects on language-modeling-formulated tasks and has been evaluated only with language prompts, not tool-use or multimodal information.

    Source: Limitations · p. 10

Abstract

from arXiv · show

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 a diverse set of 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.

1 Introduction

UPRISE addresses the cost and limited generalization of model-specific fine-tuning and task-specific prompt engineering by learning a universal prompt retriever. It targets unseen task types and different, larger inference LLMs through cross-task and cross-model retrieval.

1 Introduction

  • Fine-tuning can require repeated model-specific costs, while engineered prompts may not generalize reliably to unseen task types.These constraints motivate a universal retrieval approach for frozen LLMs.Source: §1 · p. 1
  • UPRISE automatically retrieves natural-language prompts from a pre-constructed pool for each zero-shot task input, using a lightweight retriever.The method separates prompting into retrieval followed by prediction with a frozen LLM.Source: §1 · p. 1, §2 · p. 2

2 Problem Definition

  • The retriever is tuned with GPT-Neo-2.7B and evaluated with BLOOM-7.1B, OPT-66B, and GPT3-175B, testing transfer across model scales and sources.This cross-model setting avoids tuning the retriever separately for each large inference model.Source: §1 · p. 2, §2 · p. 3

1 Introduction

  • Experiments with ChatGPT report that UPRISE can address hallucinations on fact-checking tasks by prompting correct inferences from built-in knowledge.The paper presents this as potential enhancement of even powerful LLMs.Source: §1 · p. 2

2 Problem Definition

  • Prompt retrieval uses frozen-LLM evaluations of prepended natural-language prompts to tune the retriever, unlike prompt design or soft prompt tuning.The retrieved prompts remain interpretable and flexible because they are natural-language sequences.Source: §2 · p. 2, Figure 2 · p. 2
  • UPRISE trains on multiple task types but evaluates on held-out task clusters, defining universality through cross-task retrieval.Task clusters are held out during training and used for evaluation.Source: §2 · pp. 2–3

3 Method

UPRISE constructs a prompt pool from diverse task demonstrations, scores prompts with a frozen LLM, and tunes a retriever to select useful prompts for unseen tasks and inference models.

3 Method

  • UPRISE trains a prompt retriever on diverse tasks to retrieve natural-language prompts for unseen task types during inference.The pipeline uses a frozen LLM for supervision and supports cross-task and cross-model transfer.Source: §3 · p. 3

3.1 Data Construction

  • Task examples are converted into natural-language instructions with randomly selected FLAN templates, while the prompt pool contains demonstrations from remaining training clusters.Demonstrations concatenate each task input with its label completion and may provide similar question types, topics, or reasoning chains.Source: §3.1 · p. 3

3.2 Prompt Scoring

  • For text completion, prompt scores use task metrics such as F1 or ROUGE, whereas multiple-choice scores combine accuracy with normalized gold-option likelihood for finer comparisons.The scoring procedure distinguishes free-form completion from choosing among multiple options.Source: §3.2 · p. 3
  • Prompt scoring labels the highest-scoring prompt as positive and uses different-task demonstrations plus low-scoring same-task demonstrations as negative and hard-negative examples.The method scores sampled same-task demonstrations rather than the entire pool to reduce computation, repeating sampling for difficult examples when necessary.Source: §3.2 · p. 4

3.3 Retriever Tuning

  • A bi-encoder retriever is trained with InfoNCE to increase input-prompt similarity for positive pairs and decrease it for negative pairs.The input and prompt encoders produce representations whose inner product defines similarity.Source: §3.3 · pp. 4–5

3.4 Inference

  • At inference, maximum inner-product search retrieves K similar prompts, which are concatenated before the test input and evaluated with the task’s metric.The same scoring approach used during prompt labeling generates predictions for inference evaluation.Source: Figure 3 · p. 4, §3.4 · p. 5

4 Experiment Settings

Experiments organize tasks into clusters, limit sampling to balance datasets, tune with GPT-Neo-2.7B, and evaluate retrieval across larger language models.

Task clustering

  • Tasks are grouped into nine clusters spanning reading comprehension, question answering, reasoning, classification, generation, and summarization.The clusters include Reading Comprehension, Closed-book QA, Paraphrase Detection, Natural Language Inference, Sentiment Analysis, Commonsense Reasoning, Coreference Resolution, Structure to Text, and Summarization.Source: §4 · p. 5

Data sampling

  • Sampling uses up to 10k examples per task with class balancing, producing approximately 180k training examples per testing cluster on average.The prompt pool contains only the sampled training data.Source: §4 · p. 5

LLMs

  • GPT-Neo-2.7B tunes the retriever, while BLOOM-7.1B, OPT-66B, Davinci, and text-davinci-001 evaluate it during inference.Greedy search generates predictions from all inference LLMs.Source: §4 · p. 5

Prompt scoring

  • Prompt scoring samples L = 50 demonstrations, selects B = 20 negatives, and repeats sampling up to seven rounds for difficult questions.Examples without any positive-scoring sampled prompt are filtered out.Source: §4 · p. 5

Tuning and inference

  • Each retriever is initialized with BERTBASE, fine-tuned for three epochs, and selected by validation retrieval accuracy; inference concatenates K = 3 prompts.Scores are reported on test sets when available and otherwise on validation sets.Source: §4 · p. 5

5 Main Results

UPRISE improves zero-shot performance across unseen task types and generally transfers from GPT-Neo-2.7B to larger language models, though gains vary by task and model fine-tuning.

5.1 Cross-Task Prompt Retrieval

  • UPRISE achieves absolute gains of 8.5% in Reading Comprehension and 14.6% in Paraphrase Detection on GPT-Neo-2.7B.Source: §5.1 · p. 5
  • UPRISE consistently improves Closed-book QA and Natural Language Inference across all tested tasks on GPT-Neo-2.7B.Source: §5.1 · p. 5
  • UPRISE negatively affects Commonsense Reasoning and Coreference Resolution, with analyses attributing this to demonstration format and limited demonstration benefit.Source: §5.1 · p. 5

5.2 Cross-Model Prompt Retrieval

  • UPRISE improves Reading Comprehension, Closed-book QA, and Paraphrase Detection across BLOOM, OPT, Davinci, and text-davinci-001.Source: §5.2 · pp. 5, 7
  • Natural Language Inference gains hold for non-fine-tuned models but drop on text-davinci-001, potentially because it was fine-tuned for such tasks.Source: §5.2 · p. 7
  • Figure 4 reports average performance across five task clusters and shows consistent improvements across all evaluated language models.Source: §5.2 · p. 7, Figure 4 · p. 7

6 Hallucination Mitigation of ChatGPT

The paper evaluates UPRISE as a way to reduce ChatGPT hallucinations on truthfulness and fact-checking tasks. UPRISE outperforms vanilla zero-shot prompting on fact-checking and can induce more precise answers through retrieved demonstrations.

  • The evaluation covers TruthfulQA, FEVER2.0, and Covid-19 tasks for detecting falsehoods and fact-checking.Source: §6 · p. 7
  • UPRISE outperforms vanilla zero-shot prompting on ChatGPT fact-checking tasks.Source: §6 · p. 7, Table 2 · p. 7
  • On a FEVER2.0 example, vanilla prompting produces a correct fact but an incorrect answer, whereas UPRISE induces a precise answer.Source: §6 · p. 7, Figure 5 · p. 7
  • The authors attribute the improvement to a retrieved Natural Language Inference demonstration that may encourage inference from ChatGPT’s parametric memory.Source: §6 · p. 7
  • The findings suggest effective inference mechanisms may matter alongside ChatGPT’s stored knowledge for addressing hallucination.Source: §6 · p. 7

7 Ablation Study

Ablations show that UPRISE’s learned retrieval, diverse prompt pool, and diverse training tasks each contribute to performance on unseen task types.

7.1 Universal Prompt Retriever

  • UPRISE achieves the best results among the universal retrievers compared with RANDOM, TOPK-BM25, and TOPK-BERT.Word-level or sentence-level similarity alone is not sufficient for selecting effective prompts.Source: §7.1 · pp. 7–8, Figure 6 · p. 8

7.2 Universal Prompt Pool

  • The UPRISE prompt pool outperforms raw pre-training texts on all testing clusters.The pool uses demonstrations from the remaining training task clusters.Source: §7.2 · p. 8, Table 3 · p. 8
  • Retrieved demonstrations often come from diverse question-answering tasks, and cross-task gains can reflect similar question types, topics, formats, or logical relationships.Source: §7.2 · p. 8

8 Analysis on Training Data Diversity

  • Reducing training-task diversity decreases performance, although a retriever trained on 50% of the remaining task types still beats 0-SHOT across most task types.Source: §8 · p. 8, Figure 7 · p. 8
  • The diversity analysis trains retrievers on subsets of task types and tests them on held-out types to measure cross-task generalizability.Source: §8 · pp. 8–9
  • Reading Comprehension and Closed-book QA are especially generalizable and can serve as representative training choices for a universal retriever.Source: §8 · p. 9, Figure 8 · p. 9

9 Exploration of Few-Shot Learning

UPRISE extends prompt retrieval beyond zero-shot evaluation, showing gains in few-shot settings while motivating a universal retriever for diverse tasks and models.

9 Exploration of Few-Shot Learning

  • UPRISE-REMAIN-TARGET outperforms vanilla few-shot prompting when retrieving from the target task pool.Source: §9 · p. 9
  • UPRISE-ALL-TARGET yields substantial improvements over vanilla few-shot prompting across task types.Source: §9 · p. 9

10 Related Work

  • Prompt search retrieves prompts from corpora or downstream tasks using sparse or dense retrievers, sometimes scored by the LLM itself.Source: §10 · p. 9

11 Conclusion

  • The paper defines universality as retrieving prompts for unseen tasks and various inference LLMs without further tuning.Source: §11 · p. 9

Limitations

  • UPRISE has limited impact on language-modeling tasks such as Coreference Resolution and Commonsense Reasoning.Source: Limitations · p. 10
  • The experiments verify universality only for language, leaving tool-use APIs and multimodal information for future exploration.Source: Limitations · p. 10

A Task Clustering

The paper organizes tasks into clusters, evaluates ChatGPT on hallucination-prone fact-checking tasks, and analyzes why UPRISE declines on some task types.

A Task Clustering

  • The task inventory spans Reading Comprehension, Closed-book QA, Paraphrase Detection, Natural Language Inference, Sentiment Analysis, Commonsense Reasoning, Coreference Resolution, Structure to Text, and Summarization.Source: A Task Clustering · p. 14

C Hallucination Mitigation of ChatGPT

D Analysis on Performance Decline

  • Coreference Resolution shows limited benefit from demonstrations, with few-shot prompting also underperforming zero-shot prompting in related models.Source: D Analysis on Performance Decline · p. 15, Table 6 · p. 15
  • UPRISE’s negative impact on Commonsense Reasoning may reflect a mismatch between frequently retrieved Closed-book QA formats and language-modeling formats.Closed-book QA is the most frequently retrieved type for Commonsense Reasoning.Source: D Analysis on Performance Decline · p. 15

E Extended Related Work

The paper situates UPRISE among prompt-design and prompt-tuning methods, then examines which training clusters are retrieved for held-out tasks and illustrates representative prompts.

E Extended Related Work

  • In-context learning conditions a test input on concatenated training demonstrations without gradient updates, while Chain-of-Thought demonstrations add intermediate reasoning steps.Source: E Extended Related Work · p. 15
  • Prompt tuning learns continuous prompt parameters, including variants that add learnable vectors across transformer layers.Source: E Extended Related Work · p. 15

F Analysis on Retrieved Training Clusters

  • Diverse question types in training correspond to high retrieval ratios, including 80.7% for Closed-book QA and 36.1% for NLI.Sentiment Analysis does not reach the top ranks, supporting the role of diverse training tasks in generalizability.Source: F Analysis on Retrieved Training… · p. 15, Figure 10 · p. 15

TESTING CLUSTER: TASK

TESTING CLUSTER: TASK

The testing examples cover Closed-book QA, Paraphrase Detection, Coreference Resolution, and Natural Language Inference, with prompt examples illustrating task-specific inputs and demonstrations.

TESTING CLUSTER: TASK

PROMPT CLUSTER: TASK

  • The Coreference Resolution example asks whether two mentions refer to the same entity, using a demonstration with the answer Yes.Source: PROMPT CLUSTER: TASK · p. 18

TESTING CLUSTER: TASK

  • The Natural Language Inference example asks whether a hypothesis follows from a premise using Yes, No, or Maybe.Source: TESTING CLUSTER: TASK · p. 19

PROMPT CLUSTER: TASK

The task cluster illustrates retrieved demonstrations across paraphrase detection, natural language inference, sentiment analysis, and commonsense reasoning. Cross-task retrieval aligns testing inputs with demonstrations through shared question formats, causal relations, or sentiment polarity.

PROMPT CLUSTER: TASK

  • MRPC demonstrates paraphrase detection by asking whether a second sentence remains true when the first sentence is true, with answer No.Source: PROMPT CLUSTER: TASK · p. 19

TESTING CLUSTER: TASK

  • QNLI tests whether an inflammation statement validly answers a question about what causes inflammation, with label Yes.Source: TESTING CLUSTER: TASK · p. 19

PROMPT CLUSTER: TASK

  • For natural language inference, retrieved prompts can match testing inputs through similar question formats or shared cause-and-effect reasoning.Source: Table 10 · p. 19

TESTING CLUSTER: TASK

PROMPT CLUSTER: TASK

  • COPA demonstrates commonsense reasoning by asking for the effect of denial about a tragedy, answered as refusing to discuss it.Source: PROMPT CLUSTER: TASK · p. 20

TESTING CLUSTER: TASK

PROMPT CLUSTER: TASK

  • For sentiment analysis, retrieved prompts sharing the testing input’s sentiment facilitate accurate sentiment prediction.Source: Table 11 · p. 20
Loading 2303.08518v4…