betaFeedback

WorksComputer Science

TraceRelay: Attention-Aligned Recurrence over Rolling Traces

Abstract

We present TraceRelay, an attention-aligned recurrent architecture that distributes persistent representations over a rolling sequence of low-dimensional traces. Local right looking attention forms increments from lower-layer representations; delivery is delayed until all attended inputs are in the causal past. A fixed additive phase recurrence accumulates the delayed increments, and left-looking attention reads the resulting residual augmented stream. A stride-wise prefix sum supports parallel prefill and bounded-buffer continuation. We study 36 small-model runs on Equal Repeats, bounded Dyck closing-type prediction, and causal Most-Freq generation, using three seeds per setting. At trained length 256, Equal Repeats models with recurrent phase inheritance reach 98.81-99.69% accuracy versus 50.73-51.63% for separately trained variants without inheritance, despite the latter receiving more updates. Accuracy drops sharply at lengths beyond the training range. At the longest evaluated lengths, models with more dimensions in the middle layer's recurrent traces perform better on Dyck (76.34% versus 55.49% close accuracy at length 4096), whereas models with fewer trace dimensions perform better on five-symbol Most-Freq (70.74% versus 55.60% exact generation at length 1024). These contrasting cases motivate further study of how the size of recurrent representations should be chosen for different tasks, without establishing a general rule across tasks or model configurations.

Introduction

Attention provides a direct interface to multiple past representations, whereas recurrence transports information through time. The Transformer demonstrated that attention-based sequence computation can be trained without a token-wise recurrent cell [1]. However, full attention incurs quadratic attention arithmetic and a key–value cache that grows with the processed context. Moreover, availability is not utilization: positional sensitivity in Lost in the Middle and the length-dependent failures studied by RULER show that accepting a longer input does not guarantee effective use of it [2, 3]. These findings do not imply that attention bandwidth is irrelevant; they motivate separating accessible history from useful persistent information.

Recurrent and state-space models provide another allocation of that information. Mamba and Mamba-2 demonstrate input-dependent state updates and efficient parallel formulations of structured recurrence [4, 5]. Nevertheless, recurrence and attention need not cooperate automatically. SWAX reports that larger sliding windows can weaken long-term memory learning, while excessively small windows harm tasks benefiting from local context [6]. Thus, removing access and providing unrestricted access can each create difficulties, for different reasons.

We ask a narrower architectural question: can recurrence be organized around attention, so that attention learns what to write and retrieve while the temporal transition remains simple? TraceRelay answers with a rolling trace organization. It forms a candidate update using a short

Code and model checkpoints are available at https://github.com/swgoo/trace_relay. right context, delivers the update only after a causal delay, accumulates it as a phase increment, and exposes the resulting representation to ordinary left-window attention. Memory formation is available throughout the input stream, rather than being activated only when a downstream query requests recall.

The accompanying design hypothesis is long in temporal reach, narrow in representational bandwidth. A longer read window gives task loss access to intermediate recurrent representations; a narrower projected channel limits the capacity of that same forward path. H-Net offers complementary motivation for non-uniform capacity allocation: it compresses sequence resolution and allocates richer computation to inner stages [7]. Our proposed hierarchy instead preserves the temporal grid while varying trace width and read horizon.

This study contributes the explicit delayed-write/phase-accumulation/left-read graph, its causal and parallel execution account, and a controlled evaluation protocol. The empirical questions are whether phase inheritance contributes beyond the corresponding ablation without inheritance, whether bounded structured state is usable, and whether a compact aggregate can support autoregressive generation.

Attention-aligned rolling recurrence

Notation

Let htℓ−1∈RHh_t^{\ell-1} \in\mathbb{R}^{H} be the input to layer ℓ\ell at sequence position tt, counted from zero at the start of the sequence. Within a layer, write ht=htℓ−1h_t = h_t^{\ell-1}; htℓh_t^\ell denotes its output. The trace width is dd, the relay stride is WW, and LL and RR count the preceding and following positions visible to Left and Right attention, respectively. Both windows include their center, so their maximum sizes are L+1L+1 and R+1R+1; causality requires W>RW > R.

For readability, RMSNorm is implicit in the equations: it is applied to the lower-layer stream before Right attention, the memory-augmented stream before Left attention, and the post-attention state before the FFN. Residual additions use the corresponding unnormalized states. We use Attn⁡R(⋅,⋅)\operatorname{Attn}_{R}(\cdot,\cdot) and Attn⁡L(⋅,⋅)\operatorname{Attn}_{L}(\cdot,\cdot) for complete local multi-head attention outputs: the first argument supplies queries and the second supplies keys and values. Both outputs have width dd.

The learned bias-free maps are Pδ:Rd→RdP_{\delta}:\mathbb{R}^{d}\to\mathbb{R}^{d}, Pϕ:R2d→RHP_{\phi}:\mathbb{R}^{2d}\to\mathbb{R}^{H}, and PL:Rd→RHP_{L}:\mathbb{R}^{d}\to\mathbb{R}^{H}; PLP_{L} maps the Left output into the residual stream, separately from the attention operator’s internal output projection. The fixed phase-update scale α>0\alpha> 0 is π\pi in the executed experiments, and wrap⁡(a)=a mod 2π\operatorname{wrap}(a)=a\bmod2\pi acts elementwise. The initial phase is θt<0=0\theta_{t<0}=0. Intermediate variables below denote the Right output oiRo_i^{R}, bounded increment δi\delta_i, delivered increment utu_t, phase θt\theta_t, memory-augmented state mtm_t, Left output otLo_t^{L}, and post-attention state h~t\tilde{h}_t. The upright superscripts on oiRo_i^{R} and otLo_t^{L} label attention paths, not layers. For the complex-coordinate interpretation below, zt=exp⁡(iθt)z_t=\exp(i\theta_t).

Delayed right-looking writes

The Right writer forms a candidate from the lower-layer stream:

oiR=Attn⁡R(hi,hi:i+R)∈Rd,δi=αtanh⁡(Pδ(oiR))∈Rd.(1)o_i^{R}=\operatorname{Attn}_{R}(h_i,h_{i:i+R})\in\mathbb{R}^{d},\qquad\delta_i=\alpha\tanh\left(P_{\delta}(o_i^{R})\right)\in\mathbb{R}^{d}. \tag*{(1)}

The elementwise tanh bounds each coordinate of δi\delta_i in magnitude by α\alpha. At arrival position tt, the delivered increment is

ut={δt−W,t≥W,0,t<W.(2)u_t = \begin{cases} \delta_{t-W}, & t\ge W,\\ 0, & t<W. \end{cases} \tag*{(2)}

Right-attention keys and centers use the input validity mask; the relay advances over sequence positions, including padding. The implementation computes these writes directly at their arrival positions by shifting query centers. It does not require an unavailable future input during decoding.

Figure 1. Reference computation graph. Right attention observes lower-layer positions ii through i+Ri+R; its increment is delivered at i+Wi+W, with W>RW>R. The stride-wise phase scan and cos/sin readout precede the residual merge and Left attention. The displayed readout applies to initialized lineages; until a valid delayed update arrives, the readout is zero. Left Q/K/V consume the merged stream. The orange branches pass the merged representation mtm_t to the attention residual and the post-attention state h~t\tilde{h}_t to the FFN residual. Right does not read this layer’s phase. Normalization is implicit, as in the equations.

Fixed phase accumulation, learned increments

The recurrent component is

θt=wrap⁡(θt−W+ut).(3)\theta_t = \operatorname{wrap}(\theta_{t-W} + u_t). \tag*{(3)}

There are WW interleaved trace lineages. After warm-up, a new update can arrive at every token; WW is the interval between successive states of one lineage.

In complex coordinates, Eq. (3) is coordinate-wise multiplication by exp⁡(iut)\exp(iu_t). The transport law has no learned decay or dense state-transition matrix. The increments are nevertheless learned and input-dependent.

Left attention reads a recurrently augmented stream

At positions whose recurrent lineage has received a valid delayed update, the layer computes

mt=ht+Pϕ([cos⁡θt;sin⁡θt]),(4)m_t = h_t + P_{\phi}\left([\cos\theta_t;\sin\theta_t]\right), \tag*{(4)}
otL=Attn⁡L(mt,mt−L:t),(5)o_t^L = \operatorname{Attn}_L(m_t,m_{t-L:t}), \tag*{(5)}
h~t=mt+PL(otL),htℓ=h~t+FFN⁡(h~t).(6)\tilde{h}_t = m_t + P_L(o_t^L), \qquad h_t^\ell= \tilde{h}_t + \operatorname{FFN}(\tilde{h}_t). \tag*{(6)}

The executed experiments use zero attention and residual dropout.

Crucially, the left reader attends to the merge of lower-layer hidden features and phase readout, not to a phase-only bank. Trace width controls attention projections and phase width; it is not the full residual-stream width. Information read in layer ℓ\ell can condition a writer in layer ℓ+1\ell+ 1. This gives cross-layer refinement without a same-layer state-dependent writer. The rolling collection acts as distributed working state rather than a separate slot store.

Initialization and masked inputs. Until a lineage receives its first valid delayed update, its phase readout is set to zero, so mt=htm_t = h_t. For an unpadded sequence, this applies to the first WW positions. This condition prevents the nonzero cos⁡(0)\cos(0) features of an uninitialized phase from entering the residual stream. The implementation tracks it with Boolean flags: qtq_t marks a valid delivered source center, and vt=vt−W∨qtv_t = v_{t-W} \lor q_t, initialized with vt<0=0v_{t<0} = 0, records whether the lineage has received any valid update. An invalid source center contributes a zero increment; it cannot initialize a lineage or clear an existing validity flag. A valid update initializes the lineage even when its increment is zero. The implementation masks the cos⁡/sin⁡\cos/\sin features when vt=0v_t = 0; the bias-free PϕP_\phi then produces exactly zero.

Causality and parallel execution

The latest lower-layer position used by utu_t is t−W+R<tt - W + R < t. Therefore mtm_t depends only on inputs through tt, and the left reader accesses only mjm_j for j≤tj \le t. Induction over layers gives a causal decoder; logits at tt may predict token t+1t + 1.

For each residue r∈{0,…,W−1}r \in\{0, \ldots, W - 1\},

θr+nW=wrap⁡(∑k=0nur+kW).(7)\theta_{r+nW} = \operatorname{wrap}\left(\sum_{k=0}^{n} u_{r+kW}\right). \tag*{(7)}

The complete lower-layer stream determines all increments before the scan. Thus a reshape, cumulative sum, and phase wrap implement the recurrence during prefill. Continuation adds the saved phase tail to each lineage. The core uses standard tensor operations and local attention, with an optional FlashAttention-2 backend [8].

Why long and narrow?

A rolling reader can send task gradients directly to several intermediate trace-bearing representations instead of relying only on the latest recurrent state. Our hypothesis is that this access makes useful writes easier to learn. Narrowing the projected channel may simultaneously limit an attention-only solution that bypasses persistence. Both effects depend on the task and training distribution: a backward path is also a forward path, and even a narrow channel can encode all information needed for a compact task.

We therefore treat LL, RR, WW, and dd as distinct controls. A short RR permits a short causal delay and repeated within-lineage updates during training; increasing RR forces the lower bound on WW upward. An inner long-narrow path can expose more trace generations without proportionally increasing projected width. This is a design hypothesis, not a proof that narrowing is necessary or that widening prevents learning. In particular, the reference experiments below vary center width with fixed Left attention windows; they do not independently establish the benefit of a longer center window.

Controlled evaluation

All three tasks use one-hot symbols, a bias-free input projection, and the same reference core. The executed sweeps use H=64H = 64, FFN width 256, three layers, four heads, and trace widths [64,dc,64][64, d_c, 64] with dc∈{16,32,64}d_c \in\{16, 32, 64\}. Each layer’s Left attention sees up to 15 preceding positions, Right attention sees up to 7 following positions, and the relay stride is 8; both windows include the center. Training seeds are 42, 43, 44 for each setting. The width comparisons characterize task-specific behavior, with parameter count and optimization exposure also varying across widths.

Equal Repeats: recurrent inheritance. We follow the historical Equal Repeats semantics in the code accompanying Delétang et al. [9]. Inputs have the form 0a1b0c0^a1^b0^c with a guaranteed equality between run lengths; the target identifies the corresponding relation. Inclusive sampling preserves cases with an empty run and assigns the all-equal case to class 0. Training samples a uniform integer length from 32 through 256. A classifier reads the final valid position. Models with and without phase inheritance are separately initialized and trained for every width and seed. The ablation without inheritance retains the writer, delay, phase features, and reader, replacing Eq. (3) with θt=wrap⁡(ut)\theta_t = \operatorname{wrap}(u_t) and vt=qtv_t = q_t throughout training and evaluation. Paired protocols match in task, geometry, parameter count, training seed, and final-example fingerprints; their backbone configurations differ only in whether the previous phase is inherited.

Bounded Dyck: structured prediction. Dyck-(k,m)(k,m) contains kk bracket types and nesting depth at most mm [10]. The executed phase-inheritance sweep uses k=8k = 8, m=10m = 10, with a uniform even training length from 32 through 256. Completion-count dynamic programming samples bounded paths of the chosen length, and opening types are sampled uniformly. Logits at tt predict the closing type at t+1t+1; opening targets and padding are excluded. No stack metadata is supplied to the model. We report closing-type token accuracy by input length, matching-opener distance, and depth, with counts for each slice. This diagnostic measures structured prediction within the bounded language rather than full-language likelihood or unbounded-stack recognition.

Most-Freq: aggregate-conditioned generation. We adapt Most-Freq from Weiss et al. [11]: emit present symbols in descending frequency, breaking ties by first appearance. The phase-inheritance sweep uses five source symbols and uniform integer source lengths from 128 through 256. The separated-count sampler makes every count positive, enforces a minimum adjacent count gap of four, and randomizes symbol assignment and token order; it is not uniform over count combinations. Consequently, this sweep has five-symbol rankings and does not exercise the tie rule. Training uses shifted teacher-forced targets. Final evaluation starts from source plus separator and greedily feeds back only the model’s own symbols. Exact correctness requires the complete ranking followed by EOS, for six output tokens. Ranking, set-validity, and termination diagnostics and shortcut baselines use the same generated examples. This is a short-output autoregressive transduction task.

Selection and reporting. Checkpoint selection uses the unweighted mean across ID validation lengths: classification accuracy for Equal Repeats, closing-type accuracy for Dyck, and source-only free-generation exact accuracy for Most-Freq. Ties use lower mean validation cross-entropy (teacher-forced cross-entropy for Most-Freq). All runs have a 20,000-update cap and stop after two consecutive validation means reach 99%, with checks every 250 updates. OOD results do not control checkpoint selection or stopping. The repeated threshold uses the same validation examples and is a stopping rule, not an independent replication.

All 36 planned final runs are retained: nine Equal Repeats runs with phase inheritance and nine without, nine Dyck runs, and nine Most-Freq runs. Every run completed either by the threshold or by its update cap. We report individual training seeds and their unweighted mean with sample standard deviation. Final-example fingerprints match across variants and seeds within each task, so the same examples are reused when comparing models. Training exposure is unequal: the recorded optimizer steps, tokens, selected-checkpoint steps, and wall times are reported in Table 5; detailed executed protocols appear in Table 2 and Appendix § 7.

FieldEqual RepeatsDyckMost-Freq
Phase inheritanceOn and off; 18 runsOn; 9 runsOn; 9 runs
Task parametersBinary 0a1b0c0^{a}1^{b}0^{c}; three relation classesk=8k = 8 bracket types; maximum depth m=10m = 10V=5V = 5; decreasing count, first-appearance ties
SamplerInclusive repeated length r∈[1,⌊T/2⌋]r \in[1, \lfloor T/2\rfloor]; equal-all maps to class 0Completion-count DP over bounded paths; uniform opening typesSeparated positive counts, gap ≥4\ge4; randomized symbol assignment and order
Online source lengthUniform integer T∈[32,256]T \in[32, 256]Uniform even T∈[32,256]T \in[32, 256]Uniform integer T∈[128,256]T \in[128, 256]
ID validation lengths32, 64, 128, 25632, 64, 128, 256128, 192, 256
Final ID lengths32, 64, 128, 25632, 64, 128, 256128, 192, 256
Final OOD lengths512, 1024, 2048, 4096512, 1024, 2048, 4096512, 1024
Examples per length (validation / final)1,024 / 10,0001,024 / 2,000512 / 1,024
Training seeds42, 43, 4442, 43, 4442, 43, 44
Validation / final seed20261007 / 2026100620261007 / 2026100620261007 / 20261006
Batch size (train / eval)64 / 12864 / 6464 / 64
Best-checkpoint scoreMean ID classification accuracyMean ID close-type accuracyMean ID greedy exact accuracy including EOS
Selection tie-breakLower mean ID CELower mean ID close CELower mean ID teacher-forced CE
Update cap / executed20,000 / 4,250–20,00020,000 / 14,250–20,00020,000 / 2,500–5,000
Backend / precisionFlashAttention-2 / BF16FlashAttention-2 / BF16FlashAttention-2 / BF16
Output and EOSFinal-position class; no EOS targetNext closing type only; no EOS targetSource-only greedy generation; five symbols then EOS required

Table 2. Executed protocols. All tasks sweep dc∈{64,32,16}d_c \in\{64, 32, 16\} with three training seeds per variant and width. ID validation occurs every 250 updates; two consecutive mean ID scores ≥99%\ge99\% trigger stopping. OOD results never control training. Table 5 gives individual stopping/selected steps and token exposure.

Task / inheritancedcd_cSeedBestFinalTokens (M)Min.Params
ER / On64422,5004,25039.106.7295,875
ER / On64435,7507,00065.1010.7295,875
ER / On64447,7507,75071.5212.3295,875
ER / On32426,0009,25085.5114.6268,227
ER / On32438,2508,25076.4313.0268,227
ER / On324410,25010,25094.8015.9268,227
ER / On16426,2507,25066.7011.5256,707
ER / On16434,7508,00074.1412.4256,707
ER / On16446,7506,75062.3910.6256,707
ER / Off644218,75020,000†184.8331.0295,875
ER / Off644316,00020,000†184.7231.1295,875
ER / Off644419,50020,000†183.9730.8295,875
ER / Off324219,50020,000†184.8331.6268,227
ER / Off324318,00020,000†184.7230.5268,227
ER / Off324415,50020,000†183.9730.9268,227
ER / Off164219,50020,000†184.8330.7256,707
ER / Off164319,75020,000†184.7232.0256,707
ER / Off164417,50020,000†183.9731.5256,707
Dyck / On644216,75017,000156.2034.2297,096
Dyck / On644314,75014,750136.0429.7297,096
Dyck / On644414,25014,250131.7628.5297,096
Dyck / On324217,00017,000156.2033.8269,448
Dyck / On324317,75017,750163.5035.3269,448
Dyck / On324414,00014,250131.7628.8269,448
Dyck / On164216,75017,000156.2034.1257,928
Dyck / On164318,25020,000†184.5540.5257,928
Dyck / On164418,00018,000165.9536.8257,928
MF / On64422,7503,00038.065.5296,454
MF / On64432,5002,50031.714.8296,454
MF / On64442,0002,75035.275.1296,454
MF / On32423,5003,75047.567.0268,806
MF / On32433,7505,00063.449.4268,806
MF / On32443,2503,25041.635.9268,806
MF / On16425,0005,00063.619.1257,286
MF / On16432,0003,00037.995.5257,286
MF / On16443,0003,00038.435.5257,286

Table 5. Actual training exposure for all 36 runs. Best is the selected checkpoint update; final is the stopping update. Tokens are millions of physical training tokens; Most-Freq includes separator and teacher-forced output tokens. Minutes are logged training-loop wall time, including periodic ID validation but excluding final evaluation. On/off indicates phase inheritance; † denotes budget exhaustion without satisfying the two-pass threshold.

Results

All results below use the checkpoint selected by in-distribution (ID) validation. Evaluation inputs are shared across training seeds and widths within a task. Error bars are sample standard deviations across three training seeds, not confidence intervals over independent evaluation datasets. Table 1 uses common comparison lengths 256 and 1024; the figures retain every tested length.

TaskPhase inheritancedcd_cID: 256OOD: 1024
Equal RepeatsOn6498.81 ± 0.5833.76 ± 1.82
Equal RepeatsOn3299.24 ± 0.5635.63 ± 2.99
Equal RepeatsOn1699.69 ± 0.1332.84 ± 1.66
Equal RepeatsOff6451.03 ± 0.9437.48 ± 0.14
Equal RepeatsOff3251.63 ± 1.2437.65 ± 0.23
Equal RepeatsOff1650.73 ± 0.5237.47 ± 0.09
DyckOn6498.52 ± 0.0593.03 ± 0.69
DyckOn3298.40 ± 0.1289.48 ± 0.82
DyckOn1698.26 ± 0.1787.17 ± 2.31
Most-FreqOn6498.86 ± 0.7855.60 ± 12.82
Most-FreqOn3299.22 ± 0.3565.40 ± 2.39
Most-FreqOn1699.61 ± 0.2070.74 ± 4.95

Table 1. Best-checkpoint test results, mean ± sample SD over seeds 42–44 (percent). ID is T=256T = 256 and OOD is T=1024T = 1024 for every task. Metrics are sequence classification (Equal Repeats), token-weighted close type (Dyck), and exact generated ranking including EOS (Most-Freq).

Does recurrent inheritance contribute? At T=256T = 256, models with phase inheritance reach 98.81, 99.24, and 99.69% for center widths 64, 32, and 16, respectively; matched models without inheritance reach 51.03, 51.63, and 50.73% (Figure 2). The corresponding mean paired gains are 47.78, 47.61, and 48.97 percentage points. The graph without inheritance retains the delayed writer and reader but has maximum single-pass input lag 69, compared with unrestricted recurrent ancestry when the phase is inherited. All runs without inheritance consume their 20,000-update budget, whereas those with inheritance stop after 4,250–10,250 updates. The result supports the utility of inheritance on this training distribution despite greater optimization exposure for the ablation.

Figure 2. Equal Repeats: with and without phase inheritance. Accuracy on 10,000 common examples per length, mean ± sample SD over three training seeds. Shading marks lengths beyond the 32–256 training range. Models without inheritance are separately trained with the same task and geometry; all use 20,000 updates, while models with inheritance stop earlier. The strong separation within the trained range largely disappears in OOD evaluation. The dotted line is the 1/3 chance reference.

That benefit does not imply a learned length-invariant counting rule. At T=512T = 512, the models with inheritance average only 42.52–43.51%, and the paired mean gains shrink to 0.24–1.61 points. At T=1024T = 1024–4096, both variants are close to the three-class chance reference; the ablation without inheritance even has the higher mean at 1024 for all widths. We retain this failure alongside the strong ID separation.

How does width affect structured prediction? Bounded Dyck exhibits a different pattern. At T=1024T = 1024, mean close-type accuracies are 93.03, 69.48, and 87.17% for widths 64, 32, and 16. At T=4096T = 4096, these decline to 76.34 ± 1.81, 63.47 ± 8.36, and 55.49 ± 10.49%, respectively. The wider center therefore has the highest mean length-OOD accuracy in this sweep. Eight runs meet the stopping rule; width 16/seed 43 reaches the full budget and remains included.

Overall accuracy is dominated by short dependencies: 77.98% of evaluated closes at T=4096T = 4096 have matching distance 1–8. At distance 513–1024, width 64 achieves 27.70 ± 6.14%, above the 12.5% type-chance reference, on 1,639 closes. The next bin contains only 43 closes, and no example has distance above 2048. Figure 3 and Table 3 distinguish sequence length, opener distance, and pre-close depth. The distance-slice ordering is not uniformly monotone in width; sequence-length accuracy is not a measurement of a 4096-token memory lifetime.

Figure 3. Bounded Dyck closing-type prediction. Three-seed mean ± sample SD for k=8k = 8, m=10m = 10, using 2,000 common sequences per length. (a) Close accuracy versus length; shaded lengths exceed the training maximum 256. (b,c) Matching-distance and pre-close-depth slices at T=4096T = 4096, with 4,096,000 close targets in total. The starred distance bin 1025–2048 has only 43 targets; the empty > 2048 bin is omitted. The 513–1024 bin has 1,639 targets. Dotted horizontal lines in (b,c) mark 12.5% chance. Full slice counts are in Table 3.

SliceClosesdc=64d_c = 64dc=32d_c = 32dc=16d_c = 16
1–83,194,03887.27 ± 2.6272.57 ± 10.6962.65 ± 14.31
9–16360,32948.41 ± 6.0438.07 ± 1.9834.52 ± 2.93
17–32257,30830.90 ± 3.4527.24 ± 1.3227.23 ± 3.41
33–64159,95228.85 ± 4.2326.04 ± 2.2326.83 ± 3.21
65–12880,45831.20 ± 4.7626.90 ± 2.1927.89 ± 3.08
129–25632,35832.93 ± 5.2426.64 ± 2.3627.94 ± 3.24
257–5129,87531.62 ± 6.3723.44 ± 2.9825.18 ± 3.81
513–10241,63927.70 ± 6.1419.52 ± 2.8821.72 ± 2.82
1025–20484331.78 ± 3.5521.71 ± 4.8433.33 ± 5.37
> 20480–––
Depth 196,10856.43 ± 1.8043.50 ± 9.0142.32 ± 5.45
Depth 2254,87462.82 ± 3.8148.90 ± 10.7046.07 ± 8.30
Depth 3436,16467.75 ± 3.8753.45 ± 10.5948.98 ± 9.62
Depth 4592,75071.56 ± 3.6657.39 ± 10.0051.44 ± 10.37
Depth 5682,79575.21 ± 2.8361.47 ± 9.1753.80 ± 10.63
Depth 6680,97178.38 ± 2.1565.17 ± 8.4356.31 ± 10.91
Depth 7587,39981.59 ± 0.8269.29 ± 7.7058.97 ± 10.83
Depth 8428,58984.75 ± 0.7473.57 ± 7.0362.18 ± 11.35
Depth 9246,57388.70 ± 3.7579.22 ± 6.8266.71 ± 11.84
Depth 1089,77794.06 ± 3.9087.75 ± 6.2375.68 ± 13.07

Table 3. Dyck diagnostics at T=4096T=4096: percent close accuracy, mean ± sample SD. Counts are targets in the common 2,000-sequence evaluation set, not independent replications across models. An empty bin is unavailable, not zero accuracy.

Can the state support ordered generation? Most-Freq reverses the mean width ordering observed on Dyck. At T=512T = 512, exact ranking-plus-EOS accuracy is 87.76 ± 3.73, 93.55 ± 1.53, and 94.79 ± 0.59% for widths 64, 32, and 16. At T=1024T = 1024, the corresponding scores are 55.60 ±\pm 12.82, 65.40 ±\pm 2.39, and 70.74 ±\pm 4.95%. Width 64 has particularly large seed variation: 43.65–69.14% at 1024.

At T=1024T = 1024, Top-1 accuracy remains 86.82–90.76%, higher than full-output exact accuracy. Termination accuracy ranges from 82.91% for width 64 to 96.22% for width 32. Thus ranking and output-protocol errors both matter (Table 4). On the same inputs, the 32-token suffix-frequency baseline reaches 1.27% full exact, first appearance 1.07%, and fixed symbol order 0.59%. These reject those specific shortcuts, without substituting for a separately trained comparison without phase inheritance.

Metricdc=64d_c = 64dc=32d_c = 32dc=16d_c = 16
Full exact55.60±12.8255.60 \pm12.8265.40±2.3965.40 \pm2.3970.74±4.9570.74 \pm4.95
Top-186.82±2.0586.82 \pm2.0589.10±3.0089.10 \pm3.0090.76±7.9190.76 \pm7.91
Top-2 prefix74.41±7.4374.41 \pm7.4378.71±2.0378.71 \pm2.0384.05±6.1584.05 \pm6.15
Set exact81.84±7.2681.84 \pm7.2687.96±3.9787.96 \pm3.9789.55±4.6789.55 \pm4.67
Termination82.91±7.3282.91 \pm7.3296.22±5.3696.22 \pm5.3695.64±5.6195.64 \pm5.61

Table 4. Most-Freq diagnostics at T=1024T = 1024 (percent; three-seed mean ±\pm SD). Top-2 requires the first two outputs in the correct order. Set exact requires each source symbol exactly once but ignores rank; termination records a predicted EOS within the decode limit.

Figure 4. Most-Freq causal generation. Five symbols, separated counts with minimum gap four, training lengths 128–256, and 1,024 common evaluation examples per length. Curves show mean ±\pm sample SD over three training seeds; shading denotes length OOD. (a) Exact greedy ranking including predicted EOS, alongside same-input shortcut baselines. (b) Top-1 accuracy. Suffix frequency (32) ranks symbols present in the last 32 input tokens by descending frequency there, breaking ties by first occurrence within that suffix. First appearance lists symbols seen in the full input in order of first occurrence, ignoring their counts. Fixed symbol order always lists 0, 1, 2, 3, 4. All three heuristics append EOS and use the same evaluation inputs. No gold output is fed back during model generation. Narrower centers have higher OOD means in this sweep, with unequal early-stopped training exposure.

Optimization and summary. Figure 5 shows all unsmoothed ID validation histories, with selected checkpoints marked. Most-Freq width 64 stops after a mean 2,750 updates, compared with 4,000 for width 32 and 3,667 for width 16. Faster attainment of the ID threshold therefore does not coincide with the best OOD score. Width also changes parameter count, and early stopping changes token exposure; Table 5 records both. These are matched-protocol comparisons, not equal-compute experiments.

Figure 5. Optimization histories. Every logged ID validation mean for all 36 runs; colors indicate width and line styles indicate seed. Stars mark the checkpoint selected by ID accuracy with a cross-entropy tie-break. The dashed horizontal line is 99%; stopping requires two consecutive passes. Curves end at their actual stopping updates. Nine Equal Repeats runs without phase inheritance and one Dyck run exhaust the budget. Metrics and horizontal scales are task-specific, and the curves are not smoothed. Table 5 gives steps, tokens, and wall time.

Discussion and scope

An organization of recurrence, not a new primitive. The distinctive design choice is the combination of right-context-conditioned delayed writes, same-layer-independent increment generation, interleaved phase transport, and a left reader over the recurrently augmented rolling stream. Attention and recurrence individually, and their combination, are not new. Block-Recurrent Transformers use attention and gates over a set of block-level states, while Recurrent Memory Transformer passes memory tokens between segments [12, 13]. TransformerFAM reuses latent representations through feedback [14]; Maglev combines sliding recurrent memory with prefiller-generated targets and a consistency objective [15]. Our contribution should be compared at the dependency-graph level, not described as the first use of attention over recurrent states.

Mamba-2 motivates designing recurrence around an efficient algebraic execution form [5]. Gated DeltaNet also combines structured updates with a parallel algorithm [16]. Mamba-3 provides independent evidence for complex-valued state updates in state tracking [17]; it does not validate TraceRelay’s particular phase update or imply that all such recurrences train equally well. Our fixed transport law leaves learned selection and content formation in attention and projections.

Bandwidth and reach are different controls. The intended long-narrow center is a proposed compromise between exposing intermediate states and limiting direct-access capacity. SWAX motivates the interaction between attention access and memory learning; H-Net motivates non-uniform representation allocation [6, 7]. Our executed sweep changes width while every Left reader still sees at most 15 preceding positions. At the longest evaluated lengths, mean OOD performance favors wider centers on Dyck and narrower centers on Most-Freq. This contrast offers a useful case study of task-specific bandwidth preferences in compact frequency aggregation and bounded nested-state prediction, without establishing a general rule across tasks or configurations.

What remains untested. This study does not measure language-model quality, agent performance, or compute-matched long-context scaling. Familiar primitives reduce implementation novelty but do not guarantee quality or hardware efficiency in a new arrangement. Width changes also affect parameter count and optimization, and early-stopped runs can have different training exposures. Bounded phase values do not guarantee reliable retention at arbitrary horizons.

Conclusion

TraceRelay reorganizes recurrence around attention: a right-looking writer prepares causally delayed increments, a simple phase scan transports them, and a left-looking reader accesses their rolling representations. This yields a token-grid-preserving architecture with parallel prefill and bounded inference buffers, without an explicit slot-commit subsystem. Equal Repeats demonstrates a strong contribution from recurrent inheritance inside the training range but fails to establish reliable length extrapolation. At the longest evaluated lengths, mean OOD performance favors wider centers on Dyck and narrower centers on Most-Freq. These contrasting cases motivate further study of task-specific allocation of representational bandwidth. The controlled results do not identify a universal optimal width or an efficiency advantage. Separately varying read horizon, writer width, and training exposure is a concrete next step toward testing the long-narrow design hypothesis.

Executed task protocols and diagnostics

All runs use AdamW (3×10−43 \times10^{-4}, β=(0.9,0.999)\beta= (0.9, 0.999), ϵ=10−8\epsilon= 10^{-8}, weight decay 0.01), a 100-update linear warmup followed by constant learning rate, and gradient-norm clipping at 1. Each online batch shares one sampled source length. Evaluation examples match across seeds and variants at each length; reported uncertainty is sample SD across trained seeds.

The table records the completed sweeps rather than trainer defaults. All three task adapters use the same fixed core geometry, AdamW, a 100-update linear learning-rate warm-up followed by a constant rate, and batch size 64. Validation is performed every 250 updates. Changing windows in earlier task pilots and moving from four to eight to five Most-Freq symbols were exploratory calibration decisions, not preregistered choices; the present analysis retains the complete final sweep for each declared protocol.

Equal Repeats semantics. The sampled families correspond to a=ba = b, b=cb = c, or a=ca = c in 0a1b0c0^{a}1^{b}0^{c}. The historical generator uses inclusive run-length sampling; an even-length endpoint can produce an empty run, and equal-all examples are relabeled with class-zero priority. Thus the measured class distribution, not an assumed exact balance, defines a majority-class baseline. The implementation records evaluation fingerprints independent of inference batching. Our phase-inheritance gaps pair the same task distribution, geometry, seed, and evaluation fingerprints. At the tested power-of-two lengths, the final evaluation contains class counts (3333, 3333, 3334), giving a 33.34% majority baseline. Both variants are trained from fresh initialization; they have identical parameter counts within each width.

Bounded Dyck slices. The sampler begins and ends with an empty stack, never exceeds mm, and does not require every sequence to reach depth mm. Its open/close choices use normalized completion counts, and opening types are uniform. The same k,mk,m must be retained for a length-only comparison. Longer examples may change opener-distance and depth distributions despite a fixed maximum stack depth. Table 3 reports the common-set distance and depth counts at T=4096T=4096; the accompanying JSON retains each slice at every tested length. Empty bins remain missing, not zero-accuracy observations. Do not identify good close-type accuracy with recovery of every complete latent stack.

Most-Freq controls. For VV symbols and count gap gg, separated sampling requires T≥V+gV(V−1)/2T \ge V + gV(V - 1)/2. It adds sorted random extras to the increasing minimum counts and then independently shuffles symbol labels and positions. This is not uniform sampling over count vectors. Changing TT can change realized margins, so length OOD is not an isolated retention test. IID-uniform evaluation, if used, must be labeled as distribution shift. The output ranking has at most VV symbols, and EOS is predicted rather than forcibly appended by the model.

The fixed-order, first-appearance, and suffix-frequency controls read different information. A suffix covering the whole source is an oracle case. Exceeding these controls rejects those particular strategies, not every local computation. Greedy free-generation exact accuracy requires the complete ranking and termination; teacher-forced token accuracy does not. For deterministic causal execution, per-example full-sequence teacher-forced exact and greedy exact should agree when logits have identical numerical decisions. The BF16 evaluation records 18 TF/greedy exact disagreements across 46,080 model–example evaluations, with at most three in any 1,024-example cell. We preserve these diagnostics and report actual greedy outcomes; we do not infer their numerical cause or adjust scores. Table 4 separates ranking, set, and termination behavior.

Training histories and uncertainty. The reporting unit is a training seed. Means, sample standard deviations, and paired differences should be computed from seed-level metrics without mixing evaluation lengths. Runtime can differ when accuracy-based stopping is used; report both steps and processed tokens. The figures preserve logged validation points without smoothing or extending stopped runs. Loss and validation plots describe observed optimization, not a causal advantage over architectures trained on other protocols. Available historical runtime metadata identifies an NVIDIA RTX 4090. The wall-time fields include periodic validation; they are not isolated kernel-throughput measurements.

References

  1. [1]Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 30, 2017. URL https://arxiv.org/abs/1706.03762.
  2. [2]Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. arXiv preprint arXiv:2307.03172, 2023. URL https://arxiv.org/abs/2307.03172.
  3. [3]Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman, Shantanu Acharya, Dima Rekesh, Fei Jia, Yang Zhang, and Boris Ginsburg. RULER: What’s the real context size of your long-context language models? arXiv preprint arXiv:2404.06654, 2024. URL https://arxiv.org/abs/2404.06654.
  4. [4]Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023. URL https://arxiv.org/abs/2312.00752.
  5. [5]Tri Dao and Albert Gu. Transformers are SSMs: Generalized models and efficient algorithms through structured state space duality. arXiv preprint arXiv:2405.21060, 2024. URL https://arxiv.org/abs/2405.21060.
  6. [6]Loïc Cabannes, Maximilian Beck, Gergely Szilvasy, Matthijs Douze, Maria Lomeli, Jade Copet, Pierre-Emmanuel Mazaré, Gabriel Synnaeve, and Hervé Jégou. Short window attention enables long-term memorization. arXiv preprint arXiv:2509.24552, 2025. URL https://arxiv.org/abs/2509.24552v3. Version 3, revised 2026.
  7. [7]Sukjun Hwang, Brandon Wang, and Albert Gu. Dynamic chunking for end-to-end hierarchical sequence modeling. arXiv preprint arXiv:2507.07955, 2025. URL https://arxiv.org/abs/2507.07955v2.
  8. [8]Tri Dao. FlashAttention-2: Faster attention with better parallelism and work partitioning. arXiv preprint arXiv:2307.08691, 2023. URL https://arxiv.org/abs/2307.08691.
  9. [9]Grégoire Delétang, Anian Ruoss, Jordi Grau-Moya, Tim Genewein, Li Kevin Wenliang, Elliot Catt, Chris Cundy, Marcus Hutter, Shane Legg, Joel Veness, and Pedro A. Ortega. Neural networks and the Chomsky hierarchy. arXiv preprint arXiv:2207.02098, 2022. URL https://arxiv.org/abs/2207.02098. Revised 2023.
  10. [10]John Hewitt, Michael Hahn, Surya Ganguli, Percy Liang, and Christopher D. Manning. RNNs can generate bounded hierarchical languages with optimal memory. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 1978–2010. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.emnlp-main.156. URL https://aclanthology.org/2020.emnlp-main.156/.DOI
  11. [11]Gail Weiss, Yoav Goldberg, and Eran Yahav. Thinking like transformers. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 11080–11090. PMLR, 2021. URL https://proceedings.mlr.press/v139/weiss21a.html.arxiv.org/abs/2106.06981
  12. [12]DeLesley Hutchins, Imanol Schlag, Yuhuai Wu, Ethan Dyer, and Behnam Neyshabur. Block-recurrent transformers. arXiv preprint arXiv:2203.07852, 2022. URL https://arxiv.org/abs/2203.07852.
  13. [13]Aydar Bulatov, Yuri Kuratov, and Mikhail S. Burtsev. Recurrent memory transformer. arXiv preprint arXiv:2207.06881, 2022. URL https://arxiv.org/abs/2207.06881.
  14. [14]Dongseong Hwang, Weiran Wang, Zhuoyuan Huo, Khe Chai Sim, and Pedro Moreno Mengibar. TransformerFAM: Feedback attention is working memory. arXiv preprint arXiv:2404.09173, 2024. URL https://arxiv.org/abs/2404.09173.
  15. [15]Bo Liu and Qiang Liu. Maglev: Sliding recurrent memory. arXiv preprint arXiv:2608.02870, 2026. URL https://arxiv.org/abs/2608.02870v2.
  16. [16]Songlin Yang, Jan Kautz, and Ali Hatamizadeh. Gated delta networks: Improving Mamba2 with delta rule. arXiv preprint arXiv:2412.06464, 2024. URL https://arxiv.org/abs/2412.06464.
  17. [17]Aakash Lahoti, Kevin Y. Li, Berlin Chen, Caitlin Wang, Aviv Bick, J. Zico Kolter, Tri Dao, and Albert Gu. Mamba-3: Improved sequence modeling using state space principles. arXiv preprint arXiv:2603.15569, 2026. URL https://arxiv.org/abs/2603.15569.

Paper details

vlnc:W_mv6wg4uu
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 5

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents