Continuous Memory Machines
Ciaran Regan Kai Arulkumaran Luke Darlow
Stefania Druga Sebastian Risi Llion Jones
University of Tsukuba Sakana AI
Recurrent neural networks typically compress information into a single vector-valued recurrent state, forcing short-term computation and long-term retention to share the same representation. Past extensions alleviate this bottleneck by increasing the memory capacity or separating timescales, but lack the combination of rapid neuron-level processing and longer-term retention found in biology. To that end, we introduce the Continuous Memory Machine (CMM), a recurrent architecture with matrix-valued short- and long-term memory states serving distinct functional roles. Building on the Continuous Thought Machine (CTM), the CMM’s short-term memory tracks recent neural activity, with uniquely parameterized neuron-level models learning to use these activity patterns for computation. A persistent long-term memory stores information for later use, with a Transformer jointly updating both memory stores, providing an expressive bidirectional read–write mechanism such that each store can reorganize its own contents and both read from and write to the other. Across algorithmic, in-context learning, and recurrent reasoning tasks, the CMM outperforms a broad suite of baselines, exhibiting stronger generalization than prior memory-augmented networks while preserving the CTM’s interpretable attention patterns. Code is available at GitHub.
1 Introduction
Many complex problems require sequential information to be maintained and manipulated over multiple timescales. A model executing an algorithm, for instance, needs to simultaneously track rapidly changing inputs while managing information acquired earlier. Such tasks can be challenging for Transformers
Several lines of work have sought to address these limitations. Multiscale RNNs introduce hidden states that update with different rates
40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: Personalized, Aligned, Long-Term Memory for AI Systems (PALM).

Biological neural networks present this as a possible solution, with memory organized across interacting dynamical systems with distinct functional roles
To that end, we introduce the Continuous Memory Machine (CMM), a recurrent architecture that explicitly separates short- and long-term memory into distinct matrix-valued recurrent states. The CMM combines the persistent memory mechanisms of MANNs with the CTM’s ability to exploit rich short-term neural dynamics for computation. Its short- and long-term memory states are processed by a shared Transformer, allowing each memory to update its own contents while also exchanging information with the other through learned bidirectional interactions. Across algorithmic, in-context learning, maze-solving, and image-classification tasks, the CMM achieves strong performance and improved generalization while preserving the CTM’s interpretable reasoning behavior. Analysis reveals the CMM learns task-dependent memory strategies, relying on persistent long-term memory for memory-intensive tasks while suppressing cross-memory interaction when it is unnecessary. In summary, our contributions are as follows:
- We introduce the Continuous Memory Machine, an RNN with distinct matrix-valued short- and long-term memories. A shared Transformer updates both, supporting within-memory computation and learned cross-memory interaction.
- We show the CMM achieves strong performance in algorithmic, few-shot learning and reasoning tasks, with improved generalization while preserving the interpretability of the CTM.
- We show that the CMM learns task-dependent memory strategies, using long-term memory for retention and manipulation while suppressing interactions when persistent storage is unnecessary.
2 Related Work
2.1 Recurrent Neural Networks
Recurrent neural networks
Multiscale RNNs aim to capture long-term dependencies through recurrent dynamics operating at different timescales
Fast weight RNNs expand the recurrent state of standard RNNs from a vector to a matrix, increasing its capacity for associative storage
MANNs augment RNNs with external matrix-valued memory stores
Recurrent Transformers introduce memory mechanisms to the Transformer
2.2 Biological Memory
Biological memory is not organized as a single store but instead as a collection of dynamical systems operating at different timescales
3 Method
We introduce the Continuous Memory Machine (CMM), a recurrent architecture with distinct matrix-valued short- and long-term hidden states with different functional roles. The CMM builds on the CTM, draws on the memory mechanisms of MANNs, and, similar to multiscale RNNs, separates timescales to support distinct retention strategies. A Transformer jointly updates the two stores, providing an expressive mechanism for retrieving, writing, and reorganizing memories, both within and across stores. An overview of the architecture is shown in fig. 1. We review the CTM before introducing the CMM architecture.
3.1 Continuous Thought Machines
The CTM is a recurrent architecture whose latent representation is grounded in neural dynamics. It combines two key ideas. First, neuron-level temporal processing: each neuron independently processes a sliding window of its own activation history through a learned transformation, allowing individual neurons to discover distinct temporal features. Second, neural synchronization as the latent representation: pairwise temporal correlations between neuron activities serve as the model’s internal state, providing a smoothly evolving, high-dimensional representation. The CTM architecture is depicted in Appendix fig. 7a.
Concretely, the CTM processes information as follows. At each timestep
where
where
where
3.2 Continuous Memory Machines
Building upon the CTM, we introduce an explicit matrix-valued long-term memory that operates alongside its sliding-window STM. The two memories are jointly updated by a Transformer, providing an expressive mechanism for writing, retrieval, and reorganization across stores.
Long-Term Memory. We define the Long-Term Memory (LTM) as a matrix
Joint Memory Update. At each timestep, the CMM first updates the STM as in the CTM. The synapse produces a pre-activated state
columns of
add learned positional embeddings, and pass
where
Activated State and Recurrence. The updated STM
The neuron-level models therefore operate on the STM after its interaction with the LTM, conditioning each neuron’s update on both its recent pre-activation history and information retrieved from long-term memory. The synchronization
To advance to the next timestep, the updated LTM
Relation to Prior Architectures. The CMM differs from prior MANNs in how memory is accessed and organized. Whereas the DNC
4 Experiments
Our experiments address two questions. First, does the CMM improve memory manipulation and generalization over existing architectures? Second, does it improve the CTM’s reasoning while preserving its interpretable dynamics? We address these questions through algorithmic, maze-solving, in-context learning and image-classification tasks. Unless otherwise stated, we report the mean and standard deviation across three random seeds.
Baselines We compare the CMM against ten baselines chosen to isolate distinct design choices. To isolate the contribution of the long-term memory mechanism, we include the original CTM
Ablations We additionally compare against three parameter-matched architectural ablations. CMM-LSTM replaces the CTM backbone with a LayerNorm LSTM while retaining the LTM and memory-update Transformer, testing the contribution of the CTM’s short-term dynamics. CTM-Ext. extends the STM window to match the CMM’s total memory slots. CMM-STM is a CMM with

testing the CTM’s STM combined with a Transformer, without persistent LTM. Comparing CTM-Ext. and CMM-STM tests the benefit of the Transformer on the STM. Comparing CMM-STM and CMM tests the benefit of a distinct persistent LTM. The Appendix contains detailed architecture comparisons (section A.2), sweeps of LTM size
4.1 Memory Manipulation: Algorithmic Tasks
We evaluate on algorithmic tasks which have been problematic for standard RNNs
Copy. The copy task tests whether a model can store and recall a long sequence of arbitrary information

Recall. While the copy task probes sequential storage and retrieval, recall tests a more complex form of memory access in which one data item points to another
Sort. This task tests whether the model can sort data, an important elementary algorithm
Table 1: Maze-solving test accuracy.
| ARCHITECTURE | ACTION ACC. (%) | MAZE ACC. (%) |
|---|---|---|
| 41.46.9 | 0.70.5 | |
| RNN | 47.22.2 | 2.10.3 |
| LSTM | 50.610.1 | 2.71.7 |
| FS-LSTM | 54.79.8 | 3.31.9 |
| DNC | 82.72.6 | 13.82.5 |
| RMC | 23.72.7 | 0.00.0 |
| NAM-TM | 82.50.7 | 13.20.5 |
| CTM | 88.88.3 | 37.438.7 |
| AB: CMM-LSTM | 46.37.9 | 2.11.2 |
| AB: CMM-STM | 87.017.6 | 43.842.5 |
| CMM (OURS) | 96.33.8 | 61.635.0 |

To test length generalization, we train on input lengths
Parity. The model receives a sequence of random bits followed by a query token and predicts if the sequence is even or odd. We train models on sequence lengths 1–40 and test at length 40. All evaluated architectures except the Transformer and the RMT perform strongly on this task (Figure 2), due to the Transformer’s limited state-tracking capabilities
Across copy, recall, and sort, CMM outperforms CMM-LSTM, showing that the CTM backbone adds value beyond the shared LTM and memory-update Transformer. CTM-Ext. and CMM-STM perform well on copy and recall because their extended STM keeps relevant inputs directly accessible. On sort, which requires selective retrieval and reordering, no ablation surpasses CMM. CMM-STM improves over CTM-Ext. due to the additional Transformer, but it still trails CMM, supporting the benefit of jointly using persistent LTM and transient STM.
4.2 Recurrent Reasoning: Maze-Solving
We revisit the maze-solving task of
We report action and full maze accuracies of held-out mazes in Table 1. The CMM outperforms all baselines1, including the CTM, increasing action accuracy from 88.8% to 96.3% and full maze accuracy from 37.4% to 61.6%. Although variability increases at the longest path lengths, and hence the greater uncertainty the full maze accuracy, the CMM performs markedly better at longer path lengths (Figure 4, bottom), with the strongest single run achieving 90.7% full maze accuracy, with per-seed results are provided in table 9. Its gains over the ablations further highlight the benefit of combining the CTM’s temporal processing with an expressive memory Transformer. Furthermore, the CMM preserves the CTM’s path-following attention behavior (Figure 4, top), with the CMM’s cross attention scanning a path through the maze while predicting the correct sequence of actions.
4.3 In-Context Learning: Few-Shot Regression
Few-shot learning requires a model to incorporate new examples while retaining previous information, making it a natural setting for evaluating short- and long-term memory
Test query accuracies across both support-set sizes are shown in table 2. A query prediction is correct when its absolute error is below 0.05 on the standardized target scale. The CMM achieves the highest mean accuracy in both settings. At
| ARCHITECTURE | ||
|---|---|---|
| TRANSFORMER | ||
| RNN | ||
| LSTM | ||
| FS-LSTM | ||
| GDN | ||
| DNC | ||
| RMC | ||
| LSAM | ||
| NAM-TM | ||
| RMT | ||
| CTM | ||
| AB: CMM-LSTM | ||
| AB: CTM-EXT. | ||
| AB: CMM-STM | ||
| CMM (OURS) | 30.63 0.24 | 9.86 0.07 |
4.4 Image Classification: ImageNet-100
Following
4.5 Analysis: Task-Dependent Memory Usage
To gain insight into how the CMM leverages its STM and LTM, we visualize the Transformer’s attention for various tasks, shown in fig. 6. On copy, STM queries attend predominantly to LTM. On sort, LTM attends to both stores during input, while STM increasingly attends to itself during output. On maze-solving tasks, STM queries attend entirely to the zero-valued sink, suppressing reads from both STM and LTM. This suggests that CMM’s gains arise from the expressivity of the memory Transformers’ feed-forward networks. On ImageNet-100, STM queries read from LTM but increasingly attend to the sink at later iterations. These patterns highlight the CMM’s flexibility to draw on both stores or emphasize one according to the task. By augmenting the CTM’s short-term temporal processing with a separately accessible persistent store, the CMM can leverage long-term memory when useful while retaining the ability to rely on short-term computation.
5 Discussion and Conclusion
The Continuous Memory Machine combines the expressive short-term processing of the CTM with the persistent long-term memory of MANNs. The CMM’s two matrix-valued recurrent states are jointly processed by a Transformer, acting as an expressive bidirectional read–write mechanism.
Table 3: ImageNet-100 accuracy. The CMM is among the top performing baselines.
| ARCHITECTURE | ACC. (%) |
|---|---|
| RNN | |
| LSTM | |
| FS-LSTM | |
| GDN | |
| DNC | |
| RMC | |
| LSAM | |
| NAM-TM | |
| RMT | |
| CTM | |
| CMM (OURS) |


The CMM outperforms a suite of baselines, with improved performance in algorithmic, in-context learning and maze-solving tasks. The CMM improves upon the generalization capabilities of prior MANNs, while maintaining the interpretable attention patterns of the CTM. Ablations support the benefits of utilizing the CTM’s short-term neuron-level processing, with the LSTM variant performing markedly worse throughout. Furthermore, analyzing the attention patterns of the CMM’s memory Transformer highlights the flexibility of the CMM, with the model relying on LTM for algorithmic tasks and in-context learning, yet bypassing it when not required.
The benefits of the CMM come with additional costs and limitations. First, the CMM introduces additional hyperparameters, namely the LTM size
More broadly, the CMM serves as an example of how principles drawn from biological memory can inspire neural architectures with capabilities beyond those exhibited by existing recurrent models, combining flexible short-term computation with persistent storage to improve both algorithmic generalization and recurrent reasoning.
AI use statement
In this work we used generative AI tools for polishing the writing. Furthermore, we used AI as a coding tool for building out some of the baseline architectures based on the original papers and their corresponding codebases. One author has tested the correctness of the code. For example, when building out the GDN baseline
Reproducibility statement
To ensure reproducibility of this work, we release all code at GitHub. The repository contains everything needed to reproduce the main results, including the baselines, for all tasks. Instructions on how to run each task are described in the README.md of the codebase. A single NVIDIA H100 was used for each experiment in the paper, and is sufficient to reproduce the results.
References
[2] Grégoire Delétang, Anian Ruoss, Jordi Grau-Moya, Tim Genewein, Li Kevin Wenliang, Elliot Catt, Chris Cundy, Marcus Hutter, Shane Legg, Joel Veness, et al. Neural networks and the chomsky hierarchy. arXiv preprint arXiv:2207.02098, 2022.
[3] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
[4] Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
[5] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
[6] J. Schmidhuber. Neural sequence chunkers. Technical Report FKI-148-91, Institut für Informatik, Technische Universität München, April 1991.
[7] Jan Koutnik, Klaus Greff, Faustino Gomez, and Juergen Schmidhuber. A clockwork rnn. In International conference on machine learning, pages 1863–1871. PMLR, 2014.
[8] Jürgen Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. Neural Computation, 4(1):131–139, 1992.
[9] Imanol Schlag, Kazuki Irie, and Jürgen Schmidhuber. Linear transformers are secretly fast weight programmers. In International conference on machine learning, pages 9355–9366. PMLR, 2021.
[10] Songlin Yang, Jan Kautz, and Ali Hatamizadeh. Gated delta networks: Improving mamba2 with delta rule. arXiv preprint arXiv:2412.06464, 2024.
[11] Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
[12] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Proceedings of the 57th annual meeting of the association for computational linguistics, pages 2978–2988, 2019.
[13] Aydar Bulatov, Yury Kuratov, and Mikhail Burtsev. Recurrent memory transformer. Advances in neural information processing systems, 35:11079–11091, 2022.
[15] Larry R Squire. Memory systems of the brain: a brief history and current perspective. Neurobiology of learning and memory, 82(3):171–177, 2004.
[16] Dharshan Kumaran, Demis Hassabis, and James L McClelland. What learning systems do intelligent agents need? complementary learning systems theory updated. Trends in cognitive sciences, 20(7):512–534, 2016.
[17] Luke Darlow, Ciaran Regan, Sebastian Risi, Jeffrey Seely, and Llion Jones. Continuous thought machines. In Advances in Neural Information Processing Systems, 2025.
[18] Anthony J Robinson and Frank Fallside. The utility driven dynamic error propagation network, volume 11. University of Cambridge Department of Engineering Cambridge, 1987.
[19] Paul J Werbos. Generalization of backpropagation with application to a recurrent gas market model. Neural networks, 1(4):339–356, 1988.
[20] Ronald J. Williams. Complexity of exact gradient computation algorithms for recurrent neural networks. Technical Report NU-CCS-89-27, Northeastern University, College of Computer Science, Boston, 1989.
[21] Jeffrey L Elman. Finding structure in time. Cognitive science, 14(2):179–211, 1990.
[22] Sepp Hochreiter, Yoshua Bengio, Paolo Frasconi, Jürgen Schmidhuber, et al. Gradient flow in recurrent nets: the difficulty of learning long-term dependencies, 2001.
[23] Jürgen Schmidhuber. Learning complex, extended sequences using the principle of history compression. Neural computation, 4(2):234–242, 1992.
[24] Junyoung Chung, Sungjin Ahn, and Yoshua Bengio. Hierarchical multiscale recurrent neural networks. arXiv, 2016.
[25] Asier Mujika, Florian Meier, and Angelika Steger. Fast-slow recurrent neural networks. Advances in Neural Information Processing Systems, 30, 2017.
[26] Geoffrey E Hinton and David C Plaut. Using fast weights to deblur old memories. In Proceedings of the ninth annual conference of the Cognitive Science Society, pages 177–186, 1987.
[27] Kazuki Irie and Samuel J Gershman. Fast weight programming and linear transformers: from machine learning to neurobiology. arXiv, 2025.
[28] Albert Gu, Karan Goel, and Christopher Ré. Efficiently modeling long sequences with structured state spaces. arXiv, 2021.
[29] Jimmy TH Smith, Andrew Warrington, and Scott W Linderman. Simplified state space layers for sequence modeling. arXiv, 2022.
[30] Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv, 2023.
[31] Maximilian Beck, Korbinian Pöppel, Markus Spanring, Andreas Auer, Oleksandra Prudnikova, Michael Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter. xlstm: Extended long short-term memory. Advances in Neural Information Processing Systems, 37:107547–107603, 2024.
[32] Bernard Widrow and Marcian E Hoff. Adaptive switching circuits (in ire wescon convention record 1960). SPIE MILESTONE SERIES MS, 96:105–105, 1994.
[33] Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. Advances in neural information processing systems, 28, 2015.
[35] Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Meta-learning with memory-augmented neural networks. In International conference on machine learning, pages 1842–1850. PMLR, 2016.
[36] Yan Wu, Greg Wayne, Alex Graves, and Timothy Lillicrap. The kanerva machine: A generative distributed memory. arXiv, 2018.
[37] Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwińska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016.
[38] Adam Santoro, Ryan Faulkner, David Raposo, Jack Rae, Mike Chrzanowski, Theophane Weber, Daan Wierstra, Oriol Vinyals, Razvan Pascanu, and Timothy Lillicrap. Relational recurrent neural networks. Advances in neural information processing systems, 31, 2018.
[39] Hyoungwook Nam and Seung Byum Seo. Neural attention memory. arXiv, 2023.
[40] DeLesley Hutchins, Imanol Schlag, Yuhuai Wu, Ethan Dyer, and Behnam Neyshabur. Block-recurrent transformers. Advances in neural information processing systems, 35:33248–33261, 2022.
[41] Aniket Didolkar, Kshitij Gupta, Anirudh Goyal, Nitesh Bharadwaj Gundavarapu, Alex M Lamb, Nan Rosemary Ke, and Yoshua Bengio. Temporal latent bottleneck: Synthesis of fast and slow processing mechanisms in sequence learning. Advances in Neural Information Processing Systems, 35:10505–10520, 2022.
[42] Mark G Stokes. ‘activity-silent’ working memory in prefrontal cortex: a dynamic coding framework. Trends in cognitive sciences, 19(7):394–405, 2015.
[43] Joao Barbosa, Heike Stein, Rebecca L Martinez, Adrià Galan-Gadea, Sihai Li, Josep Dalmau, Kirsten CS Adam, Josep Valls-Solé, Christos Constantinidis, and Albert Compte. Interplay between persistent activity and activity-silent dynamics in the prefrontal cortex underlies serial biases in working memory. Nature neuroscience, 23(8):1016–1024, 2020.
[44] Wolf Singer. Neuronal synchrony: a versatile code for the definition of relations? Neuron, 24 (1):49–65, 1999.
[45] Pascal Fries. A mechanism for cognitive dynamics: neuronal communication through neuronal coherence. Trends in cognitive sciences, 9(10):474–480, 2005.
[46] Takeru Miyato, Sindy Löwe, Andreas Geiger, and Max Welling. Artificial kuramoto oscillatory neurons. In International Conference on Learning Representations, volume 2025, pages 44278–44322, 2025.
[47] Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. Efficient streaming language models with attention sinks. arXiv, 2023.
[48] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv, 2016.
[49] Riccardo Grazzi, Julien Siems, Arber Zela, Jörg Franke, Frank Hutter, et al. Unlocking state-tracking in linear rnns through negative eigenvalues. In International Conference on Learning Representations, volume 2025, pages 36565–36597, 2025.
[50] Michael Hahn. Theoretical limitations of self-attention in neural sequence models. Transactions of the Association for Computational Linguistics, 8:156–171, 2020.
[51] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International conference on machine learning, pages 1126–1135. PMLR, 2017.
[53] Feng Wang, Sucheng Ren, Tiezheng Zhang, Predrag Neskovic, Anand Bhattad, Cihang Xie, and Alan Yuille. Vit-5: Vision transformers for the mid-2020s. arXiv, 2026.
[54] Federico Danieli, Pau Rodriguez, Miguel Sarabia, Xavier Suau, and Luca Zappella. Pararnn: Unlocking parallel training of nonlinear rnns for large language models. In International Conference on Learning Representations, volume 2026, pages 53548–53579, 2026.
[55] Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tieyan Liu. On layer normalization in the transformer architecture. In International conference on machine learning, pages 10524–10533. PMLR, 2020.
[56] Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International conference on machine learning, pages 933–941. PMLR, 2017.
[57] Biao Zhang and Rico Sennrich. Root mean square layer normalization. Advances in neural information processing systems, 32, 2019.
[58] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv, 2014.
[59] Anders Krogh and John Hertz. A simple weight decay can improve generalization. Advances in neural information processing systems, 4, 1991.
A Architecture Details
A.1 CMM Details
This section provides the full architectural specification of the CMM. For notational clarity in this section, we treat sequences as having tokens along the leading dimension, which is the transpose of the convention used in the main text.
Learnable Initialization. The LTM is initialized with a learned matrix
Sink Token. A learned vector
Positional Embeddings. A learned matrix
Transformer Block. Each of the
where
also bias-free. Two design choices merit emphasis. First, the positional embeddings are added to the queries and keys but not to the values
Residual Gate. For Maze and Parity, each block has its own unconstrained learned scalar
Output Processing. After the final Transformer block, the output sequence is sliced as in eq. (5). Layer normalization is applied to the updated LTM tokens before they are carried forward to the next timestep:
The updated STM tokens are passed to the neuron-level models.
Neuron-Level Models. The NLMs follow the same SuperLinear-GLU structure as the CTM
where
A.2 Architectural Comparison
We provide a more detailed overview of the ablation described in section 4. Side-by-side diagrams of the full architectures are shown in Figure 7, and a closer comparison of the memory-update modules is shown in Figure 8. The CMM and CMM-LSTM share an identical LTM and memory-update Transformer; they differ only in how the short-term state is represented. The CMM passes the full sliding window of
A.3 Synchronization Normalization
The original CTM
In our implementation, we remove the square root from the denominator. The square root causes the numerator and denominator to grow at different rates with
We compute synchronization for

B Additional Ablations
B.1 Memory capacity and update depth
We evaluate how Priority Sort performance changes with long-term memory capacity and memory update depth. For the capacity sweep, we reduce the STM length to

C Compute Resources
Experiments were run on a single NVIDIA H100 GPU. Mean training-loop wall times per CMM seed are listed in table 4. These include periodic evaluation and checkpointing, and exclude model setup, queueing, and downtime between resumed jobs. For Maze, we sum the original 4,500-epoch run and its 4,500-epoch continuation; both use 50 internal iterations, giving 9,000 epochs in total. Means are

taken over three seeds, so total GPU-hours are three times the per-seed values, even when seeds run concurrently. Baseline architectures were trained under matched conditions. The full research project required additional compute beyond the reported experiments, including preliminary architecture exploration, hyperparameter tuning, and ablations that are not included in the final paper.
To characterize computational cost, we benchmark all architectures on batches of 64 complete Copy-100 sequences, each containing 100 input and 100 output steps. Hidden widths are selected independently under a 500K parameter budget, including a linear
Table 4: Mean training-loop wall time per CMM seed on a single NVIDIA H100 GPU.
| Experiment | Epochs | Time per seed |
|---|---|---|
| Copy | 1000 | 6.9 h |
| Associative Recall | 1000 | 1.1 h |
| Sort | 1000 | 3.0 h |
| Sort (length gen.) | 3000 | 2.2 h |
| Parity | 200 | 0.6 h |
| Few-Shot Regression | 1000 | 1.3–1.8 h |
| ImageNet-100 | 25 | 0.9 h |
| Maze | 9000 | 127.5 h |
Table 5: GPU efficiency on complete Copy-100 sequences (batch size 64, sequence length 200). Times are amortized milliseconds per step, obtained by dividing full-sequence latency by 200; the Transformer processes the sequence in parallel and RMT uses ten-step segments. State is persistent memory per example (KiB); peak is allocated GPU memory for a complete forward+backward pass (MiB). The sequence Transformer has no recurrent state.
| Architecture | Params | Fwd/step | Fwd+Bwd/step | State | Peak | |
|---|---|---|---|---|---|---|
| Transformer | 479,278 | 100 | 0.011 | 0.032 | – | 639.4 |
| RNN | 499,170 | 668 | 0.066 | 0.246 | 2.61 | 201.4 |
| LSTM | 497,558 | 318 | 0.147 | 0.548 | 2.48 | 336.2 |
| FS-LSTM | 494,926 | 149 | 0.450 | 1.473 | 2.33 | 415.4 |
| GDN | 495,946 | 480 | 0.555 | 2.126 | 275.62 | 7,248.0 |
| DNC | 498,220 | 271 | 1.266 | 5.097 | 78.20 | 3,175.0 |
| RMC | 479,822 | 108 | 0.412 | 1.464 | 13.50 | 3,079.1 |
| LSAM | 496,122 | 372 | 0.219 | 0.976 | 136.59 | 3,644.1 |
| NAM-TM | 496,992 | 170 | 0.960 | 4.706 | 67.33 | 2,039.4 |
| RMT | 496,682 | 160 | 0.255 | 0.856 | 80.00 | 8,646.6 |
| CTM | 498,802 | 472 | 0.360 | 1.256 | 25.81 | 634.5 |
| Ab: CMM-LSTM | 491,054 | 204 | 0.529 | 1.793 | 27.09 | 4,587.7 |
| Ab: CTM-Ext. | 498,092 | 390 | 0.359 | 1.257 | 216.33 | 3,145.8 |
| Ab: CMM-STM | 495,862 | 212 | 0.850 | 2.755 | 117.59 | 21,325.3 |
| CMM (Ours) | 486,474 | 224 | 0.870 | 2.813 | 124.25 | 22,330.1 |
D Experimental Details
Unless otherwise noted in a task-specific subsection, experiments use the AdamW optimizer
Priority Sort length generalization. For Maze and Parity, each CMM memory update Transformer block uses a learned scalar initialized to zero. The scalar scales both the attention and feed-forward residual branches. All other CMM experiments use ungated residual updates. Table 6 summarizes the remaining training hyperparameters for each task. Table 7 lists the CMM-specific architectural hyperparameters used for each task. Task-specific details follow in the subsequent sections. The error bars in figs. 2 and 3 show one standard deviation over three seeds.
Table 6: Per-task training hyperparameters.
| Task | Loss | Num. Epochs | Batch Size | Grad. Clip |
|---|---|---|---|---|
| Copy | MSE | 1000 | 128 | 5 |
| Associative Recall | BCE | 1000 | 32 | 50 |
| Priority Sort | BCE | 1000 | 32 | 50 |
| Parity | BCE | 200 | 64 | 5 |
| Few-Shot Regression | MSE | 1000 | 64 | 5 |
| ImageNet-100 | CE | 25 | 64 | 1 |
| Maze | Dual-tick CE | 9000 | 1024 | 1 |
Table 7: CMM-specific hyperparameters for each task.
| Task | ||||
|---|---|---|---|---|
| Copy | 10 | 128 | 1 | 8 |
| Associative Recall | 10 | 32 | 1 | 8 |
| Priority Sort | 20 | 128 | 2 | 8 |
| Parity | 4 | 4 | 1 | 8 |
| Few-Shot Regression | 10 | 32 | 1 | 8 |
| ImageNet-100 | 10 | 32 | 1 | 4 |
| Maze | 10 | 8 | 1 | 16 |
Transformer baseline. On Copy, Associative Recall, and Priority Sort, the Transformer uses four independently parameterized causal pre-normalization layers with hidden dimension 100, four attention heads, GELU feed-forward sublayers of dimension 384, fixed sinusoidal positional embeddings, a final layer normalization, and no dropout. The maximum context lengths are 256 for Copy, 32 for Associative Recall, and 64 for Priority Sort, in each case covering the complete input–output sequence. The respective models have 479,278, 478,554, and 479,012 trainable parameters and otherwise use the shared task-specific optimization settings in table 6. The smaller Transformer used for length generalization is specified in section D.3.
Recurrent Memory Transformer baseline. The RMT
Table 8: RMT configurations. Parameter counts exclude the frozen ImageNet backbone.
| Task | Segment length | Memory tokens | Parameters | |
|---|---|---|---|---|
| Copy | 160 | 10 | 128 | 496,682 |
| Associative Recall | 160 | 10 | 32 | 480,358 |
| Priority Sort | 160 | 20 | 128 | 496,296 |
| Priority Sort (length gen.) | 52 | 4 | 22 | 54,752 |
| Parity | 56 | 4 | 4 | 59,569 |
| Few-Shot Regression | 160 | 10 | 32 | 496,801 |
| ImageNet-100 | 152 | 1 | 32 | 997,876 |
D.1 Copy Task
The model receives a sequence of
D.2 Associative Recall
Each trial presents items, with sampled uniformly from , each consisting of 3 binary vectors of 6 bits. The item sequence is zero-padded to 18 vector steps, followed by a delimiter, a three-vector query item, a second delimiter, and three output slots. The query is sampled uniformly from the first items, and the model must output its successor in the original sequence. Binary cross-entropy is computed only over the three output vectors. The dataset consists of 6,400 procedurally generated episodes per epoch.
D.3 Priority Sort
The model receives input items, each consisting of a scalar priority drawn uniformly from and an associated 8-bit binary value vector. After the input phase, the model must output the 16 value vectors corresponding to the 16 lowest-priority items, sorted in ascending order of priority. The loss is binary cross-entropy computed over the output positions. The dataset consists of 6,400 procedurally generated episodes per epoch.
Length generalization. For Figure 2, we use , , and three training seeds per model. Each training batch contains a single input length, with lengths balanced across the 13 batches of 64 episodes in each epoch. All models train for 3,000 epochs under a 60K parameter budget, using AdamW with learning rate
D.4 Parity
Each example contains independent uniformly sampled bits followed by a query token. The target is one if the number of set bits is odd and zero otherwise. Binary cross-entropy is computed only at the query step. All models use three seeds, a 60K parameter budget, zero dropout, and 200 training epochs with 8,192 generated examples per epoch. Training lengths vary from 1 to 40. We evaluate on 512 examples at each length in and report the final epoch. The CMM uses and ; the standard CTM uses , and CTM-Ext. uses to match the CMM’s total memory capacity.
D.5 Few-Shot Regression
In each episode a new target linear function with is sampled. The model receives support pairs with sequentially, followed by 20 query inputs for which it must predict outputs. We evaluate with . Training minimizes MSE over the complete episode. Evaluation reports accuracy only on the 20 query predictions: the fraction satisfying , pooled over all test episodes. The clean targets are standardized
to zero mean and unit sample standard deviation within each episode before noise is added to the support-value inputs. Thus the threshold is 0.05 target standard deviations; support predictions do not enter the reported accuracy. At each step, the 12 input variables, observed-value channel, and support-mask bit are mapped to the model’s hidden dimension by a learned linear projection followed by a ReLU activation. The dataset consists of 10,000 episodes, with fresh functions sampled each epoch.
CTM-Ext. uses
The Transformer baseline uses four independently parameterized causal pre-normalization layers with hidden dimension 104, four attention heads, and GELU feed-forward sublayers of dimension 384. It uses fixed sinusoidal positional embeddings, a maximum sequence length of 64, a final layer normalization, and no dropout. The causal mask restricts each position to the current and preceding items. A linear head maps each output representation to a scalar prediction. The model has 498,033 trainable parameters and otherwise uses the shared optimization settings in table 6.
D.6 Image Classification (ImageNet-100)
We use the ImageNet-100 subset containing 100 classes with images resized to
D.7 Maze-Solving
We evaluate on the large maze dataset ( grids)
The loss uses dual-tick selection: for each sample we compute the per-route-step cross-entropy at every internal tick, then average the loss at the minimum-CE tick and the most-certain tick (the tick with lowest mean output entropy over route steps). An auto-curriculum mask restricts the loss to the first
We target 9,000 epochs with an effective batch size of 1,024 and learning rate
Table 9 lists both test accuracies for each seed. NAM-TM and CMM-STM completed all three seeds at epoch 9,000. RMC seed 2 stopped after a gradient spike during epoch 5,076; we retain its last recorded test evaluation at epoch 5,075. Every other run included in the tables ends at epoch 9,000.
Incomplete baselines. RMT likewise exhibited unstable training and did not complete the 9,000-epoch schedule, so we omit its Maze results. For LSAM and GDN, the reference per-device batch size of 1,024 exceeded the available GPU memory. Smaller microbatches reduced memory usage, but matching the effective batch size required multiple sequential forward and backward passes per optimizer update. The resulting runtime made the full 9,000-epoch schedule impractical within our compute budget. We therefore omit LSAM and GDN from the Maze tables.
Table 9: Final available test action and board (full-maze) accuracies (%) for each training seed. Ending epochs are listed in the text; aggregate results appear in table 1.
| Seed 0 | Seed 1 | Seed 2 | ||||
|---|---|---|---|---|---|---|
| Architecture | Action | Board | Action | Board | Action | Board |
| Transformer | 33.82 | 0.20 | 43.40 | 1.10 | 47.09 | 0.84 |
| RNN | 49.63 | 2.27 | 46.67 | 2.34 | 45.25 | 1.80 |
| LSTM | 39.67 | 1.06 | 52.66 | 2.51 | 59.46 | 4.47 |
| FS-LSTM | 59.53 | 4.10 | 61.23 | 4.58 | 43.48 | 1.08 |
| DNC | 81.44 | 12.75 | 81.00 | 12.04 | 85.76 | 16.70 |
| RMC | 25.26 | 0.00 | 25.10 | 0.00 | 20.59 | 0.00 |
| NAM-TM | 83.13 | 13.39 | 82.62 | 13.64 | 81.70 | 12.68 |
| CTM | 86.76 | 18.20 | 97.93 | 81.95 | 81.64 | 11.96 |
| Ab: CMM-LSTM | 46.64 | 1.57 | 54.04 | 3.52 | 38.27 | 1.24 |
| Ab: CMM-STM | 98.32 | 86.64 | 95.82 | 42.92 | 66.75 | 1.74 |
| CMM (Ours) | 97.90 | 71.28 | 91.93 | 22.84 | 99.08 | 90.73 |
Footnotes
-
GDN, RMT, and LSAM could not train stably and are therefore excluded. See section D.7. ↩