Skip to content

Long-Context Demonstration Selection Using State Space Models

Sep 2026 · 0 citations · 31 references
Computer Science

TL;DR

This paper focuses on the problem of demonstration selection, which involves selecting a subset of examples for prepending to a query to a language model, and builds on state space models (SSMs), which require only linear inference time given the input.

Abstract

We study the problem of demonstration selection, which involves selecting a subset of examples for prepending to a query to a language model. This problem is closely related to in-context learning and language model inference. Since the inference cost of a transformer model scales quadratically with sequence length, the selection problem becomes especially challenging in a long-context scenario. In this paper, we tackle this problem by building on state space models (SSMs), which require only linear inference time given the input. Our approach involves two algorithms. The first learns a small set of SSMs through distillation of a (trained) transformer model. We partition all the layers into consecutive groups. Then for each group, we estimate a separate state space model to replicate the input-output behavior within the adjacent layers. Second, we map the distilled model outputs to a small set of tokens, and apply these embeddings for demonstration selection in downstream applications. We perform extensive experiments in both synthetic and real-world datasets to validate our approach. We demonstrate that the distilled SSMs only incur an approximation error of less than $0.7\%$ relative to the true output. In downstream evaluation, we show that on several text classification and reasoning tasks, our approach reduces FLOPs by $14.2\times$ and improves accuracy by $6.48\%$ relative to baseline demonstration selection methods.

View source

Similar papers

#artificial intelligence Preprint Sep 2026

Few-Shot Demonstrations Elicit the Use of In-Context World Representations in LLMs

Large language models (LLMs), when acting as agents, are expected to take observed data in context, infer the latent state space underlying the world, and leverage it for downstream prediction. However, prior work demonstrated that LLMs struggle to use representations learned in context on a graph tracking task, where...

Kohsei Matsutani, Gouki Minegishi, C. Park et al. · 0 citations
#machine learning Preprint Sep 2026

You Only Edit Once: Incentivizing In-Context Capability of LLMs via Local Demonstration Refinement

In-context learning (ICL) is crucial for boosting the inference performance of large language models (LLMs). However, the effectiveness of ICL in LLMs is greatly influenced by the choice of demonstration sets. Exhaustive searches over these sets are combinatorial, and existing selectors often rely on relevance or likel...

Jia-Rong Wen, Qi Wang, Yun Qu et al. · 0 citations
Conference Open access Sep 2026

Performance-Driven Demonstration Selection for In-Context Learning

Performance-Driven Demonstration Selection (PDDS), which directly aligns demonstration selection with ICL performance, is proposed, which formulates selection as predicting the target LLM’s downstream task performance for a given query–in-context pair, replacing proxy heuristics with a performance-aware objec-tive.

Wen-Qiang Wang, Ming-Bo Yang, Ai-Ping Zhang et al. · 0 citations
#machine learning Preprint Sep 2026

Data Efficient Sample Selection for In-Context Learning

DearICL (Data Efficient Algorithm for Ranking) ICL samples, a new framework that models demonstration example selection as a subset ranking problem, achieves 8.08-15.9% accuracy gains over strong linear bandit baselines, with low sample complexity.

V. Venktesh, Cem Levi, Avishek Anand · 0 citations
#machine learning Preprint Oct 2026

Fisher-Guided Submodular Data Selection for Continual Pre-Training of Large Language Models

Data selection is already a central bottleneck in large-language-model training, where web-scale corpora are noisy and token budgets are finite. In continual pre-training (CPT), it becomes a forgetting-control problem: a poorly chosen target-domain corpus can overwrite capabilities encoded in the pretrained checkpoint....

Zheng-Hao Zhao, Gao-Wen Liu, Zhi-Ling Lan et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Oct 15, 2026

AI model decodes the language cells use to communicate

A new computational approach reveals how cells communicate to assemble into tissues. This could accelerate stem cell engineering, improve disease models, and inform therapies.

Microsoft Research Blog Oct 15, 2026

Proof-based general-purpose computing with Magnetar

Zero-knowledge proofs can verify computing results without rerunning workloads or exposing sensitive data. Magnetar helps bring them into the mainstream with support for standard programming languages, major speed gains, and quantum-resistant security. The post Proof-based general-purpose computing with Magnetar appeared first on Microsoft Research.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.