KITE: Kernelized and Information Theoretic Exemplars for In-Context Learning

Vaibhav Singh, Soumya Suvra Ghosal, Kapu Nirmal Joshua, Soumyabrata Pal, Sayak Ray Chowdhury

TL;DR

KITE (Kernelized and Information Theoretic Exemplars) is a training-free, unsupervised algorithm that optimizes the selection of in-context examples for Large Language Models (LLMs). By framing example selection as a query-specific optimization problem in a high-dimensional feature space, KITE balances semantic relevance with information-theoretic diversity, consistently outperforming standard nearest-neighbor methods with negligible computational overhead.

What Problem Does This Paper Address?

In-Context Learning (ICL) allows LLMs to adapt to new tasks simply by appending a few input-output examples (exemplars) to the user prompt. However, LLMs are highly sensitive to which examples are chosen.

The standard unsupervised approach is to use nearest-neighbor retrieval (like KATE), which selects examples closest to the user query in an embedding space. Unfortunately, high-dimensional embedding spaces suffer from well-known mathematical quirks: pairwise distances become less discriminative, noise sensitivity increases, and the retrieved examples often lack diversity, leading to redundant prompts that waste the LLM's limited context window.

KITE addresses this gap by replacing distance-based heuristics with a principled, query-specific optimization framework that guarantees both relevance and diversity.

Methods

The authors model the LLM's behavior using a Reproducing Kernel Hilbert Space (RKHS), approximating the model's responses as a linear function in a high-dimensional feature space. Under this framework, example selection becomes a task of minimizing the prediction error for a specific user query.

KITE operates in two main stages:

  1. Relevance Optimization via Approximate Submodularity: The authors derive a surrogate loss function that quantifies query-specific prediction error. While minimizing this loss directly is a hard combinatorial problem, they prove that the objective function is approximately submodular. This mathematical property ensures that a simple, fast greedy algorithm can select examples step-by-step while maintaining a provable approximation guarantee ($1-e^{-\gamma}$) relative to the absolute optimal subset.
  2. Information-Theoretic Diversity Regularization: To prevent the greedy algorithm from picking redundant examples, KITE incorporates a regularizer inspired by D-optimal experimental design (maximum information gain theory). This regularizer maximizes the determinant of the kernel matrix of the selected set, ensuring the exemplars cover a diverse subspace of the task geometry.

The complete greedy selection process is detailed in the algorithm below:

KITE Algorithm Pseudocode

Datasets

KITE was rigorously evaluated across a diverse suite of benchmarks:

  • Classification Tasks: SST-2 & SST-5 (sentiment analysis), CMSQA (commonsense QA), MRPC (paraphrase detection), QNLI (natural language inference), HellaSwag & SWAG (grounded commonsense reasoning), IMDB (movie reviews), DBPedia (topic classification), and BoolQ (yes/no QA).
  • Generative QA & Reasoning Tasks: Natural Questions (NQ), TriviaQA, HotpotQA, and GSM8K (grade-school math).

Key Insights and Ideas

  • Query-Specific Generalization: Traditional machine learning focuses on generalizing across an entire test distribution. KITE flips this paradigm by optimizing a unique subset of training examples tailored to perform well on a single, specific user query.
  • The Power of "Good Enough" Submodularity: Even though the exact error-minimization objective isn't perfectly submodular, proving its approximate submodularity allows practitioners to confidently use greedy search, turning an exponential-time problem into a highly efficient linear-time one.
  • Robustness to Encoders: Unlike other advanced retrieval methods (like CEIL), which exhibit high performance variance depending on the text encoder used, KITE remains consistently strong across various embedding models (BERT, RoBERTa, E5, NV-Embed-v2), making it highly viable for real-world deployment.

Key Results

The authors evaluated KITE against strong baselines, including BM25, Dense kNN retrieval, and the DPP-based CEIL retriever, across both open-source models (GPT-Neo, Qwen-2.5, Llama-3.2) and frontier API-only models (GPT-4o-mini, GPT-4.1, Claude-Haiku-4.5, GPT-5.2).

  • Superior Accuracy: Across 15 distinct open-source evaluation settings, KITE achieved the highest accuracy in 13 cases.
Table 1: Evaluation Results. We compare classification accuracy (%) of KITE against retrieval baselines on six few-shot benchmarks. Model abbreviations: GN (GPT-Neo 2.7B), QW (Qwen 2.5–1.5B), LL (Llama 3.2–3B).
  • Frontier LLM Gains: On frontier models, KITE achieved the best average accuracy across all seven classification datasets, outperforming the best kNN retriever by up to 1.3 points and CEIL by up to 1.2 points.
  • Negligible Latency Overhead: Despite its mathematical rigor, KITE adds almost no computational delay. Wall-clock time analysis shows it adds $\le 0.03$ seconds per query for a 1.5B model and $\le 0.19$ seconds for a 7B model compared to standard BM25, meaning the total latency remains dominated by the LLM's inference phase.

Limitations and Future Work

  • Grounded in Classification/Regression: The current theoretical framework assumes single-valued outputs (like label likelihoods). Extending KITE's theoretical guarantees to open-ended generation tasks (such as long-form summarization or dialogue) remains an open challenge.
  • Scaling to Massive Candidate Banks: KITE's greedy loop scales as $O(r \cdot n)$ where $n$ is the size of the example bank. For massive datasets ($n \gg 10^4$), the authors suggest a two-stage approach: using an approximate nearest-neighbor pre-filter to prune the candidate pool before running KITE's greedy selection. Characterizing the exact performance trade-offs of this pre-filtering step is left for future work.

Summary updated

BibTeX
@misc{singh2025kite,
  author = {Vaibhav Singh and Soumya Suvra Ghosal and Kapu Nirmal Joshua and Soumyabrata Pal and Sayak Ray Chowdhury},
  title = {{KITE: Kernelized and Information Theoretic Exemplars for In-Context Learning}},
  year = {2025},
  eprint = {2509.15676},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.15676},
}
Figure