Test-Time Training on Nearest Neighbors for Large Language Models
Not on the map. Why?
Abstract (arXiv)
Many recent efforts augment language models with retrieval, by adding retrieved data to the input context. For this approach to succeed, the retrieved data must be added at both training and test time. Moreover, as input length grows linearly with the size of retrieved data, cost in computation and memory grows quadratically for modern Transformers. To avoid these complications, we simply fine-tune the model on retrieved data at test time, using its standard training setup. We build a large-scale distributed index based on text embeddings of the Pile dataset. For each test input, our system retrieves its neighbors and fine-tunes the model on their text. Surprisingly, retrieving and training on as few as 20 neighbors, each for only one gradient iteration, drastically improves performance across more than 20 language modeling tasks in the Pile. For example, test-time training with nearest neighbors significantly narrows the performance gap between a small GPT-2 and a GPT-Neo model more than 10 times larger. Sufficient index quality and size, however, are necessary. Our work establishes a first baseline of test-time training for language modeling.
Key facts. Cited by 88 papers in the map (data through 14 Oct 2026). Builds on 19 of its 34 references that are in the map. First posted on arXiv 29 May 2023.
Builds on
19 of 34 references.
References · 19
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
- 2017Billion-scale similarity search with GPUscited by 2,497
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,411
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,141
- 2020Don't Stop Pretraining: Adapt Language Models to Domains and Taskscited by 1,565
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 952
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
- 2022Test-Time Training with Masked Autoencoderscited by 212
7 more
- 2021DEMix Layers: Disentangling Domains for Modular Language Modelingcited by 132
- 2013Learning by Transductioncited by 121
- 2021Efficient Nearest Neighbor Language Modelscited by 93
- 2022Training Data is More Valuable than You Think: A Simple and Effective Method by Retrieving from Training Datacited by 61
- 2022Neuro-Symbolic Language Modeling with Automaton-augmented Retrievalcited by 60
- 2017Dynamic Evaluation of Neural Sequence Modelscited by 55
- 2019Dynamic Evaluation of Transformer Language Modelscited by 23
Built on by
Citing papers per year: 2023: 3; 2024: 10; 2025: 39; 2026: 36.
88 papers.
Sort:
By area:
- 2024Learning to (Learn at Test Time): RNNs with Expressive Hidden Statescited by 355
- 2026Reinforcement Learning via Self-Distillationcited by 332
- 2025TTRL: Test-Time Reinforcement Learningcited by 275
- 2024The Surprising Effectiveness of Test-Time Training for Few-Shot Learningcited by 96
- 2025Retaining by Doing: The Role of On-Policy Data in Mitigating Forgettingcited by 94
- 2025End-to-End Test-Time Training for Long Contextcited by 62
- 2025Test-Time Learning for Large Language Modelscited by 50
- 2025Seek in the Dark: Reasoning via Test-Time Instance-Level Policy Gradient in Latent Spacecited by 43
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoningcited by 40
- 2023Test-Time Training on Video Streamscited by 37
- 2024Frustratingly Easy Test-Time Adaptation of Vision-Language Modelscited by 36
- 2025Self-Improving LLM Agents at Test-Timecited by 30
38 more
- 2025Cognitive Memory in Large Language Modelscited by 29
- 2025How Benchmark Prediction from Fewer Data Misses the Markcited by 28
- 2025Test3R: Learning to Reconstruct 3D at Test Timecited by 20
- 2025Let's (not) just put things in Context: Test-Time Training for Long-Context LLMscited by 18
- 2023Learning to (Learn at Test Time)cited by 17
- 2024Puzzle: Distillation-Based NAS for Inference-Optimized LLMscited by 17
- 2025Test-Time Training Provably Improves Transformers as In-context Learnerscited by 16
- 2025Latent learning: episodic memory complements parametric learning by enabling flexible reuse of experiencescited by 15
- 2025Continuous Self-Improvement of Large Language Models by Test-time Training with Verifier-Driven Sample Selectioncited by 13
- 2026Latent Context Compilation: Distilling Long Context into Compact Portable Memorycited by 13
- 2025DISCOVER: Automated Curricula for Sparse-Reward Reinforcement Learningcited by 12
- 2025Adaptive Defense against Harmful Fine-Tuning for Large Language Models via Bayesian Data Schedulercited by 12
- 2024Tuning-Free Accountable Intervention for LLM Deployment -- A Metacognitive Approachcited by 11
- 2023Model-free Test Time Adaptation for Out-Of-Distribution Detectioncited by 9
- 2025TeleRAG: Efficient Retrieval-Augmented Generation Inference with Lookahead Retrievalcited by 9
- 2025Local Mixtures of Experts: Essentially Free Test-Time Training via Model Mergingcited by 9
- 2025Learning with Calibration: Exploring Test-Time Computing of Spatio-Temporal Forecastingcited by 9
- 2025Learning on the Job: Test-Time Curricula for Targeted Reinforcement Learningcited by 9
- 2026Tool Verification for Test-Time Reinforcement Learningcited by 9
- 2025Test-time Offline Reinforcement Learning on Goal-related Experiencecited by 8
- 2026Workspace Optimization: How to Train Your Agentcited by 7
- 2026FutureSim: Replaying World Events to Evaluate Adaptive Agentscited by 7
- 2025Test-Time Matching: Unlocking Compositional Reasoning in Multimodal Modelscited by 6
- 2024No Train, all Gain: Self-Supervised Gradients Improve Deep Frozen Representationscited by 5
- 2025Specialization after Generalization: Towards Understanding Test-Time Training in Foundation Modelscited by 5
- 2025PASER: Post-Training Data Selection for Efficient Pruned Large Language Model Recoverycited by 4
- 2025Test-time Correlation Alignmentcited by 4
- 2025Reusing Pre-Training Data at Test Time is a Compute Multipliercited by 4
- 2026Panini: Continual Learning in Token Space via Structured Memorycited by 4
- 2026No Time Like the Present: Agentic Test-Time Training for LLM Agentscited by 4
- 2026AgentStream: How Well Do Self-Evolving LLM Agents Perform Under Streaming Tasks?cited by 4
- 2025Understanding and Mitigating Distribution Shifts For Machine Learning Force Fieldscited by 3
- 2025Few-Shot Segmentation of Historical Maps via Linear Probing of Vision Foundation Modelscited by 3
- 2025Context Tuning for In-Context Optimizationcited by 3
- 2025Rewiring Experts on the Fly:Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert modelscited by 3
- 2025Closed-Loop Transformers: Autoregressive Modeling as Iterative Latent Equilibriumcited by 3
- 2026Learning Cross-View Object Correspondence via Cycle-Consistent Mask Predictioncited by 3
- 2024Active Few-Shot Fine-Tuningcited by 2
50 most cited of 88 All 88 (JSON)
- 2026Latent Compaction with Test-Time Training14 Oct 2026
- 2026Encoding Context into LLM Weights: What Makes It Context?13 Oct 2026
- 2026Test-Time Adaptation of Reasoning Strategies with Bayesian Nonparametric Memory5 Oct 2026
- 2026ASCENT: Online Test-Time Training of Long-Horizon Agents via Self-Distillation of Verified Experience4 Oct 2026
- 2026Self-Generated Feedback Destabilizes Test-Time Training: A Causal Decomposition of Long-Horizon Adaptation4 Oct 2026
- 2026HyperThink: Text-to-Parameter Hypernetworks for Efficient Reasoning2 Oct 2026
- 2026JEPA-TTT: Persistent Test-Time Training of Latent World Models for Planning under Dynamics Shifts30 Sep 2026
- 2026Audit the Scaffold, Not the Checkpoint: A Stationarity Dichotomy for Recursive Self-Improvement in Agentic Coding28 Sep 2026
- 2026BOReFT: Manifold Steering of Language Models for Black-box Optimization27 Sep 2026
- 2026VANE: Reliable Test-Time Training for Vision-Language-Action Models via Future Visual Representation Prediction10 Aug 2026
- 2026GradCuit: Credit-Assigned Gradient Flow Enables Robust and Interpretable Test-Time Latent Reasoning3 Aug 2026
- 2026AgentStream: How Well Do Self-Evolving LLM Agents Perform Under Streaming Tasks?31 Jul 2026
38 more
- 2026Test-Time Coverage: Test-Conditioned Data Curation for Deployment-Aware Learning18 Jul 2026
- 2026Self-Guided Test-Time Training for Long-Context LLMs10 Jul 2026
- 2026No Time Like the Present: Agentic Test-Time Training for LLM Agents3 Jul 2026
- 2026Beyond Perplexity: A Behavioral Evaluation Framework for Deployment-Memory Claims in LLM Test-Time Training1 Jul 2026
- 2026Forget, Anticipate and Adapt: Test Time Training for Long Videos25 Jun 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026TrustMargin: Training-Free Arbitration between Parametric Memory and Retrieved Evidence in Large Language Models7 Jun 2026
- 2026Task-Focused Memorization for Multimodal Agents29 May 2026
- 2026Efficient Test-Time Finetuning of LLMs via Convex Reconstruction and Gradient Caching28 May 2026
- 2026Test-Time Training Undermines Safety Guardrails21 May 2026
- 2026FutureSim: Replaying World Events to Evaluate Adaptive Agents14 May 2026
- 2026Query-Conditioned Test-Time Self-Training for Large Language Models13 May 2026
- 2026Epistemic Uncertainty for Test-Time Discovery11 May 2026
- 2026Workspace Optimization: How to Train Your Agent10 May 2026
- 2026Test-Time Instance-Specific Parameter Composition: A New Paradigm for Adaptive Generative Modeling29 Mar 2026
- 2026Live Interactive Training for Video Segmentation27 Mar 2026
- 2026Computational Arbitrage in AI Model Markets23 Mar 2026
- 2026Tool Verification for Test-Time Reinforcement Learning2 Mar 2026
- 2026Test-Time Learning of Causal Structure from Interventional Data22 Feb 2026
- 2026Learning Cross-View Object Correspondence via Cycle-Consistent Mask Prediction22 Feb 2026
- 2026Panini: Continual Learning in Token Space via Structured Memory16 Feb 2026
- 2026Latent Context Compilation: Distilling Long Context into Compact Portable Memory31 Jan 2026
- 2026Reinforcement Learning via Self-Distillation28 Jan 2026
- 2026Adaptive kNN graph model23 Jan 2026
- 2025End-to-End Test-Time Training for Long Context29 Dec 2025
- 2025Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs15 Dec 2025
- 2025OptPO: Optimal Rollout Allocation for Test-time Policy Optimization2 Dec 2025
- 2025Closed-Loop Transformers: Autoregressive Modeling as Iterative Latent Equilibrium26 Nov 2025
- 2025Reproducibility Report: Test-Time Training on Nearest Neighbors for Large Language Models16 Nov 2025
- 2025Reusing Pre-Training Data at Test Time is a Compute Multiplier6 Nov 2025
- 2025Adaptive Defense against Harmful Fine-Tuning for Large Language Models via Bayesian Data Scheduler31 Oct 2025
- 2025Groupwise Registration with Physics-Informed Test-Time Adaptation on Multi-parametric Cardiac MRI29 Oct 2025
- 2025Retaining by Doing: The Role of On-Policy Data in Mitigating Forgetting21 Oct 2025
- 2025Rewiring Experts on the Fly:Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert models16 Oct 2025
- 2025Self-Improving LLM Agents at Test-Time9 Oct 2025
- 2025Test-Time Matching: Unlocking Compositional Reasoning in Multimodal Models9 Oct 2025
- 2025Learning on the Job: Test-Time Curricula for Targeted Reinforcement Learning6 Oct 2025
- 2025Specialization after Generalization: Towards Understanding Test-Time Training in Foundation Models29 Sep 2025
50 newest of 88 All 88 (JSON)
- 2025TTRL: Test-Time Reinforcement Learningcited by 275
- 2025Seek in the Dark: Reasoning via Test-Time Instance-Level Policy Gradient in Latent Spacecited by 43
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoningcited by 40
- 2025Let's (not) just put things in Context: Test-Time Training for Long-Context LLMscited by 18
- 2026Tool Verification for Test-Time Reinforcement Learningcited by 9
- 2025Test-Time Matching: Unlocking Compositional Reasoning in Multimodal Modelscited by 6
- 2026HyperThink: Text-to-Parameter Hypernetworks for Efficient Reasoningcited by 1
- 2026GradCuit: Credit-Assigned Gradient Flow Enables Robust and Interpretable Test-Time Latent Reasoningcited by 0
- 2026Test-Time Adaptation of Reasoning Strategies with Bayesian Nonparametric Memorycited by 0
- 2026Test-Time Adaptation of Reasoning Strategies with Bayesian Nonparametric Memory5 Oct 2026
- 2026HyperThink: Text-to-Parameter Hypernetworks for Efficient Reasoning2 Oct 2026
- 2026GradCuit: Credit-Assigned Gradient Flow Enables Robust and Interpretable Test-Time Latent Reasoning3 Aug 2026
- 2026Tool Verification for Test-Time Reinforcement Learning2 Mar 2026
- 2025Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs15 Dec 2025
- 2025Test-Time Matching: Unlocking Compositional Reasoning in Multimodal Models9 Oct 2025
- 2025Seek in the Dark: Reasoning via Test-Time Instance-Level Policy Gradient in Latent Space19 May 2025
- 2025TTRL: Test-Time Reinforcement Learning22 Apr 2025
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoning5 Jan 2025
- 2025Self-Improving LLM Agents at Test-Timecited by 30
- 2026Workspace Optimization: How to Train Your Agentcited by 7
- 2026No Time Like the Present: Agentic Test-Time Training for LLM Agentscited by 4
- 2026AgentStream: How Well Do Self-Evolving LLM Agents Perform Under Streaming Tasks?cited by 4
- 2026Task-Focused Memorization for Multimodal Agentscited by 1
- 2026Audit the Scaffold, Not the Checkpoint: A Stationarity Dichotomy for Recursive Self-Improvement in Agentic Codingcited by 0
- 2026ASCENT: Online Test-Time Training of Long-Horizon Agents via Self-Distillation of Verified Experiencecited by 0
- 2026ASCENT: Online Test-Time Training of Long-Horizon Agents via Self-Distillation of Verified Experience4 Oct 2026
- 2026Audit the Scaffold, Not the Checkpoint: A Stationarity Dichotomy for Recursive Self-Improvement in Agentic Coding28 Sep 2026
- 2026AgentStream: How Well Do Self-Evolving LLM Agents Perform Under Streaming Tasks?31 Jul 2026
- 2026No Time Like the Present: Agentic Test-Time Training for LLM Agents3 Jul 2026
- 2026Task-Focused Memorization for Multimodal Agents29 May 2026
- 2026Workspace Optimization: How to Train Your Agent10 May 2026
- 2025Self-Improving LLM Agents at Test-Time9 Oct 2025
- 2026Reinforcement Learning via Self-Distillationcited by 332
- 2026Reinforcement Learning via Self-Distillation28 Jan 2026
- 2026Test-Time Training Undermines Safety Guardrailscited by 0
- 2026Test-Time Training Undermines Safety Guardrails21 May 2026
- 2024The Surprising Effectiveness of Test-Time Training for Few-Shot Learningcited by 96
- 2025Retaining by Doing: The Role of On-Policy Data in Mitigating Forgettingcited by 94
- 2025End-to-End Test-Time Training for Long Contextcited by 62
- 2025Test-Time Learning for Large Language Modelscited by 50
- 2023Test-Time Training on Video Streamscited by 37
- 2025Cognitive Memory in Large Language Modelscited by 29
- 2025How Benchmark Prediction from Fewer Data Misses the Markcited by 28
- 2025Test3R: Learning to Reconstruct 3D at Test Timecited by 20
- 2023Learning to (Learn at Test Time)cited by 17
- 2024Puzzle: Distillation-Based NAS for Inference-Optimized LLMscited by 17
- 2025Test-Time Training Provably Improves Transformers as In-context Learnerscited by 16
- 2025Latent learning: episodic memory complements parametric learning by enabling flexible reuse of experiencescited by 15
12 most cited of 57 All 57 (JSON)
- 2026Latent Compaction with Test-Time Training14 Oct 2026
- 2026Encoding Context into LLM Weights: What Makes It Context?13 Oct 2026
- 2026Self-Generated Feedback Destabilizes Test-Time Training: A Causal Decomposition of Long-Horizon Adaptation4 Oct 2026
- 2026BOReFT: Manifold Steering of Language Models for Black-box Optimization27 Sep 2026
- 2026Test-Time Coverage: Test-Conditioned Data Curation for Deployment-Aware Learning18 Jul 2026
- 2026Self-Guided Test-Time Training for Long-Context LLMs10 Jul 2026
- 2026Beyond Perplexity: A Behavioral Evaluation Framework for Deployment-Memory Claims in LLM Test-Time Training1 Jul 2026
- 2026Forget, Anticipate and Adapt: Test Time Training for Long Videos25 Jun 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026TrustMargin: Training-Free Arbitration between Parametric Memory and Retrieved Evidence in Large Language Models7 Jun 2026
- 2026Efficient Test-Time Finetuning of LLMs via Convex Reconstruction and Gradient Caching28 May 2026
- 2026FutureSim: Replaying World Events to Evaluate Adaptive Agents14 May 2026
12 newest of 57 All 57 (JSON)