[Paper Review] What Makes Good In-Context Examples for GPT-$3$?
The paper shows that retrieving semantically similar in-context examples (via KATE) significantly improves GPT-3 few-shot performance across sentiment analysis, table-to-text generation, and open-domain QA, with gains amplified by task-related sentence encoders.
GPT-$3$ has attracted lots of attention due to its superior performance across a wide range of NLP tasks, especially with its powerful and versatile in-context few-shot learning ability. Despite its success, we found that the empirical results of GPT-$3$ depend heavily on the choice of in-context examples. In this work, we investigate whether there are more effective strategies for judiciously selecting in-context examples (relative to random sampling) that better leverage GPT-$3$'s few-shot capabilities. Inspired by the recent success of leveraging a retrieval module to augment large-scale neural network models, we propose to retrieve examples that are semantically-similar to a test sample to formulate its corresponding prompt. Intuitively, the in-context examples selected with such a strategy may serve as more informative inputs to unleash GPT-$3$'s extensive knowledge. We evaluate the proposed approach on several natural language understanding and generation benchmarks, where the retrieval-based prompt selection approach consistently outperforms the random baseline. Moreover, it is observed that the sentence encoders fine-tuned on task-related datasets yield even more helpful retrieval results. Notably, significant gains are observed on tasks such as table-to-text generation (41.9% on the ToTTo dataset) and open-domain question answering (45.5% on the NQ dataset). We hope our investigation could help understand the behaviors of GPT-$3$ and large-scale pre-trained LMs in general and enhance their few-shot capabilities.
Motivation & Objective
- Motivate and understand the sensitivity of GPT-3 to the choice of in-context examples.
- Investigate whether retrieval-based selection of in-context examples yields better performance than random sampling.
- Evaluate how task-related sentence encoders influence the quality of retrieved examples and downstream GPT-3 predictions.
- Demonstrate the effectiveness of a non-parametric retrieval augmentation (KATE) across multiple NLP tasks.
Proposed method
- Formulate in-context learning as conditional text generation with a context C consisting of k in-context examples and their labels.
- Empirically compare random in-context sampling to retrieval-based selection using nearest neighbors in a sentence-embedding space.
- Propose KATE (K nn- Augmented in-Context d E xample selection) to retrieve k nearest neighbors of the test sample from a training set and use them as in-context exemplars in GPT-3 prompts.
- Evaluate multiple sentence encoders, including RoBERTa-based models fine-tuned on SNLI/MNLI and STS-B, as the retrieval embedding.
- Analyze the impact of the number of in-context examples, training set size for retrieval, and the order of in-context examples on performance.
Experimental results
Research questions
- RQ1Does retrieval-based selection of in-context examples improve GPT-3 few-shot performance relative to random sampling?
- RQ2How does the semantic quality of retrieved exemplars, as measured by sentence embeddings, influence GPT-3 outcomes?
- RQ3Do task-related sentence encoders and larger retrieval sets yield stronger gains across tasks like sentiment analysis, table-to-text generation, and QA?
- RQ4How do the number and order of in-context examples affect KATE’s effectiveness?
Key findings
- Retrieval-based in-context example selection consistently outperforms random sampling across multiple tasks.
- Sentence encoders fine-tuned on task-related data (e.g., NLI, STS-B, SST-2) yield stronger retrieval results and higher GPT-3 performance.
- KATE achieves substantial gains on ToTTo table-to-text generation and open-domain QA datasets, with notable improvements over baselines.
- Increasing the number of retrieved examples generally improves performance, and using task-aligned encoders further boosts gains.
- The retrieved exemplars provide GPT-3 with more detailed and relevant context, reducing hallucination and improving answer fidelity.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.