Manuscript Offprint
arXiv:2610.36794Select-TTT: Query-Conditioned Selective Fast Weight Updates for In-Place Test-Time Training
Yue Wu
University of Science and Technology
of China
China
Chongming Gao
University of Science and Technology
of China
China
Yang Zhang
National University of Singapore
Singapore
Xinsen Guo
University of Science and Technology
of China
China
Weinan Gan
Huawei Noah's Ark Lab
China
Fuli Feng
University of Science and Technology
of China
China
Xiaoyuan Li
University of Science and Technology
of China
China
Abstract
Test-time training (TTT) enables a deployed language model to internalize incoming context on-the-fly into a small set of fast-weight parameters, rather than merely treating it as transient context for attention. In-Place TTT recently made this idea practical for large language models by repurposing the down-projection of standard MLP blocks as fast weights. However, we find that its benefit largely disappears on realistic web long-context question answering. We attribute this to In-Place TTT's uniform write schedule: every chunk is written with equal strength, so irrelevant content dilutes query-relevant information in fast-weight memory. Building on this insight, we propose Select-TTT, a model-agnostic, query-conditioned rule for In-Place TTT that scales each chunk's write strength by its relevance to the user query. This relevance signal requires no supervision and no new parameters: it is read directly from the model's frozen output head, as the probability mass that a chunk's hidden states assign to the query tokens. A temperature-scaled softmax turns these scores into learning-rate multipliers, leaving the chunk-wise, context-parallel computation of In-Place TTT intact. Select-TTT consistently improves long-context question answering on two benchmarks and two backbones. These findings highlight the value of query-conditioned fast weight writes for practical test-time training on long-context question answering, which is also potentially promising for long-horizon agent tasks involving multiple user queries over evolving contexts.
CCS Concepts
• Computing methodologies → Machine learning; • Information systems → Question answering.
1 Introduction
Large Language Models (LLMs) [5, 13, 26, 41] are increasingly deployed as web assistants that answer user queries over long, evolving contexts: multi-session dialogue histories, web browsing traces, and lengthy documents [25, 38]. In such scenarios, the static “train then deploy” paradigm faces a double challenge. First, the answer-bearing evidence typically occupies only a tiny fraction of the context, and empirical studies show that LLMs struggle to exploit long contexts even when they nominally fit the context window [2, 6, 18, 24]. Second, once deployed, the model’s weights are frozen: the model can re-read its context through attention at every step, but it can never internalize it, leaving its parameters misaligned with the information at hand [12].
Two lines of research address these challenges from complementary angles. Architectural approaches extend the context window itself, via sparse or linear attention [4, 8, 21, 46], state-space models [11, 15, 16], and positional-embedding scaling [28, 31]. Test-Time Training (TTT) [3, 33, 34, 36], in contrast, makes the model itself adaptive: it designates a small subset of parameters — the fast weights [1, 30] — as a dynamic memory that is updated on the fly while processing the input, internalizing contextual information as it arrives. Among TTT methods, In-Place TTT (IP-TTT) [12] is of particular practical interest: it repurposes the final projection matrix of the ubiquitous gated MLP blocks as fast weights, pairs this with an objective aligned with Next-Token Prediction (NTP), and organizes updates chunk-wise so that TTT becomes a “drop-in” enhancement compatible with context parallelism — requiring no architectural modification and no training from scratch.
However, the IP-TTT's write schedule is uniform: every chunk updates the fast weights with the same learning rate, regardless of its content. This is at odds with how long-context question answering works in practice. When a question concerns a small portion of a long history, the chunks that carry the answer are written with the same strength as the many chunks that do not,
''
Wu et al.
and the noise accumulated from irrelevant writes dilutes the query-relevant information in the fast-weight memory. Empirically, we find that uniform In-Place TTT brings little or no improvement on realistic long-context QA benchmarks, and sometimes degrades the zero-shot performance. A controlled experiment with oracle annotations confirms the diagnosis: amplifying the writes of answer chunks improves accuracy markedly, whereas amplifying the writes of irrelevant chunks drives it below the baseline (Figure 1).
We solve this question affirmatively with Select-TTT, a query-conditioned selective update rule for In-Place TTT. Our key observation is that a pre-trained LLM already carries a well-calibrated relevance measure — its own output head. Select-TTT scores each chunk in the logit space: it maps the chunk's hidden states through the frozen output head and measures the probability mass they assign to the query tokens (the query-conditioned cross-entropy). A low query-CE indicates that the local representation is already predictive of the question, i.e., the chunk is relevant. Chunk-level scores, aggregated by top-k mean pooling, are converted into per-chunk learning-rate multipliers via a temperature-scaled softmax designed to meet three desiderata: soft writes (every chunk receives a positive multiplier, so potentially answer-bearing chunks are never entirely discarded), budget preservation (only the distribution across chunks changes, conserving the total amount of information written), and stability (an upper clip prevents any single chunk from dominating). The resulting rule merely rescales each chunk's update by a scalar, and reduces to IP-TTT when no query is present.
We evaluate Select-TTT on two long-context QA benchmarks, LongMemEval-S [38] and LoCoMo [25], with Llama-3.1-8B-Instruct and Qwen3-4B backbones, under two protocols: applying the selective rule only at inference on an In-Place TTT checkpoint, and enabling it during continual training on LongCite-45k [47] as well. In both settings Select-TTT consistently outperforms uniform In-Place TTT and the corresponding baselines. Ablations show that each component of the multiplier design contributes. All these findings highlight the value of query-conditioned fast weight writes for practical test-time training.
2 Preliminary
2.1 Test-Time Training
Test-Time Training (TTT) enables a model to adapt its parameters at inference time by introducing a small subset of trainable parameters, the fast weights [1]. Denoted by , these weights parameterize a small network that acts as a dynamic memory, continuously storing and retrieving contextual information from the input sequence.
Given a sequence of tokens, each token is projected to derive a query , a key and a value . The TTT mechanism alternates two operations:
(1) Update Operation: The fast weight is updated by one optimization step of a self-supervised loss that associates the key with its value :
where is the learning rate. Intuitively, this step encodes the information of the pair into the memory .
(2) Apply Operation: The updated network is used to process the query, i.e., , so that the output is enriched with the contextual information stored in .
While Eq. (1) describes the high-level mechanism, its practical instantiation in modern LLMs faces two barriers: (i) TTT is often realized by specialized recurrent layers that replace attention and require expensive pre-training from scratch; (ii) the canonical per-token update is inherently sequential and severely bottlenecks parallel accelerators. In-Place TTT [12] addresses both issues, and serves as the backbone of our method.
2.2 In-Place TTT
In-Place TTT [12] repurposes the final projection matrix of the ubiquitous gated MLP blocks as the fast weight, turning TTT into a “drop-in” enhancement without any architectural modification. For the widely used gated MLP [13, 41], given the hidden representation of tokens, the gated MLP computes its output as
where is the activation and the element-wise product. In-Place TTT freezes and as slow weights, and treats as the fast weight that is updated at inference time.
LM-aligned objective and chunk-wise update. Let denote the intermediate (gated) activations, and let the value target be constructed from the token embedding so that it carries future-token information,
where Conv1D( ) is a causal 1D convolution and is a trainable projection; e.g., a next-token target is obtained by setting to the identity and the convolution kernel to select the next token. In-Place TTT instantiates the fast-weight loss as the negative Frobenius inner product, , which is explicitly aligned with the Next-Token-Prediction (NTP) task.
The sequence is partitioned into non-overlapping chunks of size ; for we write for its -th chunk. Let denote the fast-weight state before processing chunk , with . Processing chunk performs:
(1) Apply Operation: the current fast weight is used to produce the output ;
(2) Update Operation: The fast weight are updated using as keys and as values, which is performed via one gradient descent step with a loss function and a learning rate :
Under the loss function , the gradient with respect to the fast weights in this chunk-wise mechanism can be directly derived:
''
with a global learning rate and the chunk update .
The chunk-wise form of Eq. (5) keeps the computation dense and matmul-rich, enabling efficient training with large chunk sizes and compatibility with context parallelism.
3 Motivation Experiment
While In-Place TTT has been shown effective on synthetic retrieval benchmarks such as RULER [12, 18], we observe that its benefit on long-context user QA under realistic web scenarios is marginal. Concretely, on LongMemEval-S[38], a comprehensive and challenging benchmark for testing the long-term memory of chat assistants, enabling In-Place TTT with the Llama-3.1-8B-Instruct backbone raises the average accuracy only from 33.4% (zero-shot Baseline) to 33.6%. We hypothesize that the cause is the indiscriminate write of In-Place TTT: the update of Eq. (5) applies the same learning rate to every chunk, so chunks irrelevant to the user query are written into the fast weights with equal strength as the answer-bearing chunks, and their noise dilutes the query-relevant information in the memory.
To test this hypothesis we design an ANS-augment experiment on Llama-3.1-8B-Instruct. LongMemEval-S provides the session associated with each question, from which we obtain the ground-truth set of answer-bearing chunks. We then decouple the write strength of answer chunks from that of the remaining (irrelevant) chunks and sweep the two learning rates independently.
Figure 1 reports the results, and two trends are clear. (a) Holding the irrelevant-chunk learning rate fixed, strengthening the write of answer chunks improves accuracy monotonically, from 33.6% (the uniform In-Place TTT setting) to 37.8%. (b) Conversely, increasing the write strength of irrelevant chunks progressively degrades accuracy, from 34.8% down to 29.6%. These two trends reveal a key limitation of uniform In-Place TTT: the writes from irrelevant chunks actively hurt performance, while stronger writes to answer chunks help. Then a practical question arises: in realistic QA scenarios, how can we know in advance which chunks contain the answer? A natural thought is: if each chunk's write strength could be scaled by its relevance to the query — amplifying answer-bearing chunks and suppressing irrelevant ones — the fast-weight memory would tend to retain the information the model actually needs. Motivated by this idea, we propose Select-TTT in the next section.
4 Select-TTT: Query-Conditioned Selective In-Place TTT
4.1 The Selective Learning-Rate Rule
Our core idea is to modulate the per-chunk memory write by a scalar multiplier , computed from the relevance between the chunk and the user query. We observe that this modulation and the In-Place TTT update are complementary: the learning rate sets the baseline strength of each memory write, while the query-conditioned relevance rescales this strength for each chunk according to how relevant it is to the query. This yields the query-conditioned selective learning-rate rule:
(a) Strengthen answer chunks

(b) Suppress irrelevant chunks
Figure 1: Motivation experiment on LongMemEval-S (Llama-3.1-8B-Instruct). (a) Accuracy vs. the answer-chunk learning rate. (b) Accuracy vs. the irrelevant-chunk learning rate. The default In-Place TTT configuration uses 0.3 for both learning rates. The dashed line marks the zero-shot Baseline (33.4%).
This selective rule continuously modulates the memory write strength according to the relevance of each chunk to the query. When a chunk is weakly related to the query, becomes small, weakening its memory write so that the fast weight receives only a modest update from that chunk. Conversely, a highly relevant chunk yields , producing an effective step size and thereby strengthening its write into the memory. Figure 2 illustrates our Select-TTT framework.
4.2 The Query-conditioned chunk selection
In this subsection, we will detail the procedure by which the query-conditioned multiplier is computed. There are two steps:
Assessing chunk relevance score in the logit space. A key challenge is that fast weight updates in In-Place TTT are carried out entirely within the gated MLP, so the only signal available for chunk i is its own hidden state , which carries no direct notion of relevance to the query. Standard retrieval relevance signals such as cosine similarity between a chunk embedding and a query embedding, or a cross-encoder score do not transfer here: they assume documents are independent units whose vectors come from a separate, contrastively-trained encoder that projects query and documents into a shared calibrated semantic space. The chunks in Select-TTT are instead contiguous segments of a single input, represented solely by the model's intermediate hidden states produced online during the forward pass.
We instead assess the chunk relevance in the logit space induced by the frozen output head , yielding a novel model-internal mechanism for selecting and weighting hidden-state chunks when such text-based signals are unavailable: we map each chunk's hidden state through the output head into a calibrated probability distribution over the vocabulary, and read off the chunk's importance from the probability mass it assigns to the query tokens. This can be viewed as projecting each chunk's hidden state onto the query-token subspace of the logit space, where the semantics of "relevance to the query" has a direct, per-token meaning.
Formally, let be the query tokens associated with the current input. During training, is the question associated
,
Wu et al.

Figure 2: Overview of Select-TTT. (1) The frozen LM head maps chunk hidden states to logit space, where query-token scores are aggregated by top-k mean pooling to assess chunk relevance. (2) Relevance scores are converted into learning-rate multipliers. (3) In-Place TTT computes the NTP-aligned fast-weight updates. (4) The multipliers rescale these updates to selectively write query-relevant information into fast-weight memory.
with each QA instance in the training set; at inference time, it is provided by the user query. For position c of chunk i, let be the hidden state, i.e., the c-th row of . The output head maps it to the logit vector
where V is the vocabulary size. The likelihood that the model assigns to the query tokens at this position is
Here refers to the logit assigned to token at position of chunk . A low indicates that the local representation already encodes information predictive of the question, so that the position is relevant to the query. We aggregate per-position scores within each chunk to obtain a single chunk relevance score :
the Pool is specified by a strategy governed by the parameter top-k ratio , which controls how many positions within a chunk are retained for the average:
-
mean ( ): all C positions are pooled, equally weighing every token in the chunk;
-
max ( ): only the single position with the lowest CE is retained, giving a most-relevant-token rule;
-
top-k mean ( ): the positions with the lowest CE are kept and averaged, balancing question-relevant signal extraction with robustness to noise.
We default to aggregate over positions with a top-k mean pooling strategy to obtain a single chunk-level score, since we argue that the relevance of a chunk should be determined by the importance of its most query-relevant portions rather than by averaging over all tokens.
Convert relevance scores to multipliers. We convert the chunk scores into per-chunk learning-rate multipliers via a temperature-scaled softmax over the negative scores:
Here the temperature controls the extent to which query-relevant chunks are distinguished from irrelevant ones in the multiplier assignment. A smaller sharpens this distinction: it amplifies the gap between relevant and irrelevant chunks, concentrating the write budget on the few most relevant chunks. The clip M sets the maximum allowed amplification per chunk. The design of Eq. (10) satisfies three desiderata:
(1) Soft write. The softmax yields strictly positive multipliers for all chunks, so every chunk is written into the fast weights with a strength proportional to its estimated relevance. Since the query-CE assessment is only an estimate, the smooth allocation ensures that the potential answer-bearing chunks are never entirely ignored.
(2) Budget preservation. Multiplying the softmax weights by T ensures , so the average learning rate matches IP-TTT's global . The total amount of information written into fast weights is conserved; only its distribution across chunks changes.
(3) Stability. The upper clip M prevents any single chunk from dominating the update when the temperature is small, which guards against any individual chunk being written too aggressively into the fast weights.
''
An online-learning view. Interpreting of Eq. (5) as a closed-form gradient step of the NTP-aligned objective [12], Eq. (6) is exactly chunk-wise SGD with a query-conditioned, per-chunk adaptive step size : the overall write strength is set by the global learning rate , then rescaled by the query-conditioned multiplier before the write is performed. Per-block adaptive step sizes are a classical technique in deep learning optimization, and here the step size is conditioned on the query, so that the model adaptively focuses its memory on query-relevant content.
4.3 Efficient Chunk-Wise Scoring and Training
The selective rule only rescales each by a per-chunk scalar . The main chunk-wise pass of In-Place TTT (Eq. (5)) is therefore left untouched, and all of its matmul-rich, context-parallel properties are preserved. The only additional computation is the scoring pass of Eqs. (7)–(9), which we make hardware-efficient with two techniques.
Blockwise log-sum-exp. The logits in Eq. (7) span the full vocabulary V and would materialize a tensor of size if computed directly, incurring substantial GPU memory overhead. We instead compute the log-sum-exp normalizer in vocabulary blocks of a smaller size B,
(11)
where each block-wise is a single matrix product against a block of the (frozen) output head, and the blocks are combined by log-exp additions. This keeps the peak activation memory at instead of .
Direct question-token logits. Only the Q rows of the output head that correspond to the question tokens are needed in Eq. (8). We gather these rows and compute the logits directly,
with cost instead of the of a full forward pass. For question lengths this is substantially cheaper. Expanding the logarithm in Eq. (8), the per-token CE decomposes as
(13)
where the normalizer is obtained from Eq. (11) and the gathered logits from Eq. (12). The per-token CE therefore decomposes into two cheap terms – Q gathered logits plus a single blockwise log-sum-exp – requiring no logit tensor.
Overhead Analysis. Per selective layer, the scoring pass adds floating-point operations — dominated by the blockwise log-sum-exp, i.e., a single matrix product against the output head — and peak activation memory. For each chunk, the additional computational cost amounts a single output-head forward pass over the input sequence per selective layer. The output head is frozen and shared across layers, so no additional parameters or optimizer states are introduced. Since this selective mechanism is executed only at the TTT layers and is computed from hidden states that are already available, the added overhead is modest relative to the overall per-step computation of the model.
Efficient Implementation with Context Parallelism. Our implementation inherits the context parallelism from In-Place TTT, which is designed for high efficiency and scalability on modern hardware. The full algorithm is presented in Algorithm 1 (Appendix A).
5 Experiments
In this section, we organize our empirical study around the following research questions:
• Q1 (Effectiveness). When the Select-TTT is only enabled during inference, as a training-free, drop-in enhancement for the InPlace TTT, does query-conditioned selectivity improve the zero-shot long-context QA performance?
• Q2 (Training-inference consistency). When the Select-TTT is enabled during both continual training and inference, does it outperform standard continual pre-training and uniformly trained In-Place TTT?
• Q3 (Sensitivity). How sensitive is our Select-TTT framework to its key design choices?
• Q4 (Mechanism). Does the query-conditioned selective mechanism of Eq. (9) genuinely rank query-relevant chunks above irrelevant ones?
5.1 Experimental Setup
Datasets. We evaluate our method on two widely adopted long-context QA benchmarks that cover complementary aspects of long-term memory. LongMemEval-S [38] focuses on interactive memory in multi-session user-assistant dialogues, where information is accumulated across sessions and may evolve over time. It contains 500 questions embedded in histories of approximately 40 sessions and 115K tokens each, and comprises six subtasks. LoCoMo [25], in contrast, tests reasoning over very long conversations that span up to 35 sessions and roughly 300 turns per dialogue, with a total of around 1,980 questions distributed across 10 dialogues. Together, these benchmarks allow us to assess both multi-session consistency and long-context retrieval under a unified setup. For continual-training experiments, we use LongCite-45k [47], a large-scale corpus of 44,600 long-context QA instances (up to 128K tokens) which provides a natural source of query-context pairs for training.
Backbone models. We use two backbones of different families and scales: Llama-3.1-8B-Instruct (32 layers) and Qwen3-4B (36 layers). For the Qwen3-4B model, we adapt the model's Rotary Position Embeddings using YaRN [28] to effectively manage these long sequences. Following the In-Place TTT configuration, every sixth
Table 1: Protocol I: zero-shot inference-time TTT on LongMemEval-S with two backbones. Accuracy (%) is reported; the best result within each backbone block is in bold.
| Backbone | Method | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Llama-3.1-8B | Baseline | 50.00 | 18.80 | 16.54 | 3.33 | 69.64 | 58.57 | 33.4 |
| IP-TTT | 47.44 | 18.80 | 20.30 | 3.33 | 66.07 | 58.57 | 33.6 | |
| Select-TTT | 52.56 | 22.56 | 28.57 | 13.33 | 64.29 | 54.29 | 37.4 | |
| Qwen3-4B | Baseline | 28.21 | 21.80 | 22.56 | 6.67 | 57.14 | 30.00 | 27.2 |
| IP-TTT | 26.92 | 15.79 | 20.30 | 3.33 | 67.86 | 27.14 | 25.4 | |
| Select-TTT | 29.49 | 26.32 | 22.56 | 3.33 | 57.14 | 32.86 | 28.8 | |
KU: Knowledge Update; MS: Multi-session; TR: Temporal Reasoning; S-Pref.: Single-session Preference; S-Asst.: Single-session Assistant; S-User: Single-session User.
layer starting from the first one (layer indices {0, 6, 12, 18, 24, 30}, i.e., six layers per backbone) is equipped with the TTT mechanism; all other weights are identical to the original checkpoints.
Evaluation protocols. We consider two complementary protocols. Protocol I (inference-time Select-TTT). The Select-TTT chunk-wise updates of Eq. (6) are applied only at inference-time. We compare: (i) Baseline – the original pre-trained LLM evaluated directly, without any test-time update; (ii) IP-TTT – In-Place TTT with a uniform learning rate, i.e., for all chunks ; and (iii) Select-TTT – our query-conditioned multipliers (Eq. (10)). Methods (ii) and (iii) are run on the same TTT-enhanced checkpoint, obtained by following the original recipe of In-Place TTT; the two rows differ only in whether the per-chunk multiplier is uniform or query-conditioned, so their contrast cleanly isolates the effect of query-conditioned selective mechanism. Protocol II (selective continual training). The model is continually trained for up to 5k steps on the processed LongCite-45k corpus with the TTT mechanism active during training, and evaluated on LongMemEval-S at every 1k-step checkpoint with the same mechanism active at inference. We compare: (i) CPT – standard continual pre-training on the same corpus without any TTT mechanism; (ii) IP-TTT – continual training with uniform TTT updates (); and (iii) Select-TTT – continual training with the selective mechanism. For TTT-based training, both the backbone parameters and the newly introduced TTT parameters are updated jointly so that the model adapts its TTT behavior to the long-context QA setting, whereas CPT follows the vanilla fine-tuning recipe. We also report the No-Training reference, i.e., the zero-shot performance before any continual training.
Implementation details. All TTT-based methods use the LM-aligned objective of In-Place TTT. In the continual-training protocol we set chunk size and TTT learning rate . Select-TTT defaults to temperature , cap , pooling ratio , and top- mean pooling in Eq. (9). The ablation (Section 5.4) varies , , and the pooling strategy around these defaults. Detailed descriptions of the experiment implementation can be found in Appendix B.
Table 2: Protocol I: zero-shot inference-time TTT on LoCoMo with two backbones. Overall score (%) is reported; the best result within each backbone block is in bold.
| Backbone | Method | LoCoMo | |||||
|---|---|---|---|---|---|---|---|
| Multi | Temp. | Open | Single | Adv. | Avg. | ||
| Llama-3.1-8B | Baseline | 36.60 | 29.30 | 17.78 | 57.91 | 18.83 | 39.55 |
| IP-TTT | 34.92 | 30.12 | 19.51 | 58.22 | 15.47 | 38.90 | |
| Select-TTT | 36.38 | 30.74 | 20.74 | 58.34 | 20.40 | 40.42 | |
| Qwen3-4B | Baseline | 25.66 | 20.12 | 18.31 | 38.88 | 4.04 | 25.15 |
| IP-TTT | 25.84 | 20.60 | 18.19 | 39.25 | 4.26 | 25.45 | |
| Select-TTT | 25.27 | 21.12 | 20.46 | 39.77 | 6.05 | 26.19 | |
Multi: Multi-hop; Temp.: Temporal reasoning; Open: Open-domain factual; Single: Single-hop short-memory; Adv.: Adversarial queries.
5.2 Inference-Time Select-TTT as a Drop-in Enhancement
This section addresses Q1 under Protocol I: the TTT-enhanced checkpoint is obtained by the original recipe of In-Place TTT and the only adaptation at test time is the selective chunk-wise updates of Eq. (6). Tables 1 and 2 report the zero-shot results on LongMemEval-S and LoCoMo for both backbones.
Results. Select-TTT attains the best average score on both benchmarks and both backbones: on LongMemEval-S it improves over IP-TTT by +3.8 (Llama) and +3.4 (Qwen), and over the Baseline by +4.0 and +1.6 respectively; on LoCoMo it reaches 40.42 (Llama) and 26.19 (Qwen), again the highest among the three methods. More revealing is the relative behavior of the two TTT variants. The uniform adaptation of IP-TTT does not consistently help in this zero-shot long-context QA scenario: on Qwen3-4B it drops the LongMemEval-S average from 27.2 to 25.4, and on Llama-3.1-8B-Instruct from 39.55 to 38.90. This indicates that In-Place TTT writes every chunk into the fast weights with equal strength dilutes query-relevant information, as irrelevant chunks contribute noise on equal footing with relevant ones. Simply replacing the uniform schedule with query-conditioned multipliers on the same checkpoint yields a consistent gain: by suppressing the write strength of query-irrelevant chunks while reinforcing that of relevant ones, Select-TTT achieves the best performance across both backbones and both benchmarks.
A further observation is that the Select-TTT gains concentrate on subtasks that require synthesizing an answer from multiple, scattered pieces of evidence: on LongMemEval-S, the Knowledge Update, Multi-session, and Temporal Reasoning show larger improvements compare to the Single-session subtasks. This indicates that Select-TTT selectively strengthens the writes of query-relevant chunks into the fast weights, which is particularly beneficial for multi-evidence reasoning that aggregates information from multiple chunks. These observations answer Q1 affirmatively: as a drop-in replacement for the uniform schedule, the Select-TTT turns out to be a consistent, training-free enhancement for the In-Place TTT.
5.3 Continual Pre-Training with Select-TTT
We next address Q2 under Protocol II, where the TTT mechanism is active during both continual training and inference. All methods are trained on the processed LongCite-45k corpus for up to 5k steps
,

Figure 3: Protocol II: LongMemEval-S overall accuracy vs. continual-training steps for No Training, CPT, IP-TTT, and Select-TTT (Qwen3-4B backbone).
with the Qwen3-4B backbone and evaluated on LongMemEval-S at every 1k-step checkpoint. Figure 3 plots the overall accuracy during the continual-training steps.
Results. Continual training on LongCite-45k transfers well: every method lifts the zero-shot reference of 27.2% above 32% within the first thousand steps. The comparison among the trained models is more informative. From step 2k onward, both TTT-based methods outperform standard CPT, confirming that the In-Place TTT mechanism is an effective vehicle for long-context adaptation when backbone and TTT parameters are trained jointly; and Select-TTT in turn matches or exceeds IP-TTT at every subsequent checkpoint, finishing first at 37.4%, ahead of IP-TTT (35.6%) and CPT (35.0%). The single exception occurs at the earliest checkpoint, where the model has barely begun to accommodate the TTT mechanism and the query-conditioned redistribution of the learning-rate budget is not yet beneficial; as training proceeds, the selective schedule consistently dominates. Because Select-TTT and IP-TTT share the same update rule and differ only in the per-chunk multiplier of Eq. (10), the persistent gap between the two curves isolates the contribution of selectivity and answers Q2 affirmatively. Full per-subtask results and additional results across all checkpoints are provided in the Appendix C.1.
5.4 Ablation Studies On the Impact of Select-TTT Design Choices
To answer Q3, we ablate the key design choices of Select-TTT under Protocol I: (a) the temperature in Eq. (10), which controls how sharply the learning-rate budget concentrates on low-CE chunks; (b) the pooling ratio in Eq. (9); (c) the pooling strategy that aggregates per-token query-CE into a chunk-level score; and (d) the two safeguards of the multiplier — the softmax, which realizes a soft write over all chunks, and the upper clip , which prevents over-writes. Figure 4 reports (a)–(c) on both backbones with the LongMemEval-S overall accuracy; Table 3 reports (d) with the Llama-3.1-8B backbone on all six subtasks.
Table 3: Ablation of the multiplier design (Eq. (10)) on LongMemEval-S with the Llama-3.1-8B backbone. Accuracy (%) is reported; the best result per column is in bold.
| Ablation Setting | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | |
| w/ soft write, w/ clip | 52.56 | 22.56 | 28.57 | 13.33 | 64.29 | 54.29 | 37.4 |
| w/ soft write, w/o clip | 46.15 | 21.05 | 23.31 | 3.33 | 66.07 | 57.14 | 34.6 |
| w/o soft write, w/ clip | 42.31 | 15.04 | 18.05 | 6.67 | 66.07 | 51.43 | 30.4 |
| w/o soft write, w/o clip | 21.79 | 13.53 | 17.29 | 3.33 | 53.57 | 37.14 | 23.0 |
Table 4: Comparing relevance signals across different chunk sizes on LongMemEval-S QA instances. Hit@k: at least one of the k highest-ranked chunks contains the answer. Rec@k: fraction of answer chunks covered by the k highest-ranked chunks.
| Chunk size | Signal | Hit@k | Rec@k | ||||
|---|---|---|---|---|---|---|---|
| k=1 | k=3 | k=5 | k=1 | k=3 | k=5 | ||
| 2048 | Query-CE (ours) | 0.200 | 0.440 | 0.582 | 0.092 | 0.201 | 0.278 |
| Cosine | 0.094 | 0.212 | 0.293 | 0.061 | 0.136 | 0.189 | |
| Cross-encoder | 0.090 | 0.245 | 0.372 | 0.020 | 0.059 | 0.098 | |
| 4096 | Query-CE (ours) | 0.256 | 0.519 | 0.654 | 0.128 | 0.295 | 0.393 |
| Cosine | 0.133 | 0.308 | 0.415 | 0.085 | 0.198 | 0.267 | |
| Cross-encoder | 0.126 | 0.334 | 0.493 | 0.040 | 0.119 | 0.199 | |
| 8192 | Query-CE (ours) | 0.312 | 0.653 | 0.843 | 0.183 | 0.381 | 0.599 |
| Cosine | 0.189 | 0.398 | 0.522 | 0.122 | 0.257 | 0.337 | |
| Cross-encoder | 0.195 | 0.486 | 0.684 | 0.082 | 0.247 | 0.312 | |
Temperature . Figure 4 (a) shows that sharper selection helps: the lowest temperature performs best on both backbones, and performance degrades as increases. A small tends to concentrate the learning-rate budget on the few most query-relevant chunks. This aligns with the motivation of Section 4.1: what harms the fast weights is precisely the dilution caused by spreading the budget over irrelevant chunks.
Pooling ratio . Unlike the temperature, the overall accuracy varies non-monotonically with the pooling ratio ; the accuracy varies across the different settings, reflecting an inherent trade-off in Figure 4 (b). We settle on as a compromise: enough positions participate to make the score robust against spurious matches, while it still concentrates on the most query-relevant content.
Pooling strategy. Figure 4 (c) shows that the top-k mean pooling strategy outperforms both Max and Mean pooling on both backbones, validating our hypothesis in Section 4.2 that a chunk's relevance should be governed by its most query-relevant portions. Mean is diluted by the many irrelevant positions within a chunk, while Max relies on a single position and inherits its fragility. Top-k mean strikes the right balance: it aggregates a small, robust subset of the most relevant positions, capturing strong query-relevant signal while remaining robust to individual noisy tokens.
Multiplier design. A final ablation examines the two safeguards built into the multiplier of Eq. (10) (Table 3). The softmax realizes a soft write: the query-CE ranking is only an estimate of relevance, so writing every chunk with a strength proportional to its estimated
(a) Temperature

(b) Top-k Ratio
(c) Pool Strategy
Figure 4: Ablation of Select-TTT on LongMemEval-S (both backbones): (a) temperature ; (b) pooling ratio ; (c) pooling strategy (Max, Mean, Top-k). The default configuration is , , top-k mean.
relevance ensures that answer-bearing chunks are never entirely skipped. The clip, in turn, guards against over-writes: an extremely confident chunk would otherwise attract a multiplier far beyond the average budget and be written into the fast weights too aggressively. The result in Table 3 shows that removing both components causes a performance drop. Both safeguards are empirically necessary.
5.5 Analysis: Which Relevance Signal Picks the Relevant Chunks?
The preceding sections show that selectivity helps; here we answer Q4 and examine why. To rule out the possibility that a standard retrieval signal would serve equally well despite the mismatch argued in Section 4.2, we compare the query-CE score of Eq. (9) with two representative alternatives: Cosine similarity between the mean-pooled chunk and query hidden states; and a pretrained Cross-encoder bge-reranker [40] consuming the hidden states. On LongMemEval-S QA instances with ground-truth answer-chunk annotations, we rank the chunks under each signal across different chunk sizes and measure Hit@k — whether at least one of the k highest-ranked chunks contains the answer and Rec@k — the fraction of answer chunks they cover.
Results. Table 4 shows that query-CE is the strongest signal at every chunk size and k under both metrics. This is consistent with our argument in Section 4.2: under this hidden-state input setting, query-CE provides a stronger chunk-ranking signal than cosine similarity or the pretrained reranker which are not aligned with the model's hidden states. These results answer Q4: the logit-space query-CE score turns out to be an effective relevance signal.
5.6 Overhead analysis
We finally assess the computational overhead of Select-TTT relative to IP-TTT and the no-TTT baseline on Qwen3-4B model during inference time. Figure 5 reports the prefill throughput and peak GPU memory measured on different settings, confirming that the Select-TTT's lightweight scoring mechanism introduces negligible overhead to the original IP-TTT.
(a) Prefill Throughput

(b) Peak Memory

Figure 5: Efficiency analysis of Select-TTT. Prefill throughput (a) and peak GPU memory (b) are compared across the Baseline, IP-TTT, and Select-TTT on Qwen3-4B model.
6 Related Work
Test-Time Training and fast weights. Fast weights, network parameters updated on the fly to act as a dynamic memory, date back to the early nineties [1, 30] and were revived by linear transformers [1, 21]. Test-time training was introduced in computer vision as a means of adapting to distribution shift [34, 36] and has since been scaled to language modeling, both as standalone sequence models [3, 20, 33, 48] and, most recently, as an in-place enhancement of pre-trained LLMs [12]. Research has concentrated on the update objective, the optimizer, and the parallelization of the inherently sequential per-token updates [19, 32, 44]. In all of these methods, however, the write schedule is fixed in advance: every token or chunk is written with the same strength, independently of its relevance to the task the model is being asked to perform.
Efficient long-context modeling. A parallel line of work attacks the quadratic cost of attention [35] directly, through sparse attention patterns [4, 8, 46], streaming attention with sinks [39], IO-aware exact attention [10], linear attention [1, 21], and state-space models [11, 15, 16, 43], complemented by positional-embedding scaling [28, 31] and segment-level recurrence [9]. These methods make long inputs processable, yet benchmark studies show that the context models actually exploit falls well short of the advertised window [2, 18, 24]. Test-time adaptation is orthogonal to this line: rather than processing the context more cheaply, it changes what the model retains from the context, and the two can be combined.
''
Memory and gating in sequence models. Equipping language models with memory has a long history, from retrieval over external corpora [17, 22, 23] and dedicated memory modules [9, 14, 29] to recent memory systems for conversational assistants [7, 27, 37, 45, 49]. These systems keep memory outside the model's parameters and decide what to read at answer time, typically through similarity retrieval. A complementary mechanism operates inside linear-recurrent models, where data-dependent gates control what a parametric state retains [15, 42].
7 Conclusion
We introduced Select-TTT, which applies a query-conditioned selective learning-rate rule that scores each chunk in the logit space of the frozen output head and rescales its fast-weight write accordingly. The rule is a drop-in enhancement that preserves the chunk-wise, context-parallel computation of IP-TTT and adds only a lightweight scoring pass. This provides a novel model-internal way to select hidden states when conventional text-based retrieval signals are unavailable or poorly matched. Across two backbones and two benchmarks, Select-TTT consistently improves over IP-TTT and zero-shot baselines, both as an inference-time enhancement and when coupled with continual training. We see Select-TTT as a step toward query-aware test-time memory, and expect the principle — conditioning what is written on why it is being written — to extend to other test-time adaptation mechanisms and to agentic web applications where long, evolving contexts are the norm.
8 Limitations
Select-TTT conditions its memory writes on the user query, and the logit-space query-CE is only a heuristic estimate of chunk relevance: the scoring rule applies the frozen LM head to states from multiple TTT layers, potentially affecting the calibration of their query-token scores. A learned relevance function is a promising direction but may introduce additional computation, parameters, and training overhead. Our fixed chunk size follows the IP-TTT setting to preserve context parallelism. Semantically adaptive chunking could yield better boundaries and relevance estimates. Our evaluation covers two backbones of up to 8B parameters and two English benchmarks; scaling to larger models, multilingual settings, and other modalities remains future work.
References
[1] Jimmy Ba, Geoffrey Hinton, Volodymyr Mnih, Joel Z. Leibo, and Catalin Ionescu. 2016. Using fast weights to attend to the recent past. In Proceedings of the 30th International Conference on Neural Information Processing Systems (Barcelona, Spain) (NIPS'16). Curran Associates Inc., Red Hook, NY, USA, 4338–4346.
[2] Yushi Bai, Shangqing Tu, Jiajie Zhang, Hao Peng, Xiaozhi Wang, Xin Lv, Shulin Cao, Jiazheng Xu, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. 2025. LongBench v2: Towards Deeper Understanding and Reasoning on Realistic Long-context Multitasks. arXiv:2412.15204 [cs.CL] https://arxiv.org/abs/2412.15204
[3] Ali Behrouz, Peilin Zhong, and Vahab Mirrokni. 2025. Titans: Learning to Memorize at Test Time. In Advances in Neural Information Processing Systems, D. Belgrave, C. Zhang, H. Lin, R. Pascanu, P. Koniusz, M. Ghassemi, and N. Chen (Eds.), Vol. 38, Main Conference. Curran Associates, Inc., 113506–113543. doi:10.52202/085713-3786
[4] Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The Long-Document Transformer. arXiv:2004.05150 [cs.CL] https://arxiv.org/abs/2004.05150
[5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda
Askell, et al. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, Vol. 33. 1877–1901.
[6] Jun Shern Chan, Neil Chowdhury, Oliver Jaffe, James Aung, Dane Sherburn, Evan Mays, Giulio Starace, Kevin Liu, et al. 2025. MLE-bench: Evaluating Machine Learning Agents on Machine Learning Engineering. arXiv:2410.07095 [cs.CL] https://arxiv.org/abs/2410.07095
[7] Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. 2025. Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory. arXiv:2504.19413 [cs.CL] https://arxiv.org/abs/2504.19413
[8] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. 2019. Generating Long Sequences with Sparse Transformers. arXiv:1904.10509 [cs.LG] https://arxiv.org/abs/1904.10509
[9] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. 2019. Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 2978–2988. https://aclanthology.org/P19-1285/
[10] Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. 2022. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness. In Advances in Neural Information Processing Systems, S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (Eds.), Vol. 35. Curran Associates, Inc., 16344–16359. doi:10.52202/068431-1189
[11] Tri Dao and Albert Gu. 2024. Transformers are SSMs: generalized models and efficient algorithms through structured state space duality. In Proceedings of the 41st International Conference on Machine Learning (Vienna, Austria) (ICML'24). JMLR.org, Article 399, 31 pages.
[12] Guhao Feng, Shengjie Luo, Kai Hua, Ge Zhang, Wenhao Huang, Di He, and Tianle Cai. 2026. In-place test-time training. In International Conference on Learning Representations, Vol. 2026. 114452–114472.
[13] Aaron Grattafori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783 (2024).
[14] Alex Graves, Greg Wayne, and Ivo Danihelka. 2014. Neural Turing Machines. arXiv:1410.5401 [cs.NE] https://arxiv.org/abs/1410.5401
[15] Albert Gu and Tri Dao. 2024. Mamba: Linear-Time Sequence Modeling with Selective State Spaces. arXiv:2312.00752 [cs.LG] https://arxiv.org/abs/2312.00752
[16] Albert Gu, Karan Goel, and Christopher Re. 2022. Efficiently Modeling Long Sequences with Structured State Spaces. In International Conference on Learning Representations. https://mlanthology.org/iclr/2022/gu2022iclr-efficiently/
[17] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. REALM: retrieval-augmented language model pre-training. In Proceedings of the 37th International Conference on Machine Learning (ICML'20). JMLR.org, Article 368, 10 pages.
[18] Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman, Shantanu Acharya, Dima Rekesh, Fei Jia, Yang Zhang, and Boris Ginsburg. 2024. RULER: What's the Real Context Size of Your Long-Context Language Models? arXiv preprint arXiv:2404.06654 (2024).
[19] Kazuki Irie and Samuel J. Gershman. 2026. Fast weight programming and linear transformers: from machine learning to neurobiology. arXiv:2508.08435 [cs.LG] https://arxiv.org/abs/2508.08435
[20] Mahdi Karami, Razvan Pascanu, and Vahab Mirrokni. 2025. Lattice: Learning to Efficiently Compress the Memory. arXiv:2504.05646 [cs.LG] https://arxiv.org/abs/2504.05646
[21] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. 2020. Transformers are RNNs: fast autoregressive transformers with linear attention. In Proceedings of the 37th International Conference on Machine Learning (ICML'20). JMLR.org, Article 478, 10 pages.
[22] Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. 2020. Generalization through Memorization: Nearest Neighbor Language Models. arXiv:1911.00172 [cs.CL] https://arxiv.org/abs/1911.00172
[23] Patrick Lewis, Ethan Perez, Aleksandra Piktus, et al. 2020. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Proceedings of the 34th International Conference on Neural Information Processing Systems (Vancouver, BC, Canada) (NIPS '20). Curran Associates Inc., Red Hook, NY, USA, Article 793, 16 pages.
[24] Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. 2024. Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics 12 (2024), 157–173. doi:10.1162/tacl_a_00638
[25] Adyasha Maharana, Dong-Ho Lee, Sergey Tulyakov, Mohit Bansal, Francesco Barbieri, and Yuwei Fang. 2024. Evaluating Very Long-Term Conversational Memory of LLM Agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, Bangkok, Thailand, 13851–13870. doi:10.18653/v1/2024.acl-long.747
[26] OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, et al. 2024. GPT-4 Technical Report. arXiv:2303.08774 [cs.CL] https:
//arxiv.org/abs/2303.08774
[27] Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. 2024. MemGPT: Towards LLMs as Operating Systems. arXiv:2310.08560 [cs.AI] https://arxiv.org/abs/2310.08560
[28] Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole. 2024. YaRN: Efficient Context Window Extension of Large Language Models. In International Conference on Learning Representations, B. Kim, Y. Yue, S. Chaudhuri, K. Fragkiadaki, M. Khan, and Y. Sun (Eds.), Vol. 2024. 31932–31951.
[29] Jack W. Rae, Anna Potapenko, Siddhant M. Jayakumar, and Timothy P. Lilliprap. 2019. Compressive Transformers for Long-Range Sequence Modelling. arXiv:1911.05507 [cs.LG] https://arxiv.org/abs/1911.05507
[30] Jürgen Schmidhuber. 1992. Learning to Control Fast-Weight Memories: An Alternative to Dynamic Recurrent Networks. Neural Computation 4, 1 (1992), 131–139. doi:10.1162/neco.1992.4.1.131
[31] Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. 2023. RoFormer: Enhanced Transformer with Rotary Position Embedding. arXiv:2104.09864 [cs.CL] https://arxiv.org/abs/2104.09864
[32] Yutao Sun, Li Dong, Shaohan Huang, Shuming Ma, Yuqing Xia, Jilong Xue, Jianyong Wang, and Furu Wei. 2023. Retentive Network: A Successor to Transformer for Large Language Models. arXiv:2307.08621 [cs.CL] https://arxiv.org/abs/2307.08621
[33] Yu Sun, Xinhao Li, Karan Dalal, Jiarui Xu, Arjun Vikram, Genghan Zhang, Yann Dubois, Xinlei Chen, Xiaolong Wang, Sanmi Koyejo, Tatsunori Hashimoto, and Carlos Guestrin. 2025. Learning to (Learn at Test Time): RNNs with Expressive Hidden States. In Proceedings of the 42nd International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 267). PMLR, 57503–57522.
[34] Yu Sun, Xiaolong Wang, Zhuang Liu, John Miller, Alexei Efros, and Moritz Hardt. 2020. Test-Time Training with Self-Supervision for Generalization under Distribution Shifts. In Proceedings of the 37th International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 119), Hal Daumé III and Aarti Singh (Eds.). PMLR, 9229–9248.
[35] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is All you Need. In Advances in Neural Information Processing Systems, Vol. 30. Curran Associates, Inc.
[36] Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, and Trevor Darrell. 2021. Tent: Fully Test-time Adaptation by Entropy Minimization. arXiv:2006.10726 [cs.LG] https://arxiv.org/abs/2006.10726
[37] Yu Wang, Yifan Gao, Xiusi Chen, Haoming Jiang, Shiyang Li, Jingfeng Yang, Qingyu Yin, Zheng Li, Xian Li, Bing Yin, Jingbo Shang, and Julian Mcauley. 2024. MEMORYLLM: Towards Self-Updatable Large Language Models. In Proceedings of the 41st International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 235). PMLR, 50453–50466.
[38] Di Wu, Hongwei Wang, Wenhao Yu, Yuwei Zhang, Kai-Wei Chang, and Dong Yu. 2024. LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory. (2024). arXiv:2410.10813 [cs.CL] https://arxiv.org/abs/2410.10813
[39] Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. 2024. Efficient Streaming Language Models with Attention Sinks. arXiv:2309.17453 [cs.CL] https://arxiv.org/abs/2309.17453
[40] Shitao Xiao, Zheng Liu, Peitian Zhang, Niklas Muennighoff, Defu Lian, and Jian-Yun Nie. 2024. C-Pack: Packed Resources For General Chinese Embeddings. arXiv:2309.07597 [cs.CL] https://arxiv.org/abs/2309.07597
[41] An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, et al. 2025. Qwen3 Technical Report. arXiv:2505.09388 [cs.CL] https://arxiv.org/abs/2505.09388
[42] Songlin Yang, Jan Kautz, and Ali Hatamizadeh. 2025. Gated delta networks: Improving mamba2 with delta rule. In International Conference on Learning Representations, Vol. 2025. 29687–29707.
[43] Songlin Yang, Bailin Wang, Yu Zhang, Yikang Shen, and Yoon Kim. 2024. Parallelizing Linear Transformers with the Delta Rule over Sequence Length. In Advances in Neural Information Processing Systems, Vol. 37. Curran Associates, Inc., 115491–115522. doi:10.52202/079017-3668
[44] Morris Yau, Sharut Gupta, Valerie Engelmayer, Kazuki Irie, Stefanie Jegelka, and Jacob Andreas. 2026. Sequential-Parallel Duality in Prefix Scannable Models. arXiv:2506.10918 [cs.LG] https://arxiv.org/abs/2506.10918
[45] Hongli Yu, Tinghong Chen, Jiangtao Feng, Jiangjie Chen, Weinan Dai, Qiying Yu, Ya-Qin Zhang, Wei-Ying Ma, Jingjing Liu, Mingxuan Wang, and Hao Zhou. 2026. MemAgent: Reshaping Long-Context LLM with Multi-Conv RL-based Memory Agent. arXiv:2507.02259 [cs.CL] https://arxiv.org/abs/2507.02259
[46] Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. 2020. Big Bird: Transformers for Longer Sequences. In Advances in Neural Information Processing Systems, H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (Eds.), Vol. 33. Curran Associates, Inc., 17283–17297.
[47] Jiajie Zhang, Yushi Bai, Xin Lv, Wanjun Gu, Danqing Liu, Minhao Zou, Shulin Cao, Lei Hou, Yuxiao Dong, Ling Feng, and Juanzi Li. 2025. LongCite: Enabling LLMs
to Generate Fine-grained Citations in Long-Context QA. In Findings of the Association for Computational Linguistics: ACL 2025. Association for Computational Linguistics, Vienna, Austria, 5098–5122. doi:10.18653/v1/2025.findings-acl.264
[48] Tianyuan Zhang, Sai Bi, Yicong Hong, Kai Zhang, Fujun Luan, Songlin Yang, Kalyan Sunkavalli, William T. Freeman, and Hao Tan. 2025. Test-Time Training Done Right. arXiv:2505.23884 [cs.LG] https://arxiv.org/abs/2505.23884
[49] Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. 2024. Memorybank: Enhancing large language models with long-term memory. In Proceedings of the AAAI conference on artificial intelligence, Vol. 38. 19724–19731.
A Algorithmic Details
This appendix gives the complete context-parallel implementation of Select-TTT in Algorithm 1. For each chunk, the algorithm computes a query-conditioned relevance score and the standard In-Place TTT update in parallel. It then converts the scores into learning-rate multipliers, aggregates the weighted updates with a causal prefix sum, and applies only preceding updates when producing each chunk's output.
B Implementation Details
B.1 Backbone Architectures
We use two open-weight decoder-only Transformers. Table 5 summarizes their architectures. Both use SwiGLU gated MLPs and Rotary Position Embeddings (RoPE); Qwen3-4B additionally applies YaRN position interpolation [28] to support the long sequences of LongCite-45k, while Llama-3.1-8B-Instruct is evaluated in its native context window.
Table 5: Architectural configurations of the two backbones.
| Parameter | Llama-3.1-8B-Instruct | Qwen3-4B |
|---|---|---|
| Parameters (approx.) | 8B | 4B |
| Hidden size | 4,096 | 2,560 |
| Num. layers | 32 | 36 |
| Attention heads | 32 | 32 |
| Key-value heads | 8 | 8 |
| FFN intermediate size | 14,336 | 9,728 |
| Vocabulary size | 128,256 | 151,936 |
| RoPE base | ||
| Max position embeddings | 131,072 | 40,960 |
| RoPE extension | None | YaRN (factor 4) |
| Attention type | Full | Full |
B.2 TTT Module Configuration
Table 6 lists the configuration of the In-Place TTT module and our Select-TTT extension. The module is inserted into the gated MLP of every sixth layer ( ), and the down-projection of those layers is treated as the fast weight.
Algorithm 1 Select-TTT with Context Parallelism
Require: Pre-trained weights (incl. , , ); Conv1D kernel size ; target projection ; learning rate ; LM-head , ;
Input: Chunk sequence ; query tokens .
– Phase 1: compute relevance score and NTP gradient –
1: for all in parallel do
2:
3:
4:
5:
6:
7:
8:
9:
10: end for
– Phase 2: query-conditioned multipliers and aggregation –
11:
12:
– Phase 3: apply updates and compute outputs –
13: for all in parallel do
14:
15:
16: end for
17: At document boundaries: reset fast weights to .
Table 6: Configuration of the TTT module and Select-TTT scoring.
| Component | Value |
|---|---|
| TTT layers | |
| Fast weight | MLP down-projection |
| Conv1D kernel size | 5 (causal, depthwise, zero-init) |
| Target projection | , sparse-diagonal init |
| Objective | NTP-aligned (negative Frobenius inner product) |
| Pooling strategy | top- mean |
| Pooling ratio (default) | 0.1 |
| Temperature (default) | 0.1 |
| Cap (default) | 10.0 |
| Block size (default) | 2,048 |
Initialization. At the start of continual training, the newly introduced TTT components are initialized so that the fast-weight update is negligible, preserving the pre-trained behaviour. Concretely, the depthwise Conv1D (kernel size 5, causal padding, no bias) is zero-initialized, and the projection is a sparse diagonal matrix whose diagonal entries are drawn from with equal to the model's standard initializer range. This yields at step 0, so the effective remains identical to its pre-trained value, and the TTT mechanism emerges smoothly as training progresses.
B.3 Dataset Statistics
We use separate datasets for inference-time evaluation and continual pre-training (CPT). The CPT corpus is filtered by language and context length as described below.
B.3.1 Inference Benchmarks. LongMemEval-S is a benchmark for long-term interactive memory in chat assistants. It contains 500 questions over timestamped histories of approximately 40 sessions and 115K tokens. Its six question types are knowledge update, multi-session, temporal reasoning, single-session user, single-session assistant, and single-session preference. We use the public benchmark and follow its official per-subtask accuracy protocol. LoCoMo evaluates very long-term conversational memory. The public ten-dialogue release contains 1,986 questions over 19–32 sessions and 369–689 turns per dialogue. Its five query types are single-hop, multi-hop, temporal, open-domain, and adversarial reasoning. We use the public dialogues and report overall score by query type.
Table 7: Inference-time evaluation benchmarks.
| Statistic | LongMemEval-S | LoCoMo |
|---|---|---|
| Questions | 500 | 1,986 |
| Context organization | ≈ 40 sessions | 19–32 sessions |
| Context scale | ≈ 115K tokens | 369–689 turns/dialogue |
| Subtasks / query types | 6 subtasks | 5 query types |
| Purpose | inference evaluation | inference evaluation |
B.3.2 CPT Dataset. LongCite-45k [47] is a corpus of approximately 44,600 long-context QA instances with sentence-level citation annotations, designed to train models to answer questions and identify supporting context spans. It was constructed using the Coarse-to-Fine (CoF) pipeline and contains both Chinese and English examples. To maintain data quality and keep the CPT corpus consistent with our long-context English evaluation benchmarks, we retain only English examples whose context lengths are in the 8K–65K token range. We use this filtered English subset for all CPT experiments.
Table 8: LongCite-45k subset used for continual pre-training.
| Statistic | Value |
|---|---|
| Original corpus | ≈ 44,600 QA instances |
| Languages | Chinese and English (mixed) |
| Subset used for CPT | English only |
| Context-length filter | 8K–65K tokens |
| Annotations | sentence-level citation spans |
| Purpose | continual pre-training |
B.4 Training Hyperparameters
Table 9 lists the continual-training hyperparameters for each backbone. Both backbones are trained with the same optimizer and global batch size; the TTT learning rate and the chunk size are shared across methods within a backbone, so the only difference between IP-TTT and Select-TTT is whether the per-chunk multiplier is uniform or query-conditioned. All experiments are conducted on Nvidia H200 GPUs.
Table 9: Continual-training hyperparameters (Protocol II).
| Hyperparameter | Llama-3.1-8B-Instruct | Qwen3-4B |
|---|---|---|
| Optimizer | AdamW | AdamW |
| Peak learning rate | ||
| Weight decay | 0.1 | 0.1 |
| Gradient clipping | 1.0 | 1.0 |
| LR decay ratio | 0.90 | 0.90 |
| Global batch size | 8 | 8 |
| Warmup ratio | 2% | 2% |
| Max. sequence length | 65,536 | 65,536 |
| Training steps | up to 5k | up to 5k |
| Chunk size C | 2,048 | 2,048 |
| TTT learning rate | 0.3 | 0.3 |
| RoPE extension during training | None | YaRN (factor 4) |
B.5 Query Extraction and Evaluation
For every QA instance, the query tokens q of Eq. (8) are obtained by tokenizing the question text with the backbone's own tokenizer. On LongMemEval-S we follow the official evaluation protocol and report accuracy per subtask; on LoCoMo we report overall score per query type. The relevance-signal analysis of Section 5.5 uses the ground-truth answer-chunk annotations of LongMemEval-S's QA instances.
C Additional Results
C.1 Full Numerical Results of Continual-Training
Tables 10 and 11 report per-subtask accuracy at each 1k-step checkpoint from 1k to 5k for CPT, IP-TTT, and Select-TTT on both backbones, complementing the Protocol II results. All values are percentages.
Table 10: Continual-training results on LongMemEval-S with Qwen3-4B. All values are percentages (%).
| Step | Method | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| 1000 | CPT | 43.59 | 20.30 | 24.81 | 3.33 | 76.79 | 34.29 | 32.40 |
| IP-TTT | 35.90 | 24.06 | 28.57 | 3.33 | 73.21 | 37.14 | 33.20 | |
| Select-TTT | 44.87 | 19.55 | 29.32 | 0.00 | 69.64 | 30.00 | 32.00 | |
| 2000 | CPT | 43.59 | 26.32 | 25.56 | 0.00 | 71.43 | 34.29 | 33.40 |
| IP-TTT | 51.28 | 27.07 | 27.07 | 6.67 | 71.43 | 35.71 | 35.80 | |
| Select-TTT | 44.87 | 27.07 | 29.32 | 6.67 | 71.43 | 44.29 | 36.60 | |
| 3000 | CPT | 43.59 | 22.56 | 28.57 | 3.33 | 69.64 | 40.00 | 34.00 |
| IP-TTT | 42.31 | 24.06 | 27.82 | 3.33 | 67.86 | 42.86 | 34.20 | |
| Select-TTT | 50.00 | 22.56 | 25.56 | 3.33 | 75.00 | 40.00 | 34.80 | |
| 4000 | CPT | 43.59 | 19.55 | 33.83 | 0.00 | 71.43 | 47.14 | 35.60 |
| IP-TTT | 46.15 | 26.32 | 29.32 | 3.33 | 67.86 | 45.71 | 36.20 | |
| Select-TTT | 43.59 | 22.56 | 33.08 | 3.33 | 69.64 | 50.00 | 36.60 | |
| 5000 | CPT | 38.46 | 24.06 | 33.08 | 10.00 | 67.86 | 40.00 | 35.00 |
| IP-TTT | 41.03 | 26.32 | 31.58 | 10.00 | 64.29 | 42.86 | 35.60 | |
| Select-TTT | 50.00 | 24.06 | 31.58 | 0.00 | 67.86 | 51.43 | 37.40 | |
Table 11: Continual-training results on LongMemEval-S with Llama-3.1-8B-Instruct. All values are percentages (%). Avg. is the question-weighted overall accuracy. Bold Avg. values indicate the best result at each training step.
| Step | Method | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| 1000 | CPT | 29.49 | 22.56 | 30.08 | 0.00 | 71.43 | 35.71 | 31.60 |
| IP-TTT | 44.87 | 18.80 | 24.81 | 6.67 | 71.43 | 32.86 | 31.60 | |
| Select-TTT | 43.59 | 21.05 | 25.56 | 3.33 | 76.79 | 35.71 | 33.00 | |
| 2000 | CPT | 44.87 | 20.30 | 25.56 | 3.33 | 73.21 | 37.14 | 32.80 |
| IP-TTT | 52.56 | 24.81 | 32.33 | 0.00 | 69.64 | 37.14 | 36.40 | |
| Select-TTT | 46.15 | 21.80 | 29.32 | 6.67 | 71.43 | 44.29 | 35.40 | |
| 3000 | CPT | 43.59 | 21.80 | 27.82 | 3.33 | 73.21 | 41.43 | 34.20 |
| IP-TTT | 44.87 | 21.80 | 28.57 | 6.67 | 71.43 | 45.71 | 35.20 | |
| Select-TTT | 50.00 | 24.81 | 28.57 | 3.33 | 69.64 | 47.14 | 36.60 | |
| 4000 | CPT | 46.15 | 22.56 | 24.06 | 0.00 | 64.29 | 48.57 | 33.60 |
| IP-TTT | 43.59 | 20.30 | 26.32 | 3.33 | 71.43 | 47.14 | 34.00 | |
| Select-TTT | 51.28 | 25.56 | 24.06 | 3.33 | 73.21 | 51.43 | 36.80 | |
| 5000 | CPT | 41.03 | 23.31 | 33.08 | 6.67 | 67.86 | 42.86 | 35.40 |
| IP-TTT | 47.44 | 24.81 | 29.32 | 3.33 | 73.21 | 45.71 | 36.60 | |
| Select-TTT | 56.41 | 26.32 | 34.59 | 3.33 | 71.43 | 47.14 | 39.80 | |
C.2 Full Numerical Results of the Ablation Study
The following six tables provide per-subtask LongMemEval-S results for the temperature ( ), pooling-ratio ( ), and pooling-strategy ablations on both backbones.
Temperature . Tables 12 and 13 report the per-subtask results for on the two backbones. All values are percentages.
Table 12: Temperature ablation on LongMemEval-S with Llama-3.1-8B-Instruct.
| Method | LongMemEval-S | |||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | 0.1 | 52.56 | 22.56 | 28.57 | 13.33 | 64.29 | 54.29 | 37.40 |
| 0.3 | 46.15 | 21.05 | 23.31 | 3.33 | 66.07 | 57.14 | 34.60 | |
| 0.5 | 46.15 | 20.30 | 19.55 | 10.00 | 64.29 | 57.14 | 33.60 | |
Table 13: Temperature ablation on LongMemEval-S with Qwen3-4B.
| Method | LongMemEval-S | |||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | 0.1 | 29.49 | 26.32 | 22.56 | 3.33 | 57.14 | 32.86 | 28.80 |
| 0.3 | 33.33 | 22.56 | 21.05 | 0.00 | 60.71 | 25.71 | 27.20 | |
| 0.5 | 28.21 | 21.05 | 21.05 | 0.00 | 60.71 | 27.14 | 26.20 | |
Pooling ratio . Tables 14 and 15 report the per-subtask results for . All values are percentages.
Table 14: Pooling-ratio ablation on LongMemEval-S with Llama-3.1-8B-Instruct.
| Method | LongMemEval-S | |||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | 0.01 | 53.85 | 23.31 | 24.06 | 6.67 | 64.29 | 54.29 | 36.20 |
| 0.05 | 53.85 | 21.05 | 25.56 | 13.33 | 60.71 | 54.29 | 36.00 | |
| 0.10 | 52.56 | 22.56 | 28.57 | 13.33 | 64.29 | 54.29 | 37.40 | |
| 0.20 | 53.85 | 22.56 | 25.56 | 13.33 | 66.07 | 50.00 | 36.40 | |
Table 15: Pooling-ratio ablation on LongMemEval-S with Qwen3-4B.
| Method | LongMemEval-S | |||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | 0.01 | 37.18 | 18.80 | 20.30 | 3.33 | 64.29 | 21.43 | 26.60 |
| 0.05 | 32.05 | 18.05 | 20.30 | 3.33 | 57.14 | 32.86 | 26.40 | |
| 0.10 | 29.49 | 26.32 | 22.56 | 3.33 | 57.14 | 32.86 | 28.80 | |
| 0.20 | 35.90 | 20.30 | 18.80 | 3.33 | 60.71 | 35.71 | 28.00 | |
Pooling strategy. Tables 16 and 17 compare Max, Mean, and top-k mean pooling on both backbones. All values are percentages.
Table 16: Pooling-strategy ablation on LongMemEval-S with Llama-3.1-8B-Instruct.
| Method | Pooling | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | Max | 53.85 | 21.80 | 18.80 | 6.67 | 67.86 | 60.00 | 35.60 |
| Mean | 50.00 | 19.55 | 20.30 | 3.33 | 64.29 | 45.71 | 32.20 | |
| Top-k mean | 52.56 | 22.56 | 28.57 | 13.33 | 64.29 | 54.29 | 37.40 | |
Table 17: Pooling-strategy ablation on LongMemEval-S with Qwen3-4B.
| Method | Pooling | LongMemEval-S | ||||||
|---|---|---|---|---|---|---|---|---|
| KU | MS | TR | S-Pref. | S-Asst. | S-User | Avg. | ||
| Select-TTT | Max | 38.46 | 20.30 | 18.80 | 3.33 | 60.71 | 35.71 | 28.40 |
| Mean | 33.33 | 20.30 | 21.05 | 0.00 | 62.50 | 28.57 | 27.20 | |
| Top-k mean | 29.49 | 26.32 | 22.56 | 3.33 | 57.14 | 32.86 | 28.80 | |
D Online Resources
The full source code, training and evaluation configurations, and the Select-TTT-enhanced checkpoints will be released at the project repository upon publication.
E Usage of LLMs
Large language models are used in this work in two capacities. First, the method itself operates on open-weight LLMs (Llama-3.1-8B-Instruct and Qwen3-4B). Second, writing assistance was limited to grammar and phrasing suggestions; all technical content, experiments, and final text were prepared and verified by the authors, who take full responsibility for the paper.