Papers
Topics
Authors
Recent
Search
2000 character limit reached

Recurrent Memory Transformers

Updated 10 February 2026
  • Recurrent Memory Transformers are neural models that integrate explicit segment-level memory tokens to efficiently process extremely long sequences.
  • They use self-attention confined to input segments and propagate compact, trainable memory representations to maintain global context with linear scaling.
  • Variants like ARMT and CRT demonstrate improved accuracy and efficiency across language, vision, and reinforcement learning tasks while minimizing computational overhead.

Recurrent Memory Transformers (RMT) are a class of neural sequence models that augment standard Transformer architectures with explicit segment-level memory recurrence, enabling efficient processing of extremely long sequences far beyond the quadratic limits imposed by global attention. RMTs partition input sequences into segments, process each with self-attention constrained to the segment, and propagate compact, trainable memory representations forward, thereby preserving global context with strictly linear scaling in both memory and computation. This paradigm, instantiated in diverse forms—including Associative Recurrent Memory Transformer (ARMT), Compact Recurrent Transformer (CRT), memory-augmented vision/LLMs, and biologically inspired variants—not only achieves state-of-the-art performance on long-context synthetic and real-world benchmarks but also enables scalable deployment on conventional hardware.

1. Architectural Foundations and Core Mechanism

At the heart of RMT lies segment-level recurrence implemented via explicit memory tokens. The input sequence of length SS is divided into TT non-overlapping segments X1,...,XTX_1, ..., X_T, each of a fixed length LL—with S=TLS = T L. For each segment τ\tau, a memory state Mτ−1∈Rm×dM_{\tau-1} \in \mathbb{R}^{m\times d} is prepended to the segment tokens. The augmented input for the Transformer at time τ\tau is then:

H~τ0=[Mτ−1 Xτ]∈R(m+L)×d\tilde H^0_{\tau} = \begin{bmatrix} M_{\tau-1} \ X_{\tau} \end{bmatrix} \in \mathbb{R}^{(m+L)\times d}

After passing through NN Transformer layers, the output corresponding to the first TT0 positions is taken as the updated memory:

TT1

Memory read–write operations are thus learned end-to-end via the self-attention mechanism itself; no modifications to the underlying Transformer block or explicit gating are required in the baseline RMT formulation (Bulatov et al., 2022, Bulatov et al., 2023).

Variants may use memory concatenation at both the start and end of a segment, bidirectional memory attendance, or more complex per-layer or per-task memory organizations (Rodkin et al., 2024, Kashyap, 1 Jul 2025, Cherepanov et al., 2023).

2. Mathematical Formulation and Memory Dynamics

Memory recurrence in RMT is defined by the update rule:

TT2

where TT3 denotes a multi-layer Transformer applied to the segment concatenated with its recurrent memory. During each step, all hidden states—both memory and segment tokens—participate in full self-attention within TT4.

More sophisticated memory mechanisms extend this formulation:

  • Associative updates (ARMT): At each Transformer layer TT5 and segment TT6, an associative fast-weight store TT7 is updated by delta rules with normalization corrections involving key-value memory token pairs, supporting true TT8 associative recall per-segment (Rodkin et al., 2024).
  • Gating or GRU-style updates: Models such as HIPPO-CRAM, MART, or certain video/MT models integrate GRU- or LSTM-style gates into memory update equations, e.g.,

TT9

for an update gate X1,...,XTX_1, ..., X_T0 and candidate X1,...,XTX_1, ..., X_T1 (Lei et al., 2020, Kashyap, 1 Jul 2025, Bulatov et al., 2023).

  • External episodic memory: For discourse or commonsense tasks, episodic memory is managed as a dynamically expanding slot bank updated and accessed via global similarity projections rather than per-token attention (Gabriel et al., 2020).
  • Astrocyte-inspired retention: In RMAAT, long-term memory compression and decay are adaptively managed by astrocyte-modeled retention factors X1,...,XTX_1, ..., X_T2 applied pointwise to segment memory updates, yielding normalization X1,...,XTX_1, ..., X_T3 and enforcing bounded memory growth (Mia et al., 1 Jan 2026).

3. Computational Complexity and Scaling

RMTs achieve linear or subquadratic complexity by restricting attention to small segments and propagating constant-size memory:

  • Standard Transformers require X1,...,XTX_1, ..., X_T4 per layer due to global attention over length-X1,...,XTX_1, ..., X_T5 sequences.
  • RMTs reduce segment cost to X1,...,XTX_1, ..., X_T6 for attention over X1,...,XTX_1, ..., X_T7 tokens and X1,...,XTX_1, ..., X_T8 for memory-related updates, with totals scaling as X1,...,XTX_1, ..., X_T9, i.e., linear in sequence length for fixed LL0 and LL1 (Bulatov et al., 2022, Bulatov et al., 2023).
  • ARMT and associative variants maintain LL2 per-segment time for memory operations; overall, this yields true constant time per segment as LL3 grows (Rodkin et al., 2024).
  • Diagonal Batching further exploits the recurrent computation DAG structure, scheduling by layer+segment anti-diagonals to parallelize across segments and layers, reducing GPU kernel launch overhead from LL4 to LL5 and enabling up to 3.3x speedup at 131,072 tokens (Sivtsov et al., 5 Jun 2025).

4. Empirical Performance Across Domains

RMTs and their relatives consistently set new performance records on long-context benchmarks:

A summary table of long-context QA results for single-fact retrieval (QA1) from (Rodkin et al., 2024):

Context Length GPT-4 RMT Mamba ARMT
64k 30.0% 99.6% 100.0% 100.0%
128k 24.0% 99.1% 99.5% ± 0.2 99.9% ± 0.2
1M – 94.2% 92.3% ± 1.1 98.5% ± 1.0
10M – 76.4% – 89.4% ± 8.1
50M – – – 79.9%

5. Design Variants and Domain-Specific Extensions

RMT has been widely adapted for distinct tasks and modalities:

  • Associative/fast-weight memory: ARMT uses a per-layer associative store updated by a delta rule with normalization, achieving high capacity for fact storage and supporting true key-value associative recall (Rodkin et al., 2024).
  • GRU/LSTM-inspired memory compression: CRT and paragraph captioning models incorporate memory updates governed by gated RNNs or LSTM/GRU-style equations, facilitating gradient stability and informative compression (Mucllari et al., 2 May 2025, Lei et al., 2020).
  • Unification of local/global/chunked attention: Hybrid architectures fuse global in-chunk attention, sliding-window local attention, and cross-chunk memory with learnable fusion weights for robust multi-scale modeling (Kashyap, 1 Jul 2025).
  • Biological inspiration: RMAAT incorporates astrocyte-derived retention factors and Hebbian/astrocyte interaction rules for memory compression and capacity normalization (Mia et al., 1 Jan 2026).
  • Application-layer specialization: Recurrent memory modules have been used to track paragraph-level commonsense inferences (Gabriel et al., 2020), maintain document-level translation context (Feng et al., 2022), and compress video sequences into global embeddings for VQA (Peng et al., 2024).

6. Implementation, Training, and Computational Considerations

Implementing RMT requires:

  • Minor architectural modifications: only an additional memory-tokens input/output buffer and code for carrying forward these tokens across segments. The core Transformer block is unchanged in most variants (Bulatov et al., 2022, Bulatov et al., 2023).
  • Curriculum learning is frequently essential: models are initially trained for short unroll lengths and gradually exposed to longer sequences, stabilizing memory usage and preventing divergence (Bulatov et al., 2023).
  • Backpropagation through time (BPTT): Gradients are propagated through sequence-unrolled segments, typically for LL7 steps (truncated BPTT), though memory replay schemes such as AMRB minimize storage requirements by recomputation (Mia et al., 1 Jan 2026).

Key recommendations include careful choice of memory size LL8 (typically 1–32), judicious scheduling of segment lengths, and Pre-LayerNorm around blocks for stable deep stacks (Kashyap, 1 Jul 2025, Feng et al., 2022).

7. Limitations, Comparative Analysis, and Future Directions

While RMTs provide transformative gains in long-context efficiency and compactness, some limitations persist:

  • Parallelism: Sequential processing of segments incurs latency for short contexts; Diagonal Batching partially mitigates this constraint (Sivtsov et al., 5 Jun 2025).
  • Compression capacity: Small fixed-size memory must distill exponentially growing context; poor memory or curriculum design leads to information bottlenecks and degraded performance (Bulatov et al., 2023).
  • Task suitability: RMT may not improve over vanilla Transformers when the full context fits in a single segment, or when memory tokens are insufficient to store all relevant information (Cherepanov et al., 2023, Mucllari et al., 2 May 2025).
  • Training complexity: BPTT or replay is necessary for gradient propagation, with nontrivial memory and compute trade-offs (Bulatov et al., 2023, Mia et al., 1 Jan 2026).
  • Theoretical analysis of memory capacity: Open questions include optimal memory sizing, hybridization with retrieval systems, and scaling to billion-parameter models (Rodkin et al., 2024).

Ongoing lines of inquiry target hybrid retrieval architectures, adaptive memory budgeting, further kernel/hardware optimization, and biological circuit–inspired compression (Sivtsov et al., 5 Jun 2025, Mia et al., 1 Jan 2026). The RMT paradigm provides a unifying abstraction for long-context modeling and is likely foundational for efficient next-generation sequence models across domains.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Recurrent Memory Transformers (RMT).