The preceding sections described how context-adaptive models are built, explicitly through a structured
We base every metric below on a single straightforward quantity: performance conditioned on context. Let
A single aggregate risk hides exactly the heterogeneity these models exist to capture, so a context-stratified evaluation reports
The efficiency of a context-adaptive method hinges on design choices that trade computational tractability against statistical accuracy, and the same choices govern whether a method scales to large data while remaining interpretable.
One central principle is the use of sparsity assumptions to limit the number of context-dependent parameters. This can be achieved through group sparsity, which encourages entire groups of parameters to be zero simultaneously [@doi:10.1111/j.1467-9868.2005.00532.x], hierarchical regularization that applies different strengths of shrinkage to varying levels of context specificity [@doi:10.1017/CBO9780511790942], and adaptive thresholding that adjusts sparsity levels in accordance with context complexity.
Efficiency can also be enhanced through computational strategies that allocate resources adaptively. Early stopping terminates optimization for contexts where convergence occurs rapidly [@doi:10.48550/arXiv.1606.04838], while context-dependent sampling employs different sampling schemes across contexts [@doi:10.48550/arXiv.1809.09582]. Caching and warm-starting further accelerate optimization by reusing solutions from similar contexts, which is particularly effective when contexts vary smoothly [@doi:10.1561/2200000016]. Related context-dependent computation appears in adaptive batching, per-context learning rates, and multi-fidelity pipelines that allocate compute and precision by context complexity.
To make these gains measurable, let
$$ \mathrm{AE}_k(c) = \mathcal{R}(\hat{f}_0 \mid c)
- \mathcal{R}(\hat{f}_{S_k} \mid c), \qquad \mathrm{AE}k = \mathbb{E}{c}!\left[, \mathrm{AE}_k(c) ,\right], $$
where $\hat{f}0$ is the non-adapted baseline and $\hat{f}{S_k}$ the adapted predictor; the curve $k \mapsto \mathrm{AE}k$ summarizes few-shot adaptation gains across context sizes. A closely related quantity measures how much of this efficiency carries between contexts. For a shared representation $\phi$ transferred from source to target contexts $\mathcal{C}{\mathrm{src}} \to \mathcal{C}_{\mathrm{tgt}}$, the transfer gain is
$$ \mathrm{TG}(\phi) = \mathcal{R}{\mathcal{C}{\mathrm{tgt}}}!\big(\hat{f}_{\mathrm{scratch}}\big)
- \mathcal{R}{\mathcal{C}{\mathrm{tgt}}}!\big(\hat{f}_{\phi}\big), $$
the risk reduction from transferring
These gains are ultimately bounded by how much data each context supplies. Let contexts lie in a metric space
for a kernel
solves
Under local Lipschitzness in
where
where
Both explicit and implicit models adapt by choosing which parameters or which experts govern the prediction. Explicit models make this decision overtly, through the partitions or context encoders that map context to model parameters. Implicit models make the same decision internally, through the gating of a mixture of experts or the attention weights of a transformer. In either case the decision is a function of context, and the stability of this function plays a key role in generalization: small perturbations of the context should not cause erratic changes in which behavior is selected, or predictions become unpredictable near routing boundaries.
Instability is easiest to see at the boundaries. A partition model can flip a sample between adjacent leaves under a negligible change in a splitting variable, and an in-context learner can change its answer under a reordering or reformatting of the same prompt examples, a sensitivity documented for in-context learning where the distribution and arrangement of examples can matter more than their content [@doi:10.48550/arXiv.2202.12837]. In sparse expert models routing instability can cause experts to collapse or remain underused, undermining reliability [@doi:10.48550/arXiv.2406.18219]. Reporting routing stability therefore means probing the model with perturbations that should be behavior-preserving, such as reordering exchangeable examples, jittering a continuous context near a learned split, or relabeling an equivalent measurement policy, and measuring how much the selected behavior and the resulting prediction move. Smoothly routed models degrade gracefully across these perturbations while sharply partitioned or brittle ones do not. The difference is a design choice as much as a diagnostic.
This admits a single measure across both discrete and continuous perturbations. Let
with a supremum over
The final major evaluation type asks whether adaptation still helps when the context distribution at test time differs from training. Context shift takes many forms, including new subpopulations, drifting covariates, and unseen measurement policies. For explicit models it is easiest to make concrete when context is the pattern of observed measurements, since the deployment environment routinely presents measurement policies that were rare or absent during training; we use missingness-as-context as the running example (i.e. input dropout). Evaluation of missingness-as-context models should report mask-stratified metrics, including worst-group performance, following group-robust evaluation practice [@doi:10.48550/arXiv.1911.08731; @doi:10.48550/arXiv.2012.07421]. Robustness should be probed with mask-shift stress tests, training under one measurement policy and testing under another, to quantify degradation and the benefit of contextualization, as formalized in the Domain Adaptation under Missingness Shift (DAMS) setting [@doi:10.48550/arXiv.2211.02093; @doi:10.48550/arXiv.2012.07421]. When imputation is used, authors should assess imputation realism by holding out observed entries under realistic mask distributions and reporting MAE/RMSE and calibration for
Implicit models face the same issue in a different form. In-context learning adapts within a single forward pass, but that adaptation is opaque and can be brittle: performance is sensitive to small changes in the prompt, and reliability under distribution shift is hard to guarantee or to audit. Recent surveys frame the open questions as developing a more complete theoretical account of when in-context learning fails, improving its reliability, and establishing methods for controlling its behavior in high-stakes applications [@doi:10.48550/arXiv.2301.00234]. The evaluation logic carries over from the explicit case: stratify performance by the kind of context, stress-test under context shift, and ablate the adaptive signal to confirm that the model is using context as intended rather than exploiting an artifact. From this perspective, the mask-shift stress test for an explicit model and the prompt-perturbation test for an in-context learner are the same experiment applied to two realizations of
The degradation these tests reveal can be summarized in a single score. Let
$$ \mathrm{RS}(\hat{f}; Q) = \sup_{\widetilde{\mathcal{D}}\in Q} \left[ \mathcal{R}_{\widetilde{\mathcal{D}}}(\hat{f})
- \mathcal{R}{\mathcal{D}{\mathrm{test}}}(\hat{f}) \right] $$
reports the worst-case excess risk over that family, with higher values indicating greater sensitivity to contextual change.