TLDR: This paper introduces In-Context Approximation (ICA), a new method for efficiently selecting and reweighting training data for large language model fine-tuning. ICA estimates how valuable each data example is by simulating its impact on a small, high-quality “holdout” dataset using in-context learning, avoiding expensive retraining. This approach consistently improves model alignment across various fine-tuning tasks with minimal computational overhead.
Fine-tuning large language models (LLMs) is a crucial step in making them perform specific tasks and align with human preferences. This process typically involves training the model on instruction-response pairs or preference data. However, the quality of this training data is paramount. Noisy, inconsistent, or off-target examples can actually hinder the model’s performance, diluting the valuable alignment signals.
Recent research has highlighted that smaller, carefully chosen datasets can often lead to performance comparable to, or even better than, much larger ones. This emphasizes the critical need for effective data selection. Yet, systematic and efficient methods for identifying truly high-value training data have remained largely unexplored, with many existing approaches relying on guesswork or computationally expensive retraining.
The Challenge of Valuing Data
The core difficulty lies in defining what makes a piece of training data “valuable.” Ideally, data value should be measured by its positive impact on the model’s performance on downstream tasks. However, directly calculating this impact for every potential training example would mean retraining and evaluating the model repeatedly, a process that is simply too slow and resource-intensive for large models.
Previous attempts to tackle this challenge have included methods based on influence functions, surrogate models, or complex optimization techniques. While promising, these often come with high computational costs or lack a strong theoretical foundation.
Introducing In-Context Approximation (ICA)
A new framework, called In-Context Approximation (ICA), offers a theoretically sound and resource-efficient solution for data selection and reweighting in LLM fine-tuning. At its heart, ICA estimates the “holdout loss” a model would experience after training on a particular candidate example. The holdout loss is essentially how well the model would perform on a small, high-quality, curated dataset (the “holdout set”) if it were trained with that specific example.
What makes ICA revolutionary is that it achieves this estimation without needing to actually retrain the model or use a separate “reference model.” Instead, it leverages the LLM’s inherent “in-context learning” capabilities. By providing a small, curated holdout set as “in-context demonstrations” to the model, ICA simulates a single step of fine-tuning. This allows for a computationally efficient estimate of how valuable each training example is.
How ICA Works in Practice
ICA assigns a score to each training example, reflecting its utility in reducing the holdout loss. A higher ICA score means the example is more beneficial for the model’s alignment. These scores are then used to dynamically reweight the gradient updates during the fine-tuning process. This means that examples with higher ICA scores contribute more significantly to the model’s learning, effectively prioritizing the most valuable data.
To further enhance efficiency, ICA incorporates practical techniques. Instead of using the entire holdout set for in-context demonstrations (which might exceed prompt length limits), it selects a small number of the most similar holdout examples using a technique called k-nearest neighbors (kNN) in an embedding space. Additionally, the scores for all training examples are not recomputed at every single training step; instead, they are updated periodically, further reducing computational overhead.
Consistent Improvements with Minimal Overhead
The effectiveness of ICA has been demonstrated across various fine-tuning paradigms, including Supervised Fine-Tuning (SFT), Direct Preference Optimization (DPO), and SimPO. It consistently improves model alignment across diverse datasets and different LLM architectures (like LLaMA and Qwen models of various sizes). When compared to standard training without reweighting, ICA consistently leads to better alignment.
Crucially, ICA achieves these improvements with only marginal computational overhead, adding approximately 1.5% to the total training time. This is significantly more efficient than other baseline methods like RHO-Loss (which adds about 10% overhead) or one-shot learning (around 4% overhead), while often achieving comparable or superior performance. For more details, you can refer to the full research paper: Holdout-Loss-Based Data Selection for LLM Finetuning via In-Context Learning.
Key Insights from Ablation Studies
Further analysis revealed several important findings:
A small number of holdout examples (e.g., k=3) is sufficient for effective in-context demonstrations, maintaining strong alignment without needing larger sets.
More frequent updates of ICA scores during training can further enhance alignment performance.
Adaptive reweighting based on ICA scores is generally more effective than simple percentile-based filtering, which can be sensitive to the chosen threshold.
Using more advanced embedding models for selecting holdout examples can lead to even better alignment.
Also Read:
- GuardSpace: A New Approach to Preserving AI Safety During Language Model Fine-Tuning
- MERA: A Principled Approach to Reducing Language Model Errors Through Adaptive Steering
Looking Ahead
While ICA represents a significant leap forward, the researchers acknowledge certain limitations and future directions. The method relies on the quality and representativeness of the holdout set; a noisy or unrepresentative holdout could impact generalization. Additionally, ICA is currently best suited for “off-policy” methods. Applying it to “on-policy” methods, where model parameters and data continuously evolve, would require frequent recomputation of scores, potentially creating a new computational bottleneck. These areas present exciting opportunities for future research.


