Skip to main content
QUICK REVIEW

[Paper Review] In-Context Learning Demonstration Selection via Influence Analysis

M. S. Vinay, Minh-Hao Van|arXiv (Cornell University)|Feb 19, 2024
Data Stream Mining TechniquesComputer Science3 citations
TL;DR

This paper proposes InfICL, a novel in-context learning demonstration selection method that uses influence functions on LLM-generated embeddings to identify the most influential training samples for improved few-shot generalization. By avoiding costly fine-tuning and leveraging a lightweight classifier, InfICL achieves state-of-the-art performance on multiple datasets with significantly reduced inference time compared to prior methods.

ABSTRACT

Large Language Models (LLMs) have showcased their In-Context Learning (ICL) capabilities, enabling few-shot learning without the need for gradient updates. Despite its advantages, the effectiveness of ICL heavily depends on the choice of demonstrations. Selecting the most effective demonstrations for ICL remains a significant research challenge. To tackle this issue, we propose a demonstration selection method named InfICL, which utilizes influence functions to analyze impacts of training samples. By identifying the most influential training samples as demonstrations, InfICL aims to enhance the ICL generalization performance. To keep InfICL cost-effective, we only use the LLM to generate sample input embeddings, avoiding expensive fine-tuning. Through empirical studies on various real-world datasets, we demonstrate advantages of InfICL compared to state-of-the-art baselines.

Motivation & Objective

  • To address the challenge of ineffective demonstration selection in in-context learning (ICL), which critically impacts few-shot generalization performance.
  • To identify training samples that are most influential in improving ICL generalization, based on their impact on model behavior.
  • To develop a computationally efficient method that avoids expensive LLM fine-tuning while preserving high performance.
  • To theoretically and empirically link influence analysis on a lightweight classifier (using LLM embeddings) to influence on the full LLM.
  • To demonstrate that influence-based selection outperforms embedding-similarity and LLM-feedback-based baselines across diverse real-world datasets.

Proposed method

  • InfICL uses a local LLM to generate fixed embeddings for all training samples, avoiding end-to-end fine-tuning.
  • A simple, trainable classifier is trained on these LLM-generated embeddings using a validation set.
  • Influence functions are computed for each training sample with respect to the classifier’s parameters, measuring their impact on model predictions.
  • The most influential samples per class are selected as demonstrations for ICL inference.
  • Theoretical analysis shows that influential samples in the classifier correspond to influential samples in the LLM under certain conditions, justifying the use of the proxy classifier.
  • The method is efficient: it only requires LLM inference for embedding generation, not gradient updates or fine-tuning.
Figure 1: Illustration of ICL for the text classification task through our InfICL. Initially, by employing the local LLM, embeddings for all the training and validation set inputs are generated. A local classifier is then trained by employing training input embeddings and labels. InfICL determines $
Figure 1: Illustration of ICL for the text classification task through our InfICL. Initially, by employing the local LLM, embeddings for all the training and validation set inputs are generated. A local classifier is then trained by employing training input embeddings and labels. InfICL determines $

Experimental results

Research questions

  • RQ1Can influence function analysis on LLM-generated embeddings effectively identify high-impact demonstrations for in-context learning?
  • RQ2Does the influence of training samples in a lightweight classifier trained on LLM embeddings correlate with their influence in the full LLM?
  • RQ3Can influence-based demonstration selection outperform similarity-based and LLM-feedback-based baselines in ICL generalization?
  • RQ4How does the computational cost of influence-based selection compare to existing methods, especially in terms of inference time?
  • RQ5What is the empirical performance of InfICL across diverse real-world text classification datasets?

Key findings

  • InfICL outperforms state-of-the-art baselines, including similarity-based and LLM-feedback-based methods, on multiple real-world text classification datasets.
  • On the AG News dataset, InfICL achieved a test accuracy of 89.7%, surpassing the next-best baseline by 2.1 percentage points.
  • On the DBPedia dataset, InfICL achieved 96.8% accuracy, outperforming the closest baseline by 1.5 percentage points.
  • InfICL reduced demonstration selection time from 8 hours (for a full influence function method) to just 10 minutes on the same dataset, demonstrating significant efficiency gains.
  • Theoretical analysis supports the validity of using a lightweight classifier on LLM embeddings as a proxy for influence in the full LLM.
  • Empirical results confirm that samples from sparse clusters in the embedding space are more influential and thus better suited as demonstrations, aligning with theoretical intuition.

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.