Summary (Overview)

  • MARCH (Memory-Anchor Routing across Context History) is a novel architecture that augments recurrent state-space models with content-routed state anchors, enabling selective retrieval from earlier versions of the evolving recurrent memory without modifying the underlying recurrence.
  • The method periodically checkpoints cumulative recurrent states as "state anchors," each paired with a compact content-conditioned key, creating a memory bank that grows with context length.
  • MARCH uses an attention-style routing mechanism over state anchors (rather than token-level key-value pairs), including a learned null option to bypass historical memory when the current state is sufficient.
  • Extensive experiments show MARCH consistently outperforms Gated DeltaNet and its Log-Linear variant across commonsense reasoning (Avg. 41.5 vs 40.1/40.0), LongBench (Avg. 14.9 vs 11.9/12.5), in-context retrieval (Avg. 23.3 vs 19.2/20.5), and NIAH tasks, including robust extrapolation beyond training context length.
  • The architecture achieves competitive training efficiency: at 128K tokens, Top-4 sparse MARCH more than doubles the throughput of dense MARCH and exceeds FlashAttention-2 throughput.

Introduction and Theoretical Foundation

Background and Motivation

Large language models require effective long-context modeling, which depends on a model's ability to manage memory—determining what to preserve, how to represent it, and when to retrieve it. The paper frames sequence models as memory systems with two operations:

  • Writing: incorporating new input into memory
  • Reading: retrieving information relevant to the current input

Standard self-attention maintains a growing token-level memory in its key-value cache, providing a direct path to every preceding token. However, this incurs:

  • Quadratic computation during training: O(T2)O(T^2)
  • Key-value cache growing linearly during autoregressive inference: O(T(dk+dν))O(T(d_k + d_\nu)) per attention head

Recurrent alternatives (linear attention, state-space models) compress history into a fixed-size state:

  • Enable constant-memory recurrent decoding
  • But underperform on recall-intensive tasks since earlier associations get overwritten by subsequent updates

Theoretical Foundation

Memory system formulation: Let xtRd\mathbf{x}_t \in \mathbb{R}^d denote the hidden representation at position tt. The query, key, and value vectors are obtained via:

qt=Wqxt,kt=Wkxt,vt=Wνxt,(1)\mathbf{q}_t = \mathbf{W}_q \mathbf{x}_t, \quad \mathbf{k}_t = \mathbf{W}_k \mathbf{x}_t, \quad \mathbf{v}_t = \mathbf{W}_\nu \mathbf{x}_t,\tag{1}

The general memory system is:

Mt=Write(Mt1;kt,vt),ot=Read(Mt;qt),(2)\mathcal{M}_t = \text{Write}(\mathcal{M}_{t-1}; \mathbf{k}_t, \mathbf{v}_t), \quad \mathbf{o}_t = \text{Read}(\mathcal{M}_t; \mathbf{q}_t),\tag{2}

Linear attention instantiates memory as a fixed-size matrix StRdν×dk\mathbf{S}_t \in \mathbb{R}^{d_\nu \times d_k}:

St=St1+vtkt,ot=Stqt.(5)\mathbf{S}_t = \mathbf{S}_{t-1} + \mathbf{v}_t \mathbf{k}_t^\top, \qquad \mathbf{o}_t = \mathbf{S}_t \mathbf{q}_t.\tag{5}

Gated DeltaNet (GDN) improves writes with input-dependent retention and delta-rule updates:

St=αtSt1+βt(vtαtSt1kt)kt,ot=Stqt,(6)\mathbf{S}_t = \alpha_t \mathbf{S}_{t-1} + \beta_t(\mathbf{v}_t - \alpha_t \mathbf{S}_{t-1} \mathbf{k}_t) \mathbf{k}_t^\top, \qquad \mathbf{o}_t = \mathbf{S}_t \mathbf{q}_t,\tag{6}

where αt(0,1)\alpha_t \in (0,1) is an input-dependent retention gate, and βt[0,1]\beta_t \in [0,1] modulates the delta update strength.

Two approaches to scaling recurrent memory (Equation 7):

  • Capacity expansion: Mtcap:=S~t=[St(1)St(P)]\mathcal{M}_t^{\text{cap}} := \widetilde{\mathbf{S}}_t = [\mathbf{S}_t^{(1)} \mid \dots \mid \mathbf{S}_t^{(P)}] — increases memory dimension
  • Temporal expansion: Mttemp:=(St,1,,St,Mt)\mathcal{M}_t^{\text{temp}} := (\overline{\mathbf{S}}_{t,1}, \ldots, \overline{\mathbf{S}}_{t,M_t}) — retains multiple versions of the state along its trajectory

MARCH follows the temporal expansion direction by retaining cumulative snapshots of a continuously evolving recurrent state.


Methodology

3.1 Continuous Recurrent-State Anchoring

Anchor placement: For a sequence of LL text tokens, an anchoring policy specifies boundaries B={bm}m=1M\mathcal{B} = \{b_m\}_{m=1}^{M} where 0=b0<b1<<bML0 = b_0 < b_1 < \dots < b_M \leq L. An anchor position is inserted after each boundary:

T^=m=1M([tbm1+1,,tbm][ξm])[tbM+1,,tL],(8)\widehat{\mathcal{T}} = \|_{m=1}^{M} \left([t_{b_{m-1}+1}, \ldots, t_{b_m}] \parallel [\xi_m]\right) \parallel [t_{b_M+1}, \ldots, t_L],\tag{8}

where ξm\xi_m is the mm-th occurrence of a shared learned anchor embedding ξ\xi.

Cumulative recurrent-state checkpointing: At each boundary bmb_m, the current state is snapshotted:

A(m,)=Sbm()Rdν×dk,m=1,,M.(9)\mathbf{A}^{(m,\ell)} = \mathbf{S}_{b_m}^{(\ell)} \in \mathbb{R}^{d_\nu \times d_k}, \qquad m = 1, \ldots, M.\tag{9}

Since the recurrence is not reset between boundaries, A(m,)\mathbf{A}^{(m,\ell)} encodes the cumulative prefix up to position bmb_m.

Content-conditioned anchor metadata: The anchor position reads its aligned state checkpoint:

qm()=Wq()um(),om()=A(m,)qm().(10)\mathbf{q}_m^{(\ell)} = \mathbf{W}_q^{(\ell)} \mathbf{u}_m^{(\ell)}, \qquad \mathbf{o}_m^{(\ell)} = \mathbf{A}^{(m,\ell)} \mathbf{q}_m^{(\ell)}.\tag{10}

The same input is projected into a compact routing key:

κm()=Wk()um()Rdr.(11)\pmb{\kappa}_m^{(\ell)} = \pmb{\mathsf{W}}_k^{(\ell)} \pmb{\mathsf{u}}_m^{(\ell)} \in \mathbb{R}^{d_r}.\tag{11}

This cross-layer construction makes routing keys explicitly dependent on the content of each state anchor, not just its temporal index.

3.2 Content-Routed Historical Reading

Content-based routing: For a text token at position tt, the visible anchors are Vt={m{1,,M}bm<t}\mathcal{V}_t = \{m \in \{1,\dots,M\} \mid b_m < t\}. The routing query scores against anchor keys:

ρt=WRxt,at,m=ρtκm,mVt.(12)\pmb{\rho}_t = \mathbf{W}_R \mathbf{x}_t, \qquad a_{t,m} = \pmb{\rho}_t^\top \pmb{\kappa}_m, \quad m \in \mathcal{V}_t.\tag{12}

A null option \varnothing with zero payload A()=0\mathbf{A}^{(\varnothing)} = \mathbf{0} allows bypassing historical memory. The augmented logits become:

st,j={at,j,jVt,nt,j=,πt,j=exp(st,j)rV~texp(st,r).(13)s_{t,j} = \begin{cases} a_{t,j}, & j \in \mathcal{V}_t, \\ n_t, & j = \varnothing, \end{cases} \qquad \pi_{t,j} = \frac{\exp(s_{t,j})}{\sum_{r \in \widetilde{\mathcal{V}}_t} \exp(s_{t,r})}.\tag{13}

A Top-K sparse variant restricts aggregation to the KK highest-scoring visible anchors, reducing computation with minimal performance loss.

Historical retrieval and residual fusion:

ot=Stqt+jV~tπt,jA(j)qt.(14)\mathbf{o}_t = \mathbf{S}_t \mathbf{q}_t + \sum_{j \in \widetilde{\mathcal{V}}_t} \pi_{t,j} \mathbf{A}^{(j)} \mathbf{q}_t.\tag{14}

The additive formulation preserves the original recurrent path while introducing historical retrieval as an auxiliary residual branch.

3.3 Implementation

MARCH uses a two-stage producer–reader computation:

  • Producer: Processes recurrent updates in blocks (chunkwise Gated DeltaNet), computes current-state outputs, and checkpoints states at anchor boundaries
  • Reader: Jointly tiles query tokens and state anchors, reuses anchor tiles across query blocks, and fuses routing-score computation, online softmax updates, and weighted state readout accumulation into a streaming reduction

This avoids materializing the dense token-to-anchor routing matrix or per-anchor candidate readouts.


Empirical Validation / Results

Experimental Setup

  • Pretraining: 50B tokens from Long-Data-Collections, sequence length 16K
  • Architecture: 21 layers, hidden size 1536 (GDN: 793M params; Transformer: 693M)
  • MARCH settings: routing dimension dr=64d_r = 64, anchoring interval C=512C = 512 tokens
  • Optimization: fused AdamW, β1=0.9\beta_1 = 0.9, β2=0.95\beta_2 = 0.95, ϵ=108\epsilon = 10^{-8}, weight decay 0.1, peak LR 4×1044 \times 10^{-4}

Commonsense Reasoning (Table 1)

ModelLMB.acc↑PIQA.acc↑Hella.acc↑Wino.acc↑ARC-e acc_n↑ARC-c acc_n↑OBQA acc_n↑CSQA acc↑Avg.
Transformer49.466.533.952.147.826.432.022.141.3
w/ 24 Layers50.367.634.450.646.325.831.224.741.4
Gated DeltaNet48.566.133.150.845.925.330.021.140.1
w/ Log-Linear47.765.733.251.944.324.930.421.740.0
w/ MARCH49.566.934.852.647.125.632.822.541.5

MARCH improves average accuracy from 40.1/40.0 to 41.5, with the largest gain on OpenBookQA (+2.8 points), and surpasses both Transformer baselines on average.

LongBench Results (Table 2)

ModelNQAQQAMFQHQA2WMMusGvRQMSMNsTRCTQASSMAvg.↑
Transformer4.44.115.97.59.94.110.711.614.521.033.928.313.8
w/ 24 Layers3.511.118.37.89.84.111.312.912.822.547.523.215.4
Gated DeltaNet3.04.813.35.68.72.12.611.313.018.038.621.911.9
w/ Log-Linear3.66.213.67.18.23.36.313.213.517.032.825.112.5
w/ MARCH4.27.814.67.411.54.88.217.414.119.043.126.314.9 (↑25%)

Notable gains: 2WikiMultihopQA +32%, MuSiQue +45%, QMSum +32% relative improvements.

In-Context Retrieval (Table 3)

ModelSQuAD↑SWDE↑FDA↑TriviaQA↑DROP↑NQ↑Avg.↑
Transformer41.359.380.42.22.91.731.3
w/ 24 Layers40.464.983.74.03.42.533.2
Gated DeltaNet34.845.031.41.12.20.819.2
w/ Log-Linear33.746.138.21.32.61.020.5
w/ MARCH37.7 (↑8%)51.9 (↑13%)44.6 (↑17%)1.6 (↑23%)2.9 (↑12%)1.2 (↑20%)23.3 (↑14%)

NIAH Results

At 32K context (beyond 16K training length), MARCH achieves the best result on all six tasks, retaining perfect accuracy on S-NIAH-1, while both Transformer variants and Log-Linear GDN score zero throughout. MARCH wins in 19 of 24 task–length combinations and 11 of 12 multi-needle settings.

Ablation: Chunk Size (Table 4)

  • Matched training/inference: C=512C = 512 provides the best balance (32 anchors)
  • Inference-time variation: Denser anchors (smaller chunks) improve retrieval at higher cost; chunk size 256 at inference gives best retrieval (SQuAD 40.35, SWDE 53.38, FDA 47.46)
  • Fenwick tree organization: Achieves performance close to Log-Linear Attention, demonstrating router generalizability

Ablation: Routing Design (Table 5)

ConfigurationCSLongBenchRetrievalNIAH Avg.
Dense, dr=64d_r=64, Null (default)41.4814.8723.3151.33
Dense, dr=192d_r=192, Null40.9413.8824.5248.47
Top-4, dr=64d_r=64, Null41.3813.7923.1744.85
Dense, dr=64d_r=64, No Null41.0414.1122.8645.98
  • Increasing drd_r to 192 improves retrieval but hurts general performance
  • Top-4 nearly matches dense routing on commonsense/retrieval but trails on NIAH (efficiency-oriented)
  • Removing the null option degrades all aggregates

Training Efficiency

At 128K tokens, Top-4 MARCH:

  • More than doubles the training throughput of dense MARCH
  • Reduces core runtime by roughly an order of magnitude
  • Achieves higher throughput than FlashAttention-2

Theoretical and Practical Implications

Theoretical Significance

  1. Scaling recurrent memory beyond fixed-state bottleneck: MARCH demonstrates that temporal expansion of recurrent states (rather than only capacity expansion) effectively alleviates the single-state memory bottleneck, providing a theoretical alternative to increasing state dimensionality.

  2. Content-routed retrieval over state anchors: The paper establishes that attention-style content routing can be applied at the state level (over compressed historical states) rather than token level, decoupling memory capacity from dense per-token computation.

  3. Cross-layer state-conditioned routing keys: The architecture shows that routing keys can be made content-dependent through the recurrent pathway itself, enabling state-aware retrieval without explicit supervision.

Practical Implications

  1. Long-context efficiency: MARCH offers a practical trade-off between memory resolution and computational cost, controllable via checkpoint density and sparse routing (Top-K).

  2. Extrapolation beyond training context: Unlike Transformers (RoPE extrapolation failure) and Log-Linear GDN (state-index-dependent coefficients), MARCH's content-based router generalizes to longer contexts without new parameters.

  3. Compatibility: MARCH augments existing recurrent architectures without modifying the underlying recurrence, making it a drop-in enhancement for Gated DeltaNet and potentially other linear recurrent models.


Conclusion

Key Takeaways

MARCH introduces a novel mechanism for scaling recurrent memory by preserving cumulative state checkpoints as content-routed state anchors. The architecture:

  • Leaves the underlying recurrent update unchanged
  • Adds a growing bank of historical memory states
  • Uses attention-style routing over compact anchor keys with a learned null option
  • Fuses historical readouts with current-state outputs via residual addition

Results Summary

MARCH consistently outperforms strong recurrent baselines (Gated DeltaNet, Log-Linear Gated DeltaNet) across:

  • Commonsense reasoning: +1.4 average points
  • LongBench: +25% relative improvement
  • In-context retrieval: +14% relative improvement
  • NIAH: Best performance at all context lengths including 32K extrapolation

Future Directions

  1. Adaptive anchoring: Replace fixed-interval checkpointing with content-driven anchoring based on state novelty or update magnitude
  2. Memory consolidation: Combine state anchoring with larger-capacity memory and multiple specialized partitions (short-term, episodic, consolidated knowledge)
  3. External memory modules: Support downstream task optimization, knowledge consolidation from experience to parametric information
  4. Scaling directions: Test-time training and continual learning applications

MARCH establishes historical-state retrieval as a practical approach to scaling recurrent memory beyond a single evolving state, opening new directions for efficient long-context modeling.

Related papers