Papers
Topics
Authors
Recent
Assistant
AI Research Assistant
Well-researched responses based on relevant abstracts and paper content.
Custom Instructions Pro
Preferences or requirements that you'd like Emergent Mind to consider when generating responses.
Gemini 2.5 Flash
Gemini 2.5 Flash 164 tok/s
Gemini 2.5 Pro 46 tok/s Pro
GPT-5 Medium 21 tok/s Pro
GPT-5 High 27 tok/s Pro
GPT-4o 72 tok/s Pro
Kimi K2 204 tok/s Pro
GPT OSS 120B 450 tok/s Pro
Claude Sonnet 4.5 34 tok/s Pro
2000 character limit reached

In-Context Data Distillation (ICD)

Updated 13 October 2025
  • In-Context Data Distillation (ICD) is a method that optimizes the selection of context examples for transformers to enhance adaptation and generalization.
  • ICD leverages techniques like label distribution and visual description enhancements to increase knowledge density and improve accuracy in few-shot settings.
  • It employs algorithmic and information-theoretic strategies to ensure computational efficiency and robustness across varied applications.

In-Context Data Distillation (ICD) refers to a set of methodologies aimed at synthesizing, selecting, or optimizing the set of in-context examples presented to large models (including language, vision-language, and transformer-based tabular models) during inference, such that model adaptation, reasoning, or generation is maximized under constraints on context size, computational resources, or dataset diversity. ICD builds on foundational properties of in-context learning (ICL), merging perspectives from selective data generation, retrieval, implicit knowledge distillation, and distributional alignment. The following sections comprehensively cover theoretical frameworks, algorithmic constructs, quantitative benchmarks, application domains, and implications for future research.

1. Theoretical Foundations and Data Generation Perspective

The mechanistic view of in-context learning is grounded in the concept of implicit function selection and adaptation, where a pre-trained model exhibits dual abilities: skill recognition and skill learning (Mao et al., 3 Feb 2024). Skill recognition enables the model to identify a previously learned data generation function (concept) relevant to presented in-context examples, formalized as Bayesian inference over latent concepts:

p(outputprompt)=conceptp(outputconcept,prompt)p(conceptprompt)d(concept)p(\text{output} | \text{prompt}) = \int_{\text{concept}} p(\text{output} | \text{concept}, \text{prompt}) \cdot p(\text{concept} | \text{prompt}) \, d(\text{concept})

Skill learning, conversely, allows the model to generalize to new functions on-the-fly, characterized by an optimization over the transformer’s parameters using the context:

minωE[i=2nL(f(xi),Tω([x1,f(x1),...,xi]))]\min_{\omega}\, \mathbb{E}\left[ \sum_{i=2}^n \mathcal{L}(f(x_i), T_\omega([x_1, f(x_1), ..., x_i])) \right]

In the ICD context, carefully curated or engineered in-context data can either reinforce the model's recognition of latent pre-trained concepts or facilitate rapid learning of novel mappings. The data generation perspective thus underpins principled selection strategies and informs statistical frameworks for ICD.

2. Label Space and Context Manipulation for Knowledge Density

One direct ICD methodology manipulates the label space or context representation of each in-context example to maximize conveyed information per token or instance (Chen et al., 2023). Classical approaches use sparse, one-hot labels:

D={1,0,0,,0}D = \{1, 0, 0, \dots, 0\}

ICD improves knowledge density via:

  • Label Distribution Enhancement (LDE): Transforming one-hot labels into distributions derived from cross-modal similarity (e.g., CLIP embeddings), incorporating softmax-scaled weights for related labels. This yields equidistributed, fully distributed, or descriptive label texts.
  • Visual Description Enhancement (VDE): Augmenting textual label representations with discriminative visual features, extracted as responses to prompts (e.g., "What are the useful visual features for distinguishing a {label}?").

These enhancements allow each in-context example to deliver substantial semantic and cross-modal information, facilitating superior few-shot classification accuracy—e.g., ImageNet accuracy raised from 74.70% to 76.21% in a 2-shot regime (exceeding CLIP by 0.67%), and CUB-200 1-shot accuracy raised from 48.86% to 69.05% (+12.15% over CLIP).

3. Algorithmic Distillation and Memory/Computational Efficiency

ICD often requires reconciling the quadratic complexity of context-size scaling (due to attention mechanisms) with the demand for comprehensive data coverage. A salient approach is the direct optimization of the context through dataset distillation techniques (Ma et al., 10 Feb 2024):

  • The distilled context DD is iteratively updated via the loss:

L(D)=E(x,y)Dtrain[logpθ(yx,D)]L(D) = -\mathbb{E}_{(x,y) \sim \mathcal{D}_{\text{train}}} \left[ \log p_\theta(y \mid x, D) \right]

  • Updates are performed as:

DDηDL(D)D \leftarrow D - \eta \nabla_D L(D)

  • At inference, for a new point xx:

y^=argmaxypθ(yx,D)\hat{y} = \arg\max_y p_\theta(y \mid x, D)

This method allows transformer-based tabular models to process datasets comprising hundreds of thousands of instances by summarizing them into a fixed, highly-informative context (e.g., D=1000|D| = 1000 distilled points), trading memory efficiency against linear tuning step increases.

4. Distributional Matching, Generalization Bounds, and Bias Analysis

Recent theory interprets in-context learning as implicit knowledge distillation, where prompt examples induce internal reference models during inference (Li et al., 13 Jun 2025). A key mathematical insight relates the generalization error and initialization bias to distributional mismatch between the prompt and task domains, measured by Maximum Mean Discrepancy (MMD):

ΔWFηMVMxMϕMMD(D,Q)\|\Delta W\|_F \leq \eta \cdot M_V \cdot M_x \cdot M_\phi \cdot \text{MMD}(\mathcal{D}, Q)

Here, QQ is the prompt distribution and D\mathcal{D} is the target domain. Rademacher complexity-based bounds further quantify the risk, with error shrinking as the context size increases. These results yield precise guidance for prompt engineering and automated demonstration selection, establishing MMD as a key metric for ICD efficacy.

5. Retrieval, Regularization, and Contextual Relationships

Advanced ICD pipelines can retrieve and aggregate in-context examples based on sample similarity for more nuanced student-teacher knowledge alignment (Zhu et al., 13 Jan 2025). The In-Context Knowledge Distillation (IC-KD) framework uses positive (same-class) and negative (different-class) in-context samples, leading to the following regularization terms:

  • Positive In-Context Distillation (PICD): Minimizing the KL divergence between student output and soft-aggregated teacher predictions from positive in-context samples:

Lpicd=KL(p^it(τ1)pis(τ1))\mathcal{L}_{\text{picd}} = \text{KL}( \hat{p}_i^t(\tau_1) \,\|\, p_i^s(\tau_1) )

  • Negative In-Context Distillation (NICD): Maximizing output separation for negative in-context samples via weighted cosine similarity.

This relational approach enhances generalization, smooths output distributions, and supports versatile KD modes (offline, online, teacher-free), demonstrating state-of-the-art results on CIFAR-100 and ImageNet.

6. Information-Theoretic and Residual-Aware Distillation Strategies

Recent methods formulate ICD as the optimization of information-theoretic objectives during data selection or synthetic generation (Ye et al., 7 Jul 2025, Fang et al., 23 Feb 2025). For diffusion-based distillation:

Objective=I(X;Y)+βH(XY)\text{Objective} = I(X;Y) + \beta H(X|Y)

I(X;Y)I(X;Y): Prototype (label-relevant) information, H(XY)H(X|Y): Contextual (intra-class variability) information.

Variational estimators are trained to provide tight lower bounds, with the final loss:

LIGDS=E[logP(YH^)]+βE(X,Y)[KL(σ(fθ(X))QY)]\mathcal{L}_{\text{IGDS}} = \mathbb{E} [ \log P(Y|\hat{H}) ] + \beta \cdot \mathbb{E}_{(X,Y)} [ \text{KL}(\sigma(f_\theta(X)) \,\|\, Q^Y) ]

In tabular domains, iterative residual-aware selection (Fang et al., 23 Feb 2025) reduces the distributional error between generated and real samples, providing more effective context and improving metric recall and fidelity by up to 42.2%.

7. Practical Implications, Applications, and Future Research

ICD methodologies significantly impact model adaptation, inference efficiency, and robustness across domains:

Key future directions include hybrid skill selection/learning strategies, adaptive demonstration selection based on distributional matching, refinements in the function class induced during pretraining, and extensions of information-based objectives to other data modalities. Theoretical developments in prompt optimality criteria and automated demonstration selection promise further advances in ICD efficacy.


In-Context Data Distillation encapsulates a multidisciplinary fusion of selective example retrieval, distributional alignment, efficient context representation, regularized distillation, and generative synthesis. It provides a unified paradigm for compact, efficient, and robust model adaptation across diverse data types and learning settings, with ongoing innovation in theory and application.

Forward Email Streamline Icon: https://streamlinehq.com

Follow Topic

Get notified by email when new papers are published related to In-Context Data Distillation (ICD).