[Paper Review] Few-shot Fine-tuning vs. In-context Learning: A Fair Comparison and Evaluation
This paper presents a fair, model-size-controlled comparison between few-shot fine-tuning (FT) and in-context learning (ICL) using the OPT and Pythia models across 125M to 30B parameters. It finds that FT generalizes as well as ICL on out-of-domain data when models are of equal size, challenging prior claims that ICL is inherently more robust, and highlights that both methods are unstable and highly sensitive to data, prompt design, and model scale.
Few-shot fine-tuning and in-context learning are two alternative strategies for task adaptation of pre-trained language models. Recently, in-context learning has gained popularity over fine-tuning due to its simplicity and improved out-of-domain generalization, and because extensive evidence shows that fine-tuned models pick up on spurious correlations. Unfortunately, previous comparisons of the two approaches were done using models of different sizes. This raises the question of whether the observed weaker out-of-domain generalization of fine-tuned models is an inherent property of fine-tuning or a limitation of the experimental setup. In this paper, we compare the generalization of few-shot fine-tuning and in-context learning to challenge datasets, while controlling for the models used, the number of examples, and the number of parameters, ranging from 125M to 30B. Our results show that fine-tuned language models can in fact generalize well out-of-domain. We find that both approaches generalize similarly; they exhibit large variation and depend on properties such as model size and the number of examples, highlighting that robust task adaptation remains a challenge.
Motivation & Objective
- To resolve conflicting claims about in-context learning (ICL) outperforming fine-tuning (FT) in out-of-domain generalization by eliminating confounding factors like model size.
- To investigate whether the observed generalization gap between ICL and FT is due to inherent limitations of fine-tuning or experimental design flaws in prior studies.
- To evaluate the stability and performance of both FT and ICL across varying model sizes (125M to 30B) and few-shot data settings (16 and 128 examples).
- To assess the impact of prompt design, data selection, and model scale on the generalization behavior of both adaptation strategies.
- To provide actionable insights on when and how to use FT or ICL effectively, based on empirical results under controlled conditions.
Proposed method
- Used the OPT and Pythia models across multiple sizes (125M to 30B) to ensure model size was a controlled variable.
- Applied pattern-based fine-tuning (PBFT) with fixed input patterns and verbalizers to standardize the fine-tuning process.
- Used in-context learning with 16-shot demonstrations and three prompt patterns (minimal, gpt-3, eval-harness) to ensure consistent ICL setup.
- Trained and evaluated on the RTE and MNLI datasets using 10 random data seeds per experiment to assess stability.
- Selected model checkpoints based on in-domain and out-of-domain performance to evaluate generalization robustness.
- Performed Welch’s t-tests on performance differences to determine statistical significance between ICL and FT across model sizes and data settings.
Experimental results
Research questions
- RQ1Does fine-tuning generalize as well as in-context learning on out-of-domain data when models are of equal size?
- RQ2How does model size influence the generalization performance of both fine-tuning and in-context learning?
- RQ3What role does the number of few-shot examples (16 vs. 128) play in the stability and performance of both adaptation strategies?
- RQ4How sensitive are fine-tuning and in-context learning to prompt design and data selection strategies?
- RQ5Is the previously observed superiority of in-context learning over fine-tuning due to inherent advantages or experimental bias from model size disparities?
Key findings
- When models are of equal size, few-shot fine-tuning generalizes comparably to in-context learning on out-of-domain data, challenging prior claims of ICL’s inherent robustness.
- Fine-tuning with a 6.7B model achieved performance comparable to in-context learning with a 30B model when using only 16 examples, indicating that model scale heavily influences prior comparisons.
- Both fine-tuning and in-context learning exhibit high instability across random seeds, with significant variation in in-domain and out-of-domain performance.
- Performance for both methods improves with increasing model size, and for the models and datasets tested, fine-tuning often generalizes better than in-context learning.
- The choice of prompt pattern and data selection strategy (e.g., best in-domain vs. best out-of-domain checkpoint) significantly impacts performance, especially in fine-tuning.
- No statistically significant performance difference was found between ICL and FT on the RTE dataset for most model sizes when using 16 examples and optimal checkpoint selection, indicating comparable generalization under fair conditions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.