Fine-Tuned In-Context Learners for Efficient Adaptation

Jörg Bornschein, Clare Lyle, Yazhe Li, Amal Rannen-Triki, Xu Owen He, Razvan PascanuarXiv 2025 · DOI

TL;DR

This paper introduces a novel approach called "Fine-Tuned In-Context Learners" (ICL+FT) that combines the strengths of in-context learning and fine-tuning for adapting Large Language Models (LLMs) to new tasks. ICL+FT consistently matches or surpasses existing methods, especially in data-scarce scenarios, by fine-tuning on task-specific data augmented with in-context examples. The authors also propose a practical prequential evaluation method for efficient hyperparameter tuning in low-data regimes.

What Problem Does This Paper Address?

Adapting powerful Large Language Models (LLMs) to specific downstream tasks is crucial, but current methods have trade-offs. Prompt engineering with in-context learning (ICL) is sample-efficient and works well with few examples, but its performance plateaus as more data becomes available. Fine-tuning (FT), on the other hand, scales well with data but can underperform when training examples are scarce. This creates a dilemma: choose sample efficiency or data scalability. The paper aims to bridge this gap by developing a unified approach that offers the best of both worlds, particularly in data-limited scenarios where hyperparameter selection is also a significant challenge.

Methods

The core contribution is the ICL+FT approach. Instead of just fine-tuning on individual examples or using ICL alone, the authors fine-tune the LLM on k-shot in-context learning prompts. This means the fine-tuning data itself is structured like an ICL prompt, with a few examples followed by the target example. During inference, the fine-tuned model also receives k in-context examples.

To address the challenge of hyperparameter selection in low-data regimes, the paper proposes a prequential evaluation protocol. This method, also known as forward validation, iteratively uses each data point first for evaluation and then incorporates it into the training data. This is computationally efficient and avoids sacrificing valuable data for validation sets, making it ideal for scenarios with limited ground truth.

Datasets

The experiments were conducted on several benchmark datasets:

  • Big-Bench Hard (BBH): A suite of 23 challenging tasks designed to test LLMs.
  • NLP task suite: Used by Wei et al. (2023) for evaluating language understanding tasks.
  • Parity-20 Task: A task proposed by Agarwal et al. (2024) to test in-context capabilities.
  • FLoRes: A dataset for low-resource language translation.
  • Datasets from Long-Context ICL Paper: Used for evaluating performance on longer contexts.

The models used were primarily Gemma-2 models (2B, 9B, and 27B parameters) and also Qwen-3 models (0.6B, 1.7B, 4B, and 30B variants) to demonstrate architectural agnosticism.

Key Insights and Ideas

  • ICL+FT is a powerful hybrid: The unified ICL+FT approach consistently matches or surpasses both ICL-Only and FT-Only, especially when data is limited. It effectively leverages the strengths of both paradigms.
  • Prequential evaluation is key for low-data regimes: The proposed prequential method for hyperparameter selection is data-efficient and computationally cheaper than traditional cross-validation, making it practical for real-world adaptation scenarios.
  • ICL+FT offers better sample efficiency: The ICL+FT method often achieves comparable performance to larger models or requires significantly less data than FT-Only to reach similar performance levels.
  • Robustness to hyperparameters: ICL+FT appears to be more robust to hyperparameter choices, degrading less when fixed hyperparameters are used compared to FT-Only.
  • Prompting still matters: Even with fine-tuning, adding explicit instructions to the prompt can significantly boost performance for both FT-Only and ICL+FT.

Key Results

  • On the BBH dataset, ICL+FT consistently outperformed FT-Only and ICL-Only across various model sizes and data budgets. For instance, with 30 examples, ICL+FT achieved higher accuracy than FT-Only and often outperformed larger ICL-Only models.
  • With 150 examples, ICL+FT achieved significantly better performance than FT-Only and ICL-Only on BBH tasks.
  • For the NLP task suite, ICL+FT also showed competitive or superior performance compared to baselines.
  • On the Parity-20 task, while ICL-Only struggled, FT-Only and especially ICL+FT showed dramatic improvements, with ICL+FT requiring only about 30 examples to reach 100% accuracy.
  • The prequential hyperparameter selection method was shown to be effective, leading to good performance even with a single globally chosen configuration.

Limitations and Future Work

  • Computational Cost: While prequential evaluation is more efficient than cross-validation, the overall fine-tuning process can still be computationally intensive.
  • Hyperparameter Tuning: While the prequential method is efficient, finding the optimal hyperparameters still requires careful consideration.
  • Low-resource translation: For translation into English from low-resource languages, fine-tuning methods (FT-Only and ICL+FT) showed a slight negative effect, possibly because the models leverage pre-trained skills and limited examples don't suffice for enhancement. The authors hypothesize that the well-trained model might lose refinement through gradient updates.
  • Future Work: The authors suggest that their combined approach provides a robust solution for adapting LLMs to new tasks, particularly when data is scarce, and that further exploration of this unified paradigm is warranted. They also highlight the potential for significant compute and energy savings by using smaller models with ICL+FT.

Summary updated

Abstract

When adapting large language models (LLMs) to a specific downstream task, two primary approaches are commonly employed: (1) prompt engineering, often with in-context few-shot learning, leveraging the model's inherent generalization abilities, and (2) fine-tuning on task-specific data, directly optimizing the model's parameters. While prompt-based methods excel in few-shot scenarios, their effectiveness often plateaus as more data becomes available. Conversely, fine-tuning scales well with data but may underperform when training examples are scarce. We investigate a unified approach that bridges these two paradigms by incorporating in-context learning directly into the fine-tuning process. Specifically, we fine-tune the model on task-specific data augmented with in-context examples, mimicking the structure of k-shot prompts. This approach, while requiring per-task fine-tuning, combines the sample efficiency of in-context learning with the performance gains of fine-tuning, leading to a method that consistently matches and often significantly exceeds both these baselines. To perform hyperparameter selection in the low-data regime, we propose to use prequential evaluation, which eliminates the need for expensive cross-validation and leverages all available data for training while simultaneously providing a robust validation signal. We conduct an extensive empirical study to determine which adaptation paradigm - fine-tuning, in-context learning, or our proposed unified approach offers the best predictive performance on a concrete data downstream-tasks.
BibTeX
@misc{bornschein2025fine,
  author = {Jörg Bornschein and Clare Lyle and Yazhe Li and Amal Rannen-Triki and Xu Owen He and Razvan Pascanu},
  title = {{Fine-Tuned In-Context Learners for Efficient Adaptation}},
  year = {2025},
  eprint = {2512.19879},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.19879},
}
Figure