Data Whisperer: Efficient Data Selection for Task-Specific LLM Fine-Tuning via Few-Shot In-Context Learning

Shaobo Wang, Xiangqi Jin, Ziming Wang, Jize Wang, Jiajun Zhang, Kaixin Li, Zichen Wen, Zhong Li, Conghui He, Xuming Hu, Linfeng Zhang

Abstract

Fine-tuning Large Language Models (LLMs) on task-specific datasets is a standard practice for achieving specialized performance. However, as dataset sizes grow, the computational cost of training on the full corpus becomes prohibitive. While data selection methods aim to identify a high-quality "coreset," many existing techniques require training expensive proxy models, often negating the efficiency gains of selection. We present Data Whisperer, a training-free data selection method that leverages few-shot In-Context Learning (ICL) and internal attention mechanisms to identify informative training examples. Data Whisperer achieves superior performance using only 10% of a dataset while operating up to 20x faster than previous state-of-the-art methods, effectively resolving the efficiency bottleneck in LLM adaptation.

1. Introduction: The Efficiency Paradox in Data Selection

As Large Language Models (LLMs) scale, the volume of task-specific data available for fine-tuning has increased exponentially. Training on the entirety of these datasets is often redundant and computationally expensive. Data selection—the process of identifying a representative subset (or coreset) of data—is a promising solution.

However, the authors identify a critical "Catch-22" in current methodologies. Traditional selection metrics (e.g., GraNd or EL2N) typically require training a "proxy" model on the target dataset to calculate importance scores. To quantify this, the authors introduce the Selection-to-Tuning Ratio (STR):

$$STR = \frac{\text{Time spent on Data Selection}}{\text{Time spent on Full Fine-Tuning}}$$

If the STR is greater than 1, the selection process consumes more resources than simply fine-tuning on the full dataset, rendering the selection practically useless for efficiency. Most current state-of-the-art (SOTA) methods suffer from high STRs, creating a need for a truly lightweight selection mechanism.

2. Methodology: Data Whisperer

Data Whisperer avoids the overhead of proxy training by utilizing the pre-trained model’s inherent capabilities. The method consists of three primary pillars:

2.1 Few-Shot ICL Scoring

Rather than updating weights, Data Whisperer uses the model in a few-shot In-Context Learning (ICL) setting. By presenting the model with a small set of "demonstration" examples and a set of "query" examples, the model’s predictive accuracy on the queries serves as a raw proxy for the quality and informativeness of the demonstrations.

2.2 Context-Aware Weighting

To refine the ICL scores, the authors incorporate internal model dynamics. They hypothesize that not all demonstrations in a prompt contribute equally to the model's output. By extracting attention scores from intermediate layers, the method weights the performance scores based on how much the model actually "attended" to specific examples when generating its response. This ensures that examples which truly drive the model's reasoning are prioritized.

2.3 Weak-to-Strong Selection

To further minimize the STR, the researchers demonstrate a "weak-to-strong" transferability. A smaller, computationally cheaper model (e.g., a 3B parameter model) can be used to select data for a larger, more powerful model (e.g., an 8B parameter model) within the same architecture family, significantly reducing the selection time without sacrificing coreset quality.

3. Experimental Setup

The effectiveness of Data Whisperer was evaluated across several diverse benchmarks:

  • GSM8K: Grade school math word problems requiring multi-step reasoning.
  • DialogSum: Real-life dialogue summarization tasks.
  • BioInstruct: Specialized biomedical question-answering.
  • Synthetic DialogSum: A variant of DialogSum generated by Llama-3-8B-Instruct to test robustness on synthetic, AI-generated distributions.

4. Key Insights and Results

4.1 Superior Performance with Minimal Data

On the GSM8K benchmark, Llama-3-8B-Instruct fine-tuned on a 10% subset selected by Data Whisperer achieved a score of 72.46, outperforming the same model trained on 100% of the data (71.39). This suggests that Data Whisperer successfully filters out noise and redundant samples that may hinder the learning process.

4.2 Drastic Efficiency Gains

Data Whisperer demonstrated massive speedups compared to previous SOTA methods like "Nuggets," with gains ranging from 7.4x to over 20x. While baseline methods often exceeded an STR of 1.0, Data Whisperer consistently maintained an STR between 0.03 and 0.25, making it a viable tool for real-world production pipelines.

4.3 The Role of Intermediate Layers

Ablation studies revealed that attention scores from intermediate layers (e.g., Layer 13 of 32 in Llama-3-8B) are the most effective for data selection. These layers appear to capture the optimal balance of semantic understanding and task-specific relevance, whereas shallow layers are too focused on surface features and deep layers are too focused on output tokens.

5. Discussion and Limitations

While Data Whisperer represents a significant leap in efficiency, it has specific requirements. The method is currently a "white-box" approach, requiring access to internal attention weights, which precludes its use with closed-source APIs like GPT-4. Additionally, while the weak-to-strong approach is effective, it is most reliable when models share a similar architecture or training lineage.

6. Conclusion

Data Whisperer breaks the efficiency bottleneck of LLM fine-tuning by treating ICL as a proxy for fine-tuning potential. By leveraging internal attention mechanisms and avoiding proxy training, it provides a practical, high-speed path to optimizing model performance with a fraction of the data and compute. This work highlights the importance of the STR metric in evaluating the true utility of data selection algorithms.

Summary updated

BibTeX
@inproceedings{wang2025data,
  author = {Shaobo Wang and Xiangqi Jin and Ziming Wang and Jize Wang and Jiajun Zhang and Kaixin Li and Zichen Wen and Zhong Li and Conghui He and Xuming Hu and Linfeng Zhang},
  title = {{Data Whisperer: Efficient Data Selection for Task-Specific LLM Fine-Tuning via Few-Shot In-Context Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure