Sparse Adaptation for In-Context Learning on Data Streams

João Neves, Afonso Lourenço, Lizy K. John, Eric P. Xing, João GamaarXiv 2026

TL;DR

Tabular Foundation Models (TFMs) learn on the fly by reading examples in their prompt rather than updating neural weights, making them enticing for fast-moving data streams. However, constantly rebuilding that example prompt as reality shifts is computationally exhausting. This paper introduces SAIL, a "lazy-but-vigilant" framework that freezes the model's memory cache during calm periods and wakes up to compress and refresh its context only when the underlying shape of the data—or the model's error rate—actually changes.

What Problem Does This Paper Address?

Imagine deploying a machine learning model on an IoT edge device drinking from a firehose of sensor data. Enter Tabular Foundation Models (like TabPFN): instead of expensive gradient updates, you hand them a "support set" of labeled examples as context, and they adapt instantly via in-context learning.

In a non-stationary stream where data distributions drift over time ("concept drift"), this creates a painful dilemma:

  • If you accumulate too much history, inference slows to a crawl, and outdated examples poison predictions.
  • If you constantly rebuild a fresh sliding window, recomputing the Transformer's internal Key–Value (KV) cache on every batch burns way too much compute to keep up with real-time arrival rates.
  • If you update too rarely, the model goes stale.

Existing compression and retrieval tricks shrink how much data goes into the prompt, but they don't solve how often you have to reconstruct it. How do we make adaptation genuinely sparse?

Methods

The authors propose SAIL (Sparse Adaptation for In-Context Learning), which decouples routine batch prediction from context rebuilding. During normal operation, SAIL locks the support set and reuses the TFM's KV cache across incoming query batches.

Figure 1: Overview of SAIL. During routine prediction, the TFM reuses its key–value (KV) cache across successive batches. SAIL combines (i) identifies potential context inadequacy by monitoring changes in class-specific micro-cluster mass and feature-space coverage; (ii) reconstructs contexts, allocating the support-set budget proportionally to class mass and selects the most recently updated micro-clusters; (iii) monitors prequential prediction error and uses backtracking to identify reliable instances for updating the micro-clustering representation. Either drift signal triggers TFM adaptation, with a KV cache rebuilt.

Meanwhile, lightweight background trackers process individual observations using three mechanisms:

  1. Online Structural Drift Detection (Novel application): Waiting for prediction errors to spike is reactive; the data's geometry often shifts before accuracy craters. Building on classic streaming clustering (BIRCH/CluStream), SAIL maintains online, class-specific "micro-clusters" whose weights decay exponentially over time. It tracks mass discrepancy ($\Delta_{\text{mass}}$)—measuring how much relative weight has shifted across clusters (including cluster births and deaths) since the last cache build. Cross a threshold, and SAIL triggers a context refresh.
  2. Micro-Cluster Context Compression (Novel selection): Instead of stuffing raw historical rows into the TFM, SAIL allocates a fixed context budget $B$ proportionally to each class's decayed mass. Within each class, it picks the most recently updated micro-clusters and uses their latest real data point as a representative—cutting redundancy while keeping recent structure.
  3. Performance Drift & Backtracking (Standard + twist): Because subtle boundary shifts can hurt accuracy without moving cluster centroids, a standard ADWIN detector monitors prequential classification error. When an alarm sounds, SAIL backtracks to estimate when the new regime started, rebuilds the micro-clusters from clean post-drift instances, and refreshes the KV cache.

Datasets

Rather than relying on arbitrary benchmarks, the authors audited 80 tabular streams across six repositories—USP, OEBench, TabRED, BeyondArena, TableShift, and WhyShift (plus synthetic generators)—profiling them across feature shifts, class-balance shifts, and geometric coverage gaps.

Filtering 80 candidate datasets down to 12 diverse, long-horizon drifting streams.

Filtering out short datasets (<10,000 rows) and trivial stationary streams, they distilled a testbed of 12 diverse, challenging streams (ranging from 24k to 452k instances), including rialto, electricity, covertype, us_accident, several insect drift variants, rbf, tree_recurring, and agrawal.

Key Insights and Ideas

  • Bigger contexts can actively backfire under drift: Expanding a sliding window lowers geometric "coverage gaps," but past a sweet spot, stale regimes inflate feature and class mismatches—driving both latency and error rates up.
  • Update when matters more than how much: Statistical (ANOVA) analysis reveals that how frequently you refit the context has a much stronger grip on error rates than context size, whereas context size heavily dictates inference latency.
  • Catching nascent concepts: Periodic clock-based updates waste compute polishing well-established core clusters late into a stable concept. Mass-discrepancy triggers concentrate refits during structural upheaval—catching newly born micro-clusters as fresh regions of feature space emerge.
  • Tracking mass heals other ills: Even though $\Delta_{\text{mass}}$ only watches cluster weight shifts, triggering on it naturally improves geometric feature coverage and reduces class overlap better than periodic updates—and proves more balanced than triggers explicitly engineered to watch coverage or class conflict alone.

Key Results

  • Massive speedups for pennies of accuracy: Compared to refitting on all post-drift instances (84.5% accuracy, 2,650 median rows, 120 ms/instance), using one representative per micro-cluster cuts context size by 37% and inference time by 54% while losing just 0.8 percentage points (pp) of accuracy.
  • Tighter budgets: Capping the budget at 2,000 micro-clusters slashes context size by 60% and inference time by 80%, limiting the accuracy drop to just 1.0 pp. Aggressive pruning below 800 clusters, however, begins to discard vital predictive signal.
  • Winning the Pareto frontier: Across fixed-budget evaluations ($B=200$), SAIL's combined structural + error triggers consistently achieve higher accuracy (~0.78–0.80) at lower inference cost (6–10 ms/instance) than error-only ADWIN (~0.68–0.70 accuracy) or fixed periodic clocks.

Limitations and Future Work

  • Curse of dimensionality: SAIL relies on Euclidean distances to maintain spherical micro-clusters, which degrades in high-dimensional tabular spaces. The authors point toward online subspace clustering to track relevant feature subsets.
  • Manual knobs & label reliance: Clustering radii, decay rates, and drift thresholds still require tuning, and the current framework assumes true labels arrive promptly to update class-specific clusters and ADWIN.
  • Edge head-to-heads: Future work aims to benchmark SAIL directly against ultra-lightweight classical stream learners—like Hoeffding trees—measuring end-to-end throughput and latency on real edge hardware, alongside exploring unlabeled drift signals.

Summary updated

Abstract

The Internet of Things (IoT) generates massive data streams, making edge computing essential for low-latency applications and 5G networks. Tabular foundation models (TFMs) enable adaptation through in-context examples rather than parameter updates, but evolving streams challenge context relevance and computational efficiency. This work introduces SAIL, a framework for sparse adaptation of TFMs that reuses the model's key--value cache between adaptation events. SAIL reconstructs its support set only when drifts in stream structure indicate potential context inadequacy, while the structural representation itself is updated by changes in predictive performance. SAIL combines prequential error monitoring with online, class-specific micro-clustering to detect changes in cluster mass, class separability, and feature-space coverage. Upon adaptation, a context budget is allocated proportionally to class mass, and the most recently updated micro-clusters provide representative observations for refitting. This limits context redundancy and computational cost while preserving recent structural information.
BibTeX
@misc{neves2026sparse,
  author = {João Neves and Afonso Lourenço and Lizy K. John and Eric P. Xing and João Gama},
  title = {{Sparse Adaptation for In-Context Learning on Data Streams}},
  year = {2026},
  eprint = {2611.33325},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33325},
}
Figure