Source-linked AI summary

Specialization after Generalization: Towards Understanding Test-Time Training in Foundation Models

Jonas Hübotter, Patrik Wolf, Alexander Shevchenko, Dennis Jüni, Andreas Krause, Gil Kur

arXiv:2509.24510v4cs.LGcs.AI

TL;DR

The paper asks why and when test-time training (TTT) can help when foundation-model test data is in-distribution. It analyzes TTT under the linear representation hypothesis and finds its largest gains in the underparameterized regime, where specialization can focus capacity on concepts relevant to the test task.

  • Problem

    The effectiveness of TTT is not well understood, especially as foundation models make most test data effectively in-distribution.

    Source: §1 · p. 1
  • Method

    The paper models TTT under the linear representation hypothesis and studies its behavior with sparse autoencoders and scaling analyses across vision and language tasks.

    Source: §6 · pp. 9–10
  • Results

    TTT yields its largest gains in the underparameterized regime, and the paper's sparse-autoencoder findings support local neighborhoods being represented by few concepts.

    Source: §6 · p. 10
  • Takeaways & Limitations

    TTT can specialize after generalization by reallocating capacity toward concepts relevant to the immediate test task.

    Source: §6 · p. 9

    The theoretical analysis considers univariate regression under the linear representation hypothesis, with an underparameterized learned feature map.

    Source: §5 · p. 8

Abstract

from arXiv · show

Recent empirical studies have explored the idea of continuing to train a model at test-time for a given task, known as test-time training (TTT), and have found it to yield significant performance improvements. However, there is limited understanding of why and when TTT is effective. Earlier explanations mostly focused on the observation that TTT may help when applied to out-of-distribution adaptation or used with privileged data. However, the growing scale of foundation models with most test data being in-distribution questions these explanations. We instead posit that foundation models remain globally underparameterized, with TTT providing a mechanism for specialization after generalization, focusing capacity on concepts relevant to the test task. Specifically, under the linear representation hypothesis, we propose a model in which TTT achieves a substantially smaller in-distribution test error than global training. We empirically validate our model's key assumptions by training a sparse autoencoder on ImageNet, showing that semantically related data points are explained by only a few shared concepts. Finally, we perform scaling studies across image and language tasks that confirm the practical implications of our model, identifying the regimes where specialization is most effective.

1 INTRODUCTION

The introduction asks whether test-time training (TTT) can improve predictions on in-distribution data using data already seen during pretraining. It proposes that globally underparameterized foundation models can specialize after generalization, and reports that TTT helps most in the underparameterized regime.

1 INTRODUCTION

  • The paper frames its motivation around whether TTT can help on in-distribution test data using only previously seen data.The introduction notes that most test data for larger foundation models is effectively in-distribution.Source: §1 · p. 1
  • TTT can specialize a model near a test example by temporarily forgetting irrelevant pre-trained knowledge and reallocating capacity to locally relevant concepts.The introduction calls this mechanism specialization after generalization and connects it to capacity saturation and interference in continual learning.Source: §1 · p. 2
  • The LRH treats high-level concepts as latent-space directions, with sparse concept activations and task-specific linear coefficients defining their meaning.Because real-world concepts outnumber model dimensions, the concepts are superimposed in dense activations.Source: §1 · p. 2
  • TTT improves accuracy in image classification and language modeling before test loss saturates with model size, with gains diminishing as models become overparameterized.The analysis keeps learned features fixed and updates only last-layer weights.Source: §1 · p. 2
  • Under the linear representation hypothesis, TTT can adjust coefficients for a few concepts relevant to the test task, while a globally underparameterized model cannot disentangle all superimposed concepts.The feature space is assumed to be much smaller than the sparse concept space; the introduction describes the dimensional relation as d2 ∼ log d1.Source: §1 · p. 2

2 RELATED WORK

The related-work section situates TTT among test-time adaptation methods and contrasts this paper's sparse-concept account with prior analyses. It also describes sparse autoencoders as a tool for studying concept directions in model activations.

2 RELATED WORK

  • Prior TTT work spans supervised and reinforcement-learning settings, with applications including control, reasoning, language modeling, and video generation.Some methods select pretraining data for imitation without adding privileged information.Source: §2 · p. 3
  • This work analyzes semi-parametric TTT: fine-tuning a pretrained model with supervised loss on a small training-data neighborhood of the test point.Unlike adaptation methods commonly applied under distribution shift, its framework models an underlying sparse concept space rather than relying on feature-space smoothness.Source: §2 · p. 3
  • Sparse autoencoders reconstruct foundation-model activations from sparse overcomplete features, often yielding features aligned with interpretable concepts.The paper presents them as an empirical means of uncovering the sparse concept space assumed by the LRH.Source: §2 · p. 3

3 How DOES SPECIALIZATION BEHAVE?

The section uses a sparse autoencoder to study how test-time training behaves in an estimated concept space. On ImageNet, its findings indicate that local neighborhoods can be explained by few concepts, and that feature-space TTT behaves similarly to sparse concept-space TTT.

3.1 EXPERIMENTAL SETUP

  • To approximate the inaccessible concept space, the authors train a top-k SAE on ImageNet CLIP embeddings and analyze its reconstructions.The embeddings have dimension 512; the SAE uses 4096 sparse dimensions with sparsity level 16. TTT uses each test point's 50 nearest training neighbors to train a local linear classifier.Source: §3 · p. 3, §3.1 · pp. 3–4

3.2 RESULTS

  • Average cosine-similarity distributions in concept space are nearly identical across neighborhoods selected in CLIP, reconstructed, and concept spaces.This supports the observation that the SAE projection preserves local geometry.Source: §3.2 · p. 4, Figure 2 · p. 4
  • For each neighborhood, the O2 experiment learns a binary mask over concept vectors to test whether a small concept subset captures the relevant local information.The learned mask activates substantially fewer concepts than the unique active concepts across the neighborhood while retaining parity with dense-reconstruction TTT.Source: §3.2 · pp. 4–5
  • ≈40 concepts are activated on average versus approximately 180 unique active neighborhood concepts, yet sparse-mask TTT performs on par with dense-reconstruction TTT.The comparison is reported in Table 1's TTT column.Source: Table 1 · p. 5, §3.2 · p. 5
  • ≈89% prediction agreement between dense-reconstruction and sparse-concept TTT suggests the two learn functionally equivalent classifiers, apart from pathological examples.Their top-10 predictive distributions are also closely matched.Source: §3.2 · p. 5

4 When DOES SPECIALIZATION HELP?

Across image and language tasks, TTT improves over global training, with the largest gains in underparameterized models; its local improvements depend on the test neighborhood. The section examines how these results vary with model size, dataset size, and neighborhood size.

4 When DOES SPECIALIZATION HELP?

  • The section investigates when specialization through TTT improves over a globally trained model, building on the paper’s preceding mechanistic analysis.The following section relates the empirical results to theoretical support based on the linear representation hypothesis and observations O1–O3.Source: §4 · p. 5

4.2 RESULTS

  • Across image and language tasks, TTT outperforms global training and majority vote, with its advantage shrinking as model size increases.The authors hypothesize that larger models reduce concept interference, while local adaptation can compensate for limited capacity.Source: Figure 4 · p. 6, §4.2 · p. 7

4.1 SETTINGS

  • The experiments cover last-layer adaptation on MNIST and ImageNet and LoRA-based adaptation for language modeling on the Pile.MNIST uses a LeNet-5 classifier; ImageNet uses CLIP ViT-B/32 embeddings; the Pile experiments use Qwen2.5 base models.Source: §4.1 · p. 6

4.2 RESULTS

  • TTT consistently outperforms global training as MNIST and ImageNet dataset sizes vary, with a slight trend toward a wider gap on larger datasets.The authors hypothesize that larger datasets provide richer neighborhoods for adapting to concepts relevant to each test point.Source: §4.2 · p. 7, Figure 5 · p. 7
  • TTT heads improve accuracy on their test points and neighborhoods, but applying those same heads globally yields significantly lower accuracy than global training.The ImageNet neighborhood-size study finds an optimum that trades off locality against diversity.Source: §4.2 · p. 7, Table 2 · p. 8

5 Why MAY SPECIALIZATION HELP?

The analysis models TTT under the linear representation hypothesis: a lower-dimensional learned feature space can encode many concepts, but global prediction may not disentangle them. Under stated assumptions, TTT can learn locally from few examples, while global-model error rises with underparameterization.

5 Why MAY SPECIALIZATION HELP?

  • The linear representation hypothesis models outputs as linear combinations of sparse high-dimensional concepts represented through a lower-dimensional learned feature map.The analysis argues that superimposed concepts can make global mapping difficult, while TTT can learn the meaning of concepts relevant to local test data.Source: §5 · p. 8, §5.1 · p. 8

5.1 ANALYZING THE IN-DISTRIBUTION TEST ERROR OF TTT

  • The analysis assumes learned-feature neighborhoods preserve concept-space geometry, local neighborhoods admit sparse concept predictors, and TTT implicitly favors sparse concept-space solutions.The neighborhood must be sufficiently small for the sparse-local approximation to hold.Source: §5.1 · pp. 8–9
  • Under the stated hypotheses and sufficient feature expressivity, TTT can locally learn a function from few samples that activate concepts similar to the test point.The proposition assumes a sufficiently small neighborhood and standard sparse-recovery regularity conditions.Source: §5.1 · p. 9
  • In a constructed random-projection instance, global-model error increases as feature dimension shrinks or the number of distinct concepts grows, approaching 1 in either limit.When feature and concept dimensions match, global-training error is zero; the example illustrates difficulty globally disentangling superimposed concepts.Source: §5.1 · p. 9

6 CONCLUSION

The conclusion presents specialization after generalization as a framework for understanding TTT on in-distribution data, supported by empirical findings and theoretical analysis. It identifies convergence conditions and open questions for future work.

6 CONCLUSION

  • The paper frames TTT as temporarily reallocating capacity to concepts relevant to the immediate test task and formalizes this intuition under the linear representation hypothesis.Sparse autoencoder findings support sparse local concept neighborhoods and sparse solutions, while scaling studies find the largest TTT gains in underparameterized regimes.Source: §6 · pp. 9–10
  • TTT may converge slowly or not at all when label noise is large or any of the three hypotheses is violated.The neighborhood size must also be sufficiently small for the sparse-neighborhood hypothesis to hold.Source: §6 · p. 9
  • Open questions include what determines optimal neighborhood size, when TTT becomes compute-efficient, and whether the framework extends beyond supervised learning to online reinforcement learning.The paper also connects specialization to online learning, where increasingly specialized experience may require ever-larger models to fit globally.Source: §6 · p. 10

A.1 LIMITATIONS OF GLOBAL LEARNING UNDER THE LRH

Under the linear representation hypothesis, sparse concept-space functions can be difficult for global low-degree learning, while TTT specializes a local parametric model to handle superimposed concepts. The formal analysis bounds TTT’s prediction error under assumptions on local simplicity, learned features, and noise.

A.1 LIMITATIONS OF GLOBAL LEARNING UNDER THE LRH

  • Under LRH, global classification requires a quasi-polynomial number of samples in the sparse concept-space dimension within the low-degree polynomial framework.For s ≍ 1 and polynomial k, the bound is sharp under the low-degree polynomial conjecture for certain algorithm classes.Source: §A.1 · pp. 16–17
  • When s ≍ 1 and k is polynomial in d, functions concentrate at high Hermite frequencies, and low-degree approximation smooths decision boundaries that are difficult to learn.The passage attributes the resulting sample burden to overlap between distorted boundaries, where most samples fall.Source: §A.1 · p. 17

A.2 TTT VS. NON-PARAMETRIC METHODS

  • TTT’s local parametric optimization can disentangle superimposed features through sparse recovery, whereas neighborhood averaging cannot resolve labels in ambiguous, non-smooth feature-space neighborhoods.The comparison is with non-parametric methods that rely on local smoothness or constancy.Source: §A.2 · pp. 17–18

B FORMAL ASSUMPTIONS

  • The formal analysis assumes locally simple targets and locally linear, sufficiently expressive learned features, alongside bounded concepts, a linear noisy model, and a generalized restricted eigenvalue condition.The representation assumption requires the feature map to preserve enough local structure for small representation error.Source: B FORMAL ASSUMPTIONS · pp. 18–19
  • Under the stated assumptions, TTT’s prediction error includes inherent and neighborhood misspecification, while its estimation error achieves an eO(s/k) rate.The bound trades variance, which decreases with neighborhood size k, against bias from neighborhood approximation; dependence on the total concept count d1 is logarithmic.Source: B FORMAL ASSUMPTIONS · p. 19

C.1 PROOF OF PROPOSITION 3

  • With probability at least 1 − δ, the proposition bounds squared prediction error, with squared estimation error achieving rate eO(s/k).The proof obtains concentration bounds for sparse noise and for correlations between misspecification and sparse concept vectors.Source: §C.1 · p. 20, §C.2 · pp. 21–22

C.3 INSUFFICIENCY OF GLOBAL TRAINING

A randomized superposition construction makes each neighborhood locally simple while forcing a single underparameterized global model to compromise across neighborhoods. In that construction, TTT can still learn the ground truth perfectly, even with a feature dimension exponentially smaller than the number of concepts.

  • The input space is partitioned into M = d1 disjoint neighborhoods of equal probability 1/d1; on each, Φ(x) = em is 1-sparse, labels are noiseless y = 1, and the local target is wm = em.Source: §C.3 · p. 23
  • With zero misspecification, TTT is consistent and can learn the ground truth perfectly even when feature dimension is exponentially smaller than concept count.The construction satisfies the stated assumptions with ηmis = 0.Source: §C.3 · p. 23
  • In the construction, superimposed, non-orthogonal features make global fitting across neighborhoods interfere, forcing a compromise whose error rises as feature dimension shrinks or concept count grows.When feature and concept dimensions are equal, global-training error is zero.Source: §C.3 · p. 24

C.4 HARDNESS OF GLOBAL LEARNING UNDER THE LRH: MAIN PROPOSITION AND PROOF

The theoretical analysis establishes sample-complexity hardness for global learning under LRH in specified algorithmic frameworks. Additional scaling results show that TTT outperforms global training as feature dimension varies, with the gap narrowing as models grow.

C.4 HARDNESS OF GLOBAL LEARNING UNDER THE LRH: MAIN PROPOSITION AND PROOF

  • Under the low-degree polynomial conjecture, algorithms relying on SQ and LDP frameworks require n ≳ exp(Ω((log d)^2)) samples for the stated learning problem.The passage also states a polynomial-sample lower bound without that conjecture, but the wording of its sample variable is ambiguous.Source: §C.4 · p. 26

D.1 SCALING WITH FEATURE DIMENSION

  • Across model widths, TTT consistently outperforms global training and majority vote, while its performance gap over global training narrows as hidden dimension increases.Figure 6 reports classification error rates as a function of feature dimension.Source: §D.1 · p. 27, Figure 6 · p. 27

D.2 END-TO-END TEST-TIME TRAINING

The MNIST experiment compares last-layer and end-to-end TTT, with the globally trained model as baseline. The two TTT variants produce nearly identical error rates.

  • End-to-end TTT fine-tunes all model weights after selecting neighbors using L2 distance in the pre-trained model’s last-hidden-layer representations.The comparison follows the last-layer TTT setup, which freezes all but the classification head; the image-task experiments use that approach as a cost-performance trade-off.Source: §D.2 · pp. 27–28
  • On MNIST, last-layer and end-to-end TTT yield nearly identical error rates against the globally trained baseline.Figure 7 reports classification error rates across model widths.Source: Figure 7 · p. 28

E ADDITIONAL ABLATIONS

TTT’s cross-entropy effect depends on which test points are considered: its average loss can be higher than the global model’s, but lower on points predictable by either model. The section also describes calibrating sparse concept probabilities to the dense distribution and measuring their remaining discrepancy.

E ADDITIONAL ABLATIONS

  • On points where either model predicts correctly, TTT lowers cross-entropy versus the global model, although its average test-sample cross-entropy is higher.The figure attributes the higher loss to noisy labels not predictable by the base model.Source: Figure 8 · p. 28, E ADDITIONAL ABLATIONS · p. 28

F.1 COMPARISON OF LOGITS (FIGURE 3)

  • The sample-specific temperature is chosen to minimize KL divergence between calibrated sparse concept probabilities and the dense distribution.The reported temperature averages around 0.8 with standard deviation around 0.1, indicating a slightly sharper dense predictive distribution.Source: §F.1 · p. 29
  • Relative total variation compares calibrated sparse and dense probabilities, normalizing their absolute difference by the average magnitude of both probabilities for robustness to noise.The metric is defined separately at each of the top ten positions.Source: §F.1 · p. 29

F.2 SAE ON MNIST DATA

These appendices detail sparse-autoencoder experiments and scaling protocols across MNIST, ImageNet, and language modeling. They report MNIST results for masked SAE TTT and MoE specialization, alongside experimental setups and baselines for broader scaling studies.

F.2 SAE ON MNIST DATA

  • The MNIST SAE uses a LeNet-like convolutional encoder and linear decoder, reconstructing images from sparse concept vectors.The concept vector has dimension 1,024, and sparsity is enforced using thresholding and an L0 penalty.Source: §F.2 · pp. 29–30
  • LeNet CNN TTT: 97.62; Masked SAE TTT: 97.72.The section presents these as the resulting accuracies for the MNIST SAE setup.Source: §F.2 · p. 30
  • Reported quantities are Ex|mx⋆∩m| ≈ 7.9 and Ex|∪i(mi∩m)| ≈ 7.1; restricting m to test-point/neighbor-shared indices fails on more complex datasets, where slack components are necessary.Source: §F.2 · p. 30

F.3 SAE ON IMAGENET CLIP EMBEDDINGS

  • ImageNet top-k SAE training uses learning-rate warm-up to prevent inactive neurons and ghost gradients to give learning signal to features outside the active top-k.Ghost gradients target units that are almost inactive during training.Source: §F.3 · pp. 30–31

F.4 SCALING EXPERIMENTS ON MNIST

  • MNIST model scaling compares TTT and majority voting across five seeds; dataset scaling uses class-balanced subsamples and TTT over 80 nearest neighbors.Confidence intervals were computed using 200 bootstrap iterations per seed.Source: §F.4 · pp. 31–32

F.5 CONNECTION TO MOES

  • Increasing the number of MoE experts improves MNIST accuracy, approaching TTT performance with inference cost comparable to the global classifier.The experts are linear heads, and the figure compares the global classifier, TTT, and MoE.Source: §F.5 · p. 32, Figure 9 · p. 32

F.6 SCALING EXPERIMENTS ON IMAGENET

  • The ImageNet linear classifier on normalized 512-dimensional CLIP embeddings reaches 78.33% accuracy; TTT fine-tunes on 600 neighbors, while MLP hidden dimensions and neighbor-voting baselines are also varied.The reported baseline uses a linear head over 1,000 ImageNet classes.Source: §F.6 · pp. 33–34

F.7 SCALING EXPERIMENTS FOR LANGUAGE MODELING

  • Language-modeling experiments evaluate Qwen2.5 base models on the Pile, processing neighborhood sequences sequentially and splitting sequences that exceed the maximum length.A split neighbor can produce multiple gradient steps during TTT.Source: §F.7 · p. 34, Table 10 · p. 35
Loading 2509.24510v4…