In-Place Test-Time Training

Guhao Feng, Shengjie Luo, Kai Hua, Ge Zhang, Wenhao Huang, Di He, Tianle Cai

Large Language Models (LLMs) traditionally follow a strict "train then deploy" paradigm. Once deployed, their weights are frozen, restricting their ability to learn from new information to In-Context Learning (ICL). However, ICL is bottlenecked by the model's context window and the quadratic computational complexity of standard attention mechanisms.

Test-Time Training (TTT) offers a compelling alternative by updating a subset of parameters during inference. Yet, its adoption in the current LLM ecosystem has been hindered by three major hurdles:

  1. Architectural Incompatibility: Most TTT methods require specialized layers, making them impossible to "drop in" to existing pre-trained models like LLaMA or Qwen without costly retraining.
  2. Computational Inefficiency: Traditional TTT updates weights token-by-token, which is inherently sequential and slow on modern parallel hardware.
  3. Objective Misalignment: Most TTT methods use a generic "reconstruction" task, which does not directly align with the autoregressive goal of predicting the next token.

To overcome these barriers, researchers have introduced In-Place Test-Time Training (In-Place TTT), a framework that seamlessly endows existing LLMs with dynamic adaptation capabilities, enabling them to handle massive contexts with superior accuracy and negligible computational overhead.

Core Innovations of In-Place TTT

The framework introduces three key mechanisms to solve the limitations of traditional TTT:

1. In-Place MLP Repurposing Instead of designing entirely new layers, In-Place TTT treats the final projection matrix ($W_{down}$) of the standard MLP block as its "fast weights." Because MLPs already function conceptually as key-value memories, making them adaptable allows the model to store transient, document-specific information directly in the weights. This "drop-in" enhancement can be added to any Transformer-based LLM.

Architecture of In-Place TTT

2. LM-Aligned Objective The authors replace the standard reconstruction loss with a tailored, theoretically grounded objective. By utilizing a 1D convolution over input embeddings, they create a target that incorporates future token information. This ensures that the test-time weight updates explicitly improve the model's ability to predict the next token.

3. Chunk-wise Parallel Updates To maintain high throughput, the model processes tokens in chunks (e.g., 512 or 1024 tokens) rather than individually. It uses an "Apply-then-Update" cycle: the model uses its current fast weights to process a chunk, then immediately updates those weights to prepare for the next chunk. Utilizing a parallel scan algorithm makes this method compatible with Context Parallelism (CP) and highly efficient on modern accelerators.

Key Results and Performance

The researchers evaluated In-Place TTT across standard and long-context benchmarks, including the RULER benchmark, Sliding Window Perplexity tests on The Pile, and common sense reasoning tasks (HellaSwag, MMLU, etc.).

Superior Long-Context Performance As a drop-in enhancement for the Qwen3-4B model, In-Place TTT achieved an average accuracy of 77.0% on the RULER 128k benchmark, a massive improvement over the baseline's 66.0%.

RULER Benchmark Results

Effective Extrapolation The framework demonstrated robust extrapolation capabilities. Even when tested on 256k tokens—double its trained context length—the model maintained strong performance, proving the efficacy of the dynamic weight updates for continuous information streams.

Outperforming Specialized Architectures When trained from scratch at the 500M and 1.5B parameter scales, In-Place TTT consistently achieved lower perplexity than competitive TTT-related approaches like GLA, DeltaNet, and LaCT. Furthermore, efficiency analyses showed that In-Place TTT introduces almost no penalty to prefill throughput or peak memory usage compared to standard models.

Limitations and Future Directions

While In-Place TTT represents a significant step toward continual learning in LLMs, the authors note a few areas for future exploration:

  • Hyperparameter Sensitivity: Performance is influenced by the "state size" (the number of TTT-enabled layers) and the chunk size. Finding the optimal balance across different model scales requires further tuning.
  • Optimizer Exploration: The current implementation relies on a simple gradient descent step for updates. More sophisticated optimizers could potentially yield even better adaptation.
  • Broader Integration: Although focused on standard Transformers, the In-Place TTT mechanism could theoretically be integrated with other efficient architectures, such as State Space Models (SSMs), that also utilize MLP blocks.

Ultimately, In-Place TTT successfully bridges the gap between static pre-training and dynamic real-world application, offering a highly scalable and theoretically sound path forward for long-context language modeling.

Summary updated

BibTeX
@inproceedings{feng2026place,
  author = {Guhao Feng and Shengjie Luo and Kai Hua and Ge Zhang and Wenhao Huang and Di He and Tianle Cai},
  title = {{In-Place Test-Time Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=dTWfCLSoyl},
}
Figure