A model deployed on a stream of shifting data, such as a camera that moves from fog to night to snow and back, usually adapts and then forgets. Methods for continual test-time adaptation update a model on unlabeled test data while it runs. They protect against drift by pulling the weights back toward the original model, which means every return of a familiar condition is handled almost from scratch. Innate immune cells behave differently. After a transient insult, a subset of long-lived cells keeps a stable epigenetic "scar" (a lasting change in which genes are easy to switch on). Another subset returns cleanly to baseline. The scarred cells respond faster to the next challenge, including challenges that differ from the first. That memory is costly, so the body cannot keep one for everything.
We propose to build the machine analogue and to make its central design choice follow diversification theory. The model keeps a clean compartment that is always reset toward the source model. Beside it sits a small, fixed-size bank of "trained" adapter snapshots taken after past shifts. The bank's contents are chosen to maximize how well the best stored snapshot will handle a future shift. Under a tight budget, that objective favors snapshots whose behavior is weakly correlated with one another, the way good portfolios hold weakly correlated assets. The claim is concrete. When the memory budget is smaller than the number of distinct shifts, a bank curated for decorrelated coverage recovers faster on recurring shifts and generalizes better to unseen related shifts than banks curated by recency or by individual quality. It also matches or beats the strongest filtering-based adaptation method on standard corrupted-image streams.
Core Claim
The biology supplies the architecture. The portfolio literature supplies the rule for what to remember.
On the biology side, Zeng et al. show that after TNFα or LPS stress, human blood stem cells split into two groups. One subset (HSC-I) resets. Another (HSC-iM) keeps heritable changes in chromatin accessibility and gene expression. The same paper documents the cost of that memory: median engraftment falls to about 21–29% in dual-challenged xenografts versus about 56% in controls. Su et al. show how such a scar is locked in metabolically: β-glucan suppresses IDH3α, which leaves activating histone marks in place at inflammatory genes. Qi et al. show that BCG-induced methylation changes drive heterologous responses, meaning stronger reactions to challenges other than the original one. We take three things from this work. We use a two-compartment split (reset versus retain), treat memory as a scarce resource, and measure success partly by transfer to shifts the system has not seen.
On the portfolio side, Drygala et al. choose $k$ solutions to maximize the expected value of the best one under uncertainty, and anti-concentration is what drives their guarantee. That is exactly the right objective for a memory bank used by retrieval, because only the best stored snapshot is used for any given shift. Let $\mathcal{M}$ be the pool of candidate snapshots, $S\subseteq\mathcal{M}$ the retained bank with $|S|\le K$, $d$ a future shift drawn from the distribution of shifts seen so far, and $u(m,d)$ the negative prediction entropy of snapshot $m$ on unlabeled data from $d$. The bank should solve
$$\max_{|S|\le K}\; \mathbb{E}_{d}\Big[\max_{m\in S} u(m,d)\Big].$$
With a finite buffer of past shift probes, this is a monotone submodular coverage objective, so greedy selection achieves a $(1-1/e)$ approximation. Drygala et al. show that this constant cannot be beaten in general under correlated distributions, so we do not aim to beat it.
The objective turns redundancy into waste. Two snapshots that succeed on the same shifts add almost nothing over one. This mirrors how correlation-blockmodel clustering keeps a single representative per cluster of interchangeable assets (Asset selection via correlation blockmodel clustering). It also mirrors how AlphaEvolve prunes redundant trading signals to keep pairwise correlation below 15%.
Relation to Prior Work
Continual test-time adaptation motivates the gap and supplies our base learner. Tent adapts only the scale and shift parameters of normalization layers by minimizing prediction entropy. CoTTA adds a moving-average teacher and randomly restores about 1% of weights to their source values at each step. CMF tracks parameters with a Kalman filter anchored to the source model.
All three keep one current model, and each ties it back toward the source rather than toward past adapted states. None of them keeps a structured record of past adapted states. We reuse Tent-style normalization parameters as the thing we snapshot, because they are small enough to store dozens of copies. We keep a CoTTA- or CMF-style anchored learner as the clean compartment.
Second-generation artificial immune systems are the closest bio-inspired prior art. The libtissue architecture and the process-anomaly work gate a pattern-matching detector with a separate "danger" stream of environmental distress signals. Their innate layer is stateless and resets once the signal subsides. We keep only the gating idea: a stored memory is used only when it beats the clean compartment on the current batch. We add what they lack, which is persistent memory and a principled rule for choosing it.
The network-periphery results constrain how we measure correlation. Topological Portfolio Selection and Optimization finds that bootstrapping before building the correlation network is needed to avoid spurious links. For that reason we estimate snapshot correlations with bootstrapped probe batches rather than single-batch statistics.
Research Program
We will build the system first. The clean compartment is CMF (or CoTTA for convolutional backbones), running unchanged. A shift detector watches for a jump in the entropy of the clean model's predictions, which serves as the danger signal. When a shift has been absorbed, meaning entropy has fallen and stabilized, the system copies the current normalization parameters as a candidate memory. It also stores a small probe of unlabeled inputs from that period, a few hundred images of downsampled features.
The utility table $u(m,d)$ is filled by evaluating each candidate on each probe. Whenever the bank exceeds $K$, the greedy objective above decides what to evict. At inference, each incoming batch is scored by the clean model and by the best-matching stored snapshot. The snapshot is used, and then fine-tuned further, only if it lowers entropy by a margin. Otherwise the clean model proceeds. This gate is the guard against the machine version of maladaptive training, where a scar makes the response worse.
Second, we will study the architecture in two ways. We will vary $K$ relative to the number of distinct shifts, and we will vary how strongly shifts cluster. This lets us map where decorrelated selection matters and where it does not. We also want to know whether output-space correlation (agreement across probes) or parameter-space distance is the right similarity. The periphery results suggest behavior matters more than position, which favors output space.
Baselines
The naive reference is the unadapted source model. CMF reports 60.2% average error on ImageNet-C with a Vision Transformer for this reference.
The strongest existing method is CMF itself, which reports 49.0% average error on ImageNet-C with a Vision Transformer, against 55.1% for Tent in the same setting. It is the strongest competitor because it already addresses the stability-plasticity trade-off with a principled filter and reports the best continual numbers in our file. We also run CoTTA. It reports 16.2% average error on CIFAR10-C, 32.5% on CIFAR100-C, and 58.6 mIoU on Cityscapes-to-ACDC across repeated cycles, which is the recurring-shift setting most relevant here. Tent's 44.0% on ImageNet-C comes from its original, non-continual protocol and is not directly comparable. We will rerun Tent-continual under our stream.
Every method runs on the same backbones, stream orderings, and random seeds. Each gets an equal hyperparameter search budget tuned on a held-out corruption ordering. Our method sits on top of CMF with no retuning of CMF itself. Beating CMF means lower average error across the whole stream. It also means a clear advantage on the first batches after each recurring shift, with no loss on first-time shifts.
The ablations isolate the key ingredient. They use the same bank and gate but select contents by recency (first in, first out), by individual quality (keep the $K$ lowest-entropy snapshots), at random, or without limit ($K=\infty$). A further ablation removes the clean compartment, so the model always starts from the best memory. The recency and individual-quality banks are the real tests. If decorrelated selection does not beat them at small $K$, the portfolio component adds nothing.
Why not just…?
Why not just keep every snapshot? An unbounded bank is the upper reference in our ablations, and with few shifts it may match us. Retrieval cost and false-match risk both grow with bank size, though. The biological evidence (Zeng et al.) suggests that indiscriminate memory is costly, and deployed systems face the same constraint in memory and latency. We will report error as a function of $K$. The claim holds only if a small curated bank gets within a small margin of the unbounded one while beating other banks of the same size.
Why not just keep the most recent or the individually best snapshots? This is the real threat. If shifts recur in a simple cycle, recency may be enough. If shifts are unclustered, quality-based and decorrelated selection coincide. The portfolio evidence points the other way when components cluster. Correlation-blockmodel selection beats k-medoids and sector-based choices, and peripheral selection beats holding central, redundant assets. ImageNet-C's corruptions fall into families (noise, blur, weather, digital), so a quality-ranked bank may fill up with, for example, three noise snapshots. The decisive experiment below is designed so this alternative can win if it deserves to.
Why not just improve the single-model filter, for example by slowing CMF's decay toward the source? A slower anchor keeps more of the recent past but can hold only one blended state. It cannot hold fog and snow as separate responses. We will sweep CMF's transition strength and report its best setting as the baseline, so any gain we show is not a tuning artifact.
Proposed Experiments
The main stream cycles ImageNet-C's 15 corruptions at severity 5 for ten rounds in shuffled orders. We use the Vision Transformer setting from CMF, with CIFAR10-C and CIFAR100-C as smaller replicates and Cityscapes-to-ACDC as a segmentation replicate that has natural recurrence. The metrics are average error over the stream, error over the first 10 batches after each recurrence (recall speed), and memory and compute overhead. The budget $K$ ranges from 2 to 15.
The decisive check is family structure. At $K=4$, decorrelated selection should retain roughly one snapshot per corruption family, which we can read off directly from the bank contents. It should also beat the recency and individual-quality banks on recall error. If it does not, the portfolio claim fails.
The heterologous check withholds one entire family from the stream and introduces it only in the final round. A bank that covers the other families should adapt to the new one faster than the clean compartment alone, in the way BCG-trained responses carry over to unrelated challenges (Qi et al.).
The safety check measures how often the gate chooses a stored snapshot that turns out worse than the clean model under true labels, used offline for analysis only. Removing the clean compartment should raise this rate, which would confirm that the reset half of the dual-compartment design is doing real work.
References
- Identification of a human hematopoietic stem cell subset that retains memory of inflammatory stress
- miR–9-5p regulates immunometabolic and epigenetic pathways in β-glucan–trained immunity via IDH3α
- Long-term DNA methylation changes mediate heterologous cytokine responses after BCG vaccination
- Data-Driven Solution Portfolios
- Asset selection via correlation blockmodel clustering
- AlphaEvolve: A Learning Framework to Discover Novel Alphas in Quantitative Investment
- Tent: Fully Test-Time Adaptation by Entropy Minimization
- Continual Test-Time Domain Adaptation
- Continual Momentum Filtering on Parameter Space for Online Test-time Adaptation
- libtissue - implementing innate immunity
- Detecting Anomalous Process Behaviour Using Second Generation Artificial Immune Systems
- Topological Portfolio Selection and Optimization