Large Language Models are Demonstration Pre-Selectors for Themselves

Jiarui Jin, Yuwei Wu, Haoxuan Li, Xiaoting He, Weinan Zhang, Yiming Yang, Yong Yu, Jun Wang, Mengyue Yang · DOI

Abstract

In-context learning (ICL) relies heavily on the selection of high-quality demonstrations, yet traditional retrieval methods often treat demonstration quality as a universal metric, ignoring the specific knowledge gaps of the model in use. We present FEEDER (FEw yet Essential Demonstration prE-selectoR), a framework that leverages the LLM itself to pre-select a condensed "core set" of training data. By employing causal metrics of sufficiency and necessity, FEEDER identifies the most informative examples for a specific model architecture. Our results demonstrate that FEEDER significantly reduces the computational overhead of demonstration selection while maintaining or improving performance across classification, reasoning, and semantic parsing tasks.

Introduction

Large Language Models (LLMs) have demonstrated remarkable proficiency in few-shot learning through In-Context Learning (ICL). By providing a few relevant demonstrations within the prompt, users can guide models to perform complex tasks without parameter updates. However, the efficacy of ICL is highly sensitive to the choice of these demonstrations.

Existing retrieval strategies—such as those based on semantic similarity, diversity, or uncertainty—typically search through an entire training dataset for every query. This approach is computationally expensive and fundamentally flawed in its assumption that demonstration quality is model-agnostic. In practice, an example that is highly informative for a smaller model might be redundant for a larger one that already possesses that internal knowledge. To address this, we introduce FEEDER, a method for model-specific data pruning that identifies the essential subset of data required by a specific LLM.

Methodology: The FEEDER Framework

FEEDER operates as a pre-selection stage that filters a massive dataset into a small, high-quality subset tailored to the target LLM. This process is governed by two causal metrics derived from the model's own behavior:

  1. Sufficiency: An example is considered sufficient if its inclusion in the prompt allows the LLM to correctly answer a previously failed query.
  2. Necessity: An example is considered necessary if its removal from the prompt causes the LLM to lose the ability to answer a query correctly.

Tree-Based Approximation

Evaluating every possible combination of data points to find the optimal subset is a combinatorial problem with $O(2^N)$ complexity. To make this tractable, FEEDER utilizes a tree-based approximation algorithm. The algorithm pairs groups of examples and uses the LLM to determine if one group is sufficient to represent the information in another. Redundant groups are pruned from the bottom up, resulting in a condensed core set that retains the most "essential" information for that specific model.

Implementation Scenarios

FEEDER is versatile and can be integrated into two primary workflows:

  • In-Context Learning: The pre-selected core set replaces the full training dataset as the retrieval pool. This speeds up downstream similarity or diversity searches by reducing the search space.
  • Fine-Tuning: The framework employs a bi-level optimization loop. The LLM is fine-tuned on the FEEDER-selected subset, and the subset is iteratively updated as the model’s internal knowledge base evolves during training.

Experimental Evaluation

We evaluated FEEDER across a diverse array of benchmarks, including text classification (SST-2, SST-5, COLA), mathematical reasoning (GSM8K), semantic parsing (SMCALFlow), and graduate-level scientific QA (GPQA). The experiments spanned model sizes from 300M parameters (GPT-2) to 32B parameters (Qwen-2.5).

Key Findings

  • Efficiency and Data Reduction: FEEDER consistently reduced the size of the demonstration pool by over 20%, and in many cases by more than 50%, without a loss in accuracy.
  • Performance Gains: In ICL settings, performing a simple similarity search on the FEEDER core set often outperformed more complex and expensive algorithms (like clustering or diversity-based selection) applied to the full dataset.
  • Quality over Quantity: The study confirmed that more demonstrations are not always better. Standard ICL often suffers from performance degradation when the number of shots increases (e.g., from 5 to 10) due to noise. FEEDER’s necessity filter effectively mitigates this by excluding redundant or distracting examples.
  • Model-Specific Utility: The experiments proved that the "best" demonstrations are indeed model-dependent. A core set selected by and for a specific model architecture consistently yielded better results than a generic core set.

Discussion and Limitations

By framing prompt engineering through the lens of causal inference—specifically the concepts of "plugging in" and "unplugging" data points—FEEDER provides a mathematical foundation for identifying informative demonstrations. This approach ensures that the context window remains clean and focused on the specific knowledge gaps of the model.

However, the reliance on the LLM as its own selector introduces a risk of bias amplification. If a model has inherent hallucinations or systematic biases in its weights, FEEDER may prioritize data that reinforces those biases rather than correcting them. Future research will focus on applying this causal pruning approach to larger frontier models and exploring its utility in data safety and general pre-training data management.

Conclusion

FEEDER represents a shift from universal data retrieval to model-aware data selection. By allowing LLMs to act as their own filters, we can achieve higher performance with significantly less data, making sophisticated in-context learning more accessible and computationally efficient.

Summary updated

BibTeX
@inproceedings{jin2025large,
  author = {Jiarui Jin and Yuwei Wu and Haoxuan Li and Xiaoting He and Weinan Zhang and Yiming Yang and Yong Yu and Jun Wang and Mengyue Yang},
  title = {{Large Language Models are Demonstration Pre-Selectors for Themselves}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=YgfpMhNYnW},
}
Figure