Monte Carlo Sampling for Analyzing In-Context Examples

Stephanie Schoch, Yangfeng Ji


Abstract
Prior works have shown that in-context learning is brittle to presentation factors such as the order, number, and choice of selected examples. However, ablation-based guidance on selecting the number of examples may ignore the interplay between different presentation factors. In this work we develop a Monte Carlo sampling-based method to study the impact of number of examples while explicitly accounting for effects from order and selected examples. We find that previous guidance on how many in-context examples to select does not always generalize across different sets of selected examples and orderings, and whether one-shot settings outperform zero-shot settings is highly dependent on the selected example. Additionally, inspired by data valuation, we apply our sampling method to in-context example selection to select examples that perform well across different orderings. We find a negative result, that while performance is robust to ordering and number of examples, there is an unexpected performance degradation compared to random sampling.
Anthology ID:
2025.insights-1.7
Volume:
The Sixth Workshop on Insights from Negative Results in NLP
Month:
May
Year:
2025
Address:
Albuquerque, New Mexico
Editors:
Aleksandr Drozd, João Sedoc, Shabnam Tafreshi, Arjun Akula, Raphael Shu
Venues:
insights | WS
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
63–78
Language:
URL:
https://preview.aclanthology.org/fix-sig-urls/2025.insights-1.7/
DOI:
Bibkey:
Cite (ACL):
Stephanie Schoch and Yangfeng Ji. 2025. Monte Carlo Sampling for Analyzing In-Context Examples. In The Sixth Workshop on Insights from Negative Results in NLP, pages 63–78, Albuquerque, New Mexico. Association for Computational Linguistics.
Cite (Informal):
Monte Carlo Sampling for Analyzing In-Context Examples (Schoch & Ji, insights 2025)
Copy Citation:
PDF:
https://preview.aclanthology.org/fix-sig-urls/2025.insights-1.7.pdf