Overview
CASE (Challenger Arm Sampling for Exemplar selection) optimizes few-shot prompting by framing exemplar selection as a multi-armed bandit problem. By maintaining a "challenger" shortlist of promising example sets, it achieves up to a 7x speedup and an 87% reduction in LLM calls compared to state-of-the-art methods, all while maintaining or improving task accuracy.
Introduction
In-context learning (ICL) allows Large Language Models (LLMs) to perform new tasks simply by providing a few examples (exemplars) in the prompt. However, the specific choice of these exemplars significantly impacts performance. Finding the "best" set of exemplars is a massive combinatorial challenge: if you have a pool of 100 training examples and want to pick a 5-shot prompt, there are over 75 million possible combinations.
Evaluating every combination is impossible because each test requires an expensive LLM inference call. Existing methods often rely on simple heuristics (like picking the most similar examples via KNN) or computationally heavy search processes that require thousands of LLM calls. This paper aims to find high-performing exemplar sets with minimal "samples" (LLM evaluations) to make prompt optimization practical and cost-effective.
Methodology: The CASE Framework
The authors propose CASE, which models exemplar selection as a top-m best arms identification problem in a stochastic linear bandit setting.
- Linear Reward Model: Instead of treating every subset of exemplars as independent, CASE assumes the "reward" (validation accuracy) can be modeled as a linear function of the semantic similarity (using BERT embeddings) between the exemplars and the validation data.
- Challenger Arm Sampling: The core innovation is the use of a "shortlist" of challenger arms. In each iteration, instead of searching the entire exponential space of subsets, CASE maintains a small set of promising candidates.
- Selective Exploration: The algorithm iteratively updates its top-$m$ estimates by either pulling an arm from the current best set or a "challenger" from the shortlist. This drastically prunes the search space, focusing LLM evaluations only on the most informative candidates.
- GIFA Framework: CASE integrates with the Gap-Index based identification algorithm to decide which arm to "pull" next based on which one will most reduce uncertainty about the top-$m$ set.
Experimental Setup
The researchers evaluated CASE across five diverse datasets requiring complex reasoning:
- Numerical Reasoning: GSM8K, AquaRat, TabMWP, and FinQA.
- Commonsense Reasoning: StrategyQA.
They used GPT-3.5-turbo and GPT-4o-mini as the primary LLMs, with Mistral-7B and Llama-2-7B used for "exemplar reuse" experiments.
Key Insights
- Semantic Similarity as a Proxy: The paper demonstrates that a linear model based on BERT-based sentence similarities is a highly effective surrogate for predicting prompt performance, allowing the bandit to learn without exhaustive testing.
- Efficiency through Pruning: By focusing on a "challenger" shortlist rather than the full combinatorial space, CASE avoids the "combinatorial blowup" that plagues standard bandit algorithms in this domain.
- Exemplar Transferability: A major insight is that exemplars optimized using smaller, cheaper models (like Mistral-7B) transfer remarkably well to larger models (like GPT-3.5). This allows for "exemplar reuse," where you find the best prompts cheaply and then deploy them on expensive production models.
- Diversity Matters: Qualitative analysis shows that CASE tends to select diverse sets of exemplars that cover different reasoning steps, whereas simpler methods like LENS often pick redundant examples.
Results and Efficiency Gains
CASE demonstrates significant efficiency gains over state-of-the-art methods like LENS and EXPLORA:
- LLM Call Reduction: CASE requires roughly 7x fewer LLM calls (an 87% reduction) to reach convergence.
- Runtime Speedup: It achieves up to a 7x speedup in total execution time.
- Performance Gains: CASE improved task performance by up to 15.19% compared to baseline methods and consistently outperformed manual or random exemplar selection.
- Convergence: In synthetic experiments, CASE identified the optimal arms with orders of magnitude fewer comparisons than standard linear bandit algorithms like LinGapE.
Limitations and Future Directions
While CASE is highly effective, the authors note a few areas for further exploration:
- Linear Assumption: The reward model assumes a linear relationship between similarity and accuracy. While this works well, it might miss complex, non-linear interactions between specific examples in a prompt.
- Theoretical Bounds: The paper provides a proof overview for sample complexity, but a more rigorous derivation of regret bounds specifically for the CASE sampling strategy is left for future work.
- Broader Applications: The authors plan to extend this "challenger arm" approach to other areas, such as adaptive retrieval for RAG (Retrieval-Augmented Generation) and re-ranking documents for complex question answering.
Summary updated