Skip to main content
QUICK REVIEW

[Paper Review] Many-Shot In-Context Learning

Rishabh Agarwal, Avi Singh|arXiv (Cornell University)|Apr 17, 2024
Domain Adaptation and Few-Shot LearningComputer Science8 citations
TL;DR

The paper investigates how large language models scale with in-context examples, introducing Reinforced ICL and Unsupervised ICL to reduce reliance on human demonstrations, and showing many-shot ICL can overcome pre-training biases and tackle non-natural language tasks.

ABSTRACT

Large language models (LLMs) excel at few-shot in-context learning (ICL) -- learning from a few examples provided in context at inference, without any weight updates. Newly expanded context windows allow us to investigate ICL with hundreds or thousands of examples -- the many-shot regime. Going from few-shot to many-shot, we observe significant performance gains across a wide variety of generative and discriminative tasks. While promising, many-shot ICL can be bottlenecked by the available amount of human-generated examples. To mitigate this limitation, we explore two new settings: Reinforced and Unsupervised ICL. Reinforced ICL uses model-generated chain-of-thought rationales in place of human examples. Unsupervised ICL removes rationales from the prompt altogether, and prompts the model only with domain-specific questions. We find that both Reinforced and Unsupervised ICL can be quite effective in the many-shot regime, particularly on complex reasoning tasks. Finally, we demonstrate that, unlike few-shot learning, many-shot learning is effective at overriding pretraining biases, can learn high-dimensional functions with numerical inputs, and performs comparably to fine-tuning. We also find that inference cost increases linearly in the many-shot regime, and frontier LLMs benefit from many-shot ICL to varying degrees. Our analysis also reveals the limitations of next-token prediction loss as an indicator of downstream ICL performance.

Motivation & Objective

  • Assess how increasing the number of in-context examples (shots) affects LLM performance across diverse tasks.
  • Develop methods to reduce dependence on human-generated rationales in many-shot ICL.
  • Analyze learning dynamics of ICL, including bias overriding, non-natural language tasks, and prompt ordering effects.

Proposed method

  • Systematically scale in-context examples across tasks using Gemini 1.5 Pro with up to 8192 shots.
  • Compare few-shot and many-shot ICL across tasks such as MT, summarization, planning, and code verification.
  • Introduce Reinforced ICL by using model-generated rationales filtered by answer correctness.
  • Introduce Unsupervised ICL by prompting with problems only, without rationales.
  • Analyze ICL behavior, including bias overcoming, high-dimensional numerical tasks, and the relationship between NLL and ICL performance.
Figure 1: Many-shot vs Few-Shot In-Context Learning (ICL) across several tasks. Many-shot learning exhibits consistent performance gains over few-shot ICL. This gain is especially dramatic for difficult non-natural language tasks like sequential parity prediction and linear classification. Number of
Figure 1: Many-shot vs Few-Shot In-Context Learning (ICL) across several tasks. Many-shot learning exhibits consistent performance gains over few-shot ICL. This gain is especially dramatic for difficult non-natural language tasks like sequential parity prediction and linear classification. Number of

Experimental results

Research questions

  • RQ1How does many-shot ICL performance scale across a broad set of tasks compared to few-shot ICL?
  • RQ2Can model-generated rationales (Reinforced ICL) or problem-only prompts (Unsupervised ICL) match or exceed human demonstrations in many-shot settings?
  • RQ3Can many-shot ICL overcome pre-training biases and enable learning of non-natural language or numerical tasks?
  • RQ4What are the limitations of next-token prediction loss as a predictor of ICL success?
  • RQ5How sensitive is many-shot ICL to example ordering and context length?

Key findings

  • Many-shot ICL yields substantial performance gains across tasks, often peak performance when shots reach hundreds to thousands of tokens.
  • Reinforced ICL and Unsupervised ICL can outperform or match human-written rationales in many settings, especially on complex reasoning tasks.
  • Many-shot ICL can overcome pre-training biases and learn high-dimensional numerical tasks such as sequential parity and linear classification.
  • The order of in-context examples significantly influences performance even in many-shot ICL.
  • Next-token prediction loss may not reliably predict downstream ICL performance on problem-solving and reasoning tasks.
Figure 2: Context Length for best-performing and the maximum number of shots tested for each task. The horizontal dashed line shows the context length of GPT-3 (2048 tokens), which is representative of typical few-shot prompts tested in the LLM literature. For several tasks, we observed the best-per
Figure 2: Context Length for best-performing and the maximum number of shots tested for each task. The horizontal dashed line shows the context length of GPT-3 (2048 tokens), which is representative of typical few-shot prompts tested in the LLM literature. For several tasks, we observed the best-per

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.