BLOG

Tech Teardown 009 | RLT: Adding a Time Loop to Transformer, Latent Reasoning and the True Face of 'Infinite Temporal Depth'

Kael Zhang
AILLMResearch
广告 · Advertisement

Tech Teardown: Analyzing AI Technical Frameworks — Description, Analysis, Technical Assessment, Value Judgment, and Implementation. Author: Yongliang (永亮)


Transformer has a constraint rarely looked straight in the face: no matter how long the sequence is, the number of layers each token passes through is fixed. As the sequence grows from 100 tokens to 100,000, the computational depth of a single token remains motionless—the model becomes ‘wider’, but not ‘deeper’. In September 2026, Yifan Zhang released a technical report, Recurrent Looped Transformer (RLT), advocating liberating depth from the layer count: using a cross-token recurrent latent state to let the ‘effective computational path’ lengthen as the sequence grows. He calls this property infinite temporal depth. The repository was created just three days ago, and as of September 2026, it has already garnered about 743 stars and 77 forks. This article breaks down six things: what it is, the core mechanism down to the definition of state and cache, technical assessment, whether it’s worth chasing, how to implement it, and—if you want to write a minimalist recurrent feedback Transformer yourself—what the minimal skeleton is.

1. What is this

One-sentence positioning: RLT is a research paper-style project, with the core proposition of latent reasoning with infinite temporal depth—trading latent variable reasoning for an effective computational path that extends infinitely with the sequence, rather than exchanging depth by stacking layers.

Key facts first. Repository yifanzhang-pro/recurrent-looped-tranformer (note the repository name is tranformer, the original spelling missing an ‘s’), author Yifan Zhang, single-author technical report, released in September 2026, repository content open-sourced under Apache-2.0 license. As of September 2026, about 743 stars, 77 forks, created on September 12, 2026—three days ago. GitHub labels this repository’s main language as HTML because the repository body is currently the project homepage, with no official code implementation; the experimental numbers cited in the report come from a small third-party implementation with about 79K parameters by an independent contributor. The repository includes a paper PDF (Recurrent_Looppped_Transformer.pdf, the three ‘p’s in the filename are also the original spelling) and a Prefill-Decode kernel mismatch note, placed in the author’s Pretraining-RL-Science repository.

First, nail down the precise meaning of the phrase ‘infinite temporal depth’, because the entire project’s value rests on these words: after passing through t tokens, the recurrent path has cumulatively passed through t×L_D blocks (L_D is the number of decoder layers), but the number of blocks actually executed per token is fixed. In other words, this is a scalable temporal computational path that grows with the sequence—depth grows ‘in time’, not a single token gaining infinite computation internally. The author himself repeatedly emphasizes this distinction in the report, and all assessments in this article follow this standard.

2. Core Mechanisms

2.1 Overall Structure: Encoder manages global memory, decoder manages local memory plus time feedback

RLT slices the traditional decoder-only layer stack into two stacks with distinct roles. The encoder is causal, runs through the prompt once, and builds a global KV memory—information from all positions in the sequence is compressed into this memory for the decoder to retrieve at any time. The decoder is recurrent: 48 layers of encoder against 48 layers of decoder, with attention and FFN weights shared across stages. There is an accounting error easy to miss: each block in the decoder, besides self-attention, must additionally do a cross-attention to the encoder memory, so ‘equal layers’ does not mean ‘equal FLOPs’—the actual overhead of a single decoder layer is higher than a single encoder layer; this asymmetry is inherent to the architecture.

2.2 Attention Pattern: Three memories each manage a segment

The decoder’s every step faces three memories simultaneously, with a clean division of labor.

Global context relies on cross-attention: the decoder can only read the encoder memory via the current position, rather than every position re-scanning the full history. Local memory relies on sliding window attention (SWA): window W contains the current token, the cache retains W-1 history, history outside the window does not reside in the decoder; if you want it, you must retrieve it again from the encoder memory. Time feedback relies on recurrence: the final decoder output of the previous step enters the next token’s calculation as a latent variable. The superposition of these three mechanisms gives the model both a long-range global view and local context, plus an implicit temporal state running through the entire sequence.

2.3 State and Cache: The complete definition of H_t

The most worth reading word-for-word in this design is the definition of the decoder state. The complete decoder state is written as H_t = (s_t, C_t^D): s_t is the recurrent output (the final hidden state of the previous step), C_t^D is the SWA KV cache of each layer, initial state H_0 = (s_*, ∅)—the recurrent output starts from a special initial value, the cache starts from an empty set. Two engineering details best reflect the design intent: first, at the boundary between prompt and response, neither the recurrent output nor the SWA cache is reset; training samples and generated sequences share the same state trajectory. Second, ‘infinite depth’ grows out of this state definition—each token only goes forward once in a fixed number of layers, but s_t brings in the information from the previous step, and the total length of the recurrent path accumulates linearly with t.

2.4 A Token’s Complete Journey

Stringing the three memories together to see how a token walks. The t-th token enters, first merging with the previous generation’s recurrent output—s_{t-1} passes through feedback projection, combining with the current token’s embedding to form the decoder’s input. This input then passes through 48 layers of weight-shared decoder blocks: each layer first does self-attention within a sliding window of width W, retrieving this layer’s KV cache from C_t^D, then does a cross-attention to the encoder’s global memory, and finally passes through FFN. After finishing 48 layers, the final hidden state splits in two: one path becomes s_t after normalization, replacing s_{t-1} to enter the next round of recurrence; the other path connects to the output head to give the current token’s prediction. There is never a single ‘re-scan of full history’—global information is retrieved on-demand from encoder memory, local information is retrieved only from the window, and anything further back is in the latent variable s. This is the specific look of ‘depth growing in time’: the forward pass of a single token is still 48 layers, but each token stands on the shoulders of the previous step’s 48 layers.

2.5 One Set of Execution Semantics Spanning Training and Inference

The most engineering-oriented proposition in the RLT report is using the same set of complete-state transitions for pretraining, SFT, sampling, and RL. The state definition simultaneously includes prompt recurrence and SWA cache. The forms of the four scenarios are: prefill encodes causally by batch, recursively building SWA KV per prompt token; generation encodes incrementally, sampling from the prior state, each token consumed only once; pretraining uses full BPTT, supervising every legal next-token prediction, gradients passing through the entire recurrent trajectory; SFT only supervises assistant targets, but the state updates continuously along the full sequence. In traditional schemes, training unfolds via teacher forcing and inference unfolds via autoregression, the state semantics on both sides are inconsistent, and implicit bias is most prone to occur at the prompt boundary; RLT’s approach fills this gap from the definition.

2.6 RL Section: Harder Than the Architecture is the Honesty of Training Objectives

The density of the RL section in the report is quite high, and four conclusions are worth remembering verbatim. First, current-policy replay must rebuild parameter-dependent caches after weight updates—the KV cached in the state was calculated with old parameters; without rebuilding, the replay state is wrong. Second, complete gradients must pass through recurrent output, decoder KV cache, and encoder memory; any detach is a gradient approximation, not exact backpropagation. Third, behavior log-prob must describe the true sampling distribution; to calculate exact importance sampling, one must also satisfy support coverage—if the probability of an action appearing in the old trajectory is zero under the new policy after a policy update, the weight is undefined. Fourth, shared execution semantics eliminates the structural mismatch at the prompt boundary; it does not guarantee numerical-level kernel parity, nor does it automatically give you an unbiased off-policy objective. Reading these feels like construction specifications set for subsequent researchers: which pits are filled at the definition level, and which pits remain exactly as they are.

2.7 Synergy Between Model and Hardware, Model and Algorithm

The report also lists two sets of co-design principles. Model-hardware side: encoder does parallel batch processing, decoder cross-sequence batching, memory reuse, activation checkpointing trading for memory. Model-RL algorithm side: it’s that set of shared state transitions from 2.5. What needs to be viewed calmly is that the author himself states that inference improvements, hardware acceleration, and RL extension are research goals, not results tested in this report—section 2.7 describes design principles, not performance data.

3. Technical Assessment

First, the form of evidence: this project only has preliminary synthetic experiments recorded in the README, numbers all come from a small implementation of about 79K parameters, 3 random seeds, and the author explicitly wrote that FLOPs were unmatched and this is an independent synthetic proof of concept, not a verification of large-scale inference or RL extension. Assessment can only be done within this frame.

Experimental setup: two synthetic tasks, training uses operation sequences of length 32, evaluation extrapolates to 128 steps—4 times the training length, using 2048 test programs for each task and each length. The first parity task, within training length RLT approaches 100%, the control regular Transformer is 72%; extrapolating to 128 steps, RLT is 60.8%, the control group is 48%, and the random baseline is 50%—meaning the control group has already fallen below random level at 4x extrapolation length, while RLT can still maintain above the random line. The second five-state transitions task, within training length RLT also approaches 100%, the control group is only 24%; but extrapolating to 128 steps, RLT falls back to 20.7%, the random baseline is 20%—on this task, after 4x extrapolation, everyone returns to random guessing. Read together: recurrent feedback indeed brings the model generalization margin beyond the training length, obvious on the parity task; but this margin is highly task-dependent, on the five-state task it doesn’t survive 4x extrapolation. Two tasks, 79K parameters, unmatched FLOPs—this set of numbers can prove ‘mechanism is feasible, worth continuing research’, but cannot prove ‘this path will definitely work’.

Compared with top-tier work in the same direction, RLT’s difference lies in the design granularity of the state: it explicitly defines the complete decoder state (recurrent output plus layer-wise SWA cache), and insists on training and inference sharing the same set of state transition semantics, this discipline is not common in the latent reasoning direction—most schemes have two sets of code for training form and deployment form. The cost is also clear: the more complete the state definition, the less one can cut corners during implementation, the four construction specifications in section 2.5 are the bill of costs.

Cold water must be poured on the heat. Single author, repository three days old, main language HTML (no official code, experiments are third-party small implementation)—the approximately 743 stars as of September 2026 reflect the attractiveness of the idea ‘infinite temporal depth’, not engineering maturity. Reading it as a design document and research agenda, it has high value; reading it as a usable model or framework, currently there is nothing.

4. Value Judgment

The real problem is real: The single-token computational depth of a Transformer is fixed by the number of layers; on long sequences, the total computation the model has “seen” increases, but the depth of “thinking per step” has not increased. The latent reasoning line of work aims to fill this gap. RLT’s answer is a clear state definition plus shared execution semantics—especially the point of using one set of state transitions for both training and inference, which is a rare disciplined design in this direction.

The boundaries are equally clear. First, there is no official implementation; those who want to see the code can currently only read small third-party experiments. Second, the experiments are on 79K parameter-level synthetic tasks, FLOPs are not matched, and there is absolutely no data on performance in large-scale language modeling. Third, the authors drew the line themselves: inference improvement, hardware acceleration, and RL extension are research goals, not tested results—any paraphrasing that writes these three things as “RLT has already achieved” is over-interpretation. Fourth, the 4x extrapolation on the five-state task fell back to random levels, indicating that the margin brought by recurrent feedback has task boundaries and is not a universal capability. When it’s worth pursuing: For people doing latent reasoning, long-sequence state modeling, or training-inference consistency research, the state definition and construction specifications in this report are worth reading item by item. When not to pursue: For people who want an out-of-the-box usable model, this repository currently only has the paper and the project page.

5. How to Implement

Strictly speaking, this section does not have an “installation” in the traditional sense—there is no official code to install. There are three things that can be implemented. First, read the paper: The repository includes a PDF, containing the complete arguments for state definition, execution semantics, and the RL chapter. Second, read the accompanying notes: The author placed notes on Prefill-Decode kernel mismatch in the Pretraining-RL-Science repository, discussing the inconsistency in numerics and scheduling between the prefilling and decoding stages—this is exactly the kind of gap RLT tries to fill with shared execution semantics; reading the two together allows one to understand the design motivation. Third, reproduce experiments: The scale of synthetic experiments in the README is very small (approx. 79K parameters); write your own version according to the execution semantics in 2.4, compare with a standard Transformer using the parity task, and a person familiar with PyTorch can deliver a first version in one or two weeks. The repository content is open-sourced under Apache-2.0; the paper and documentation can be freely cited and rewritten.

6. How to Build a Similar Solution Yourself

“Writing a set yourself” is particularly feasible on this topic, because the core of RLT is just a state definition plus a training discipline. The minimal skeleton involves six steps:

  1. Separate the two roles: Take a standard Transformer block and duplicate it into two weight-shared stacks. The encoder stack causally encodes the entire input, keeping the K and V of each layer as global memory; the decoder stack is responsible for token-by-token generation. The number of layers doesn’t have to be 48; 4 layers vs 4 layers is enough to verify the mechanism.
  2. Define the complete state: Write the decoder’s state as a tuple H_t = (s_t, C_t), where s_t is the final hidden state of the previous step, and C_t is the KV cache of the sliding window at each layer (window W contains the current token, keeping W-1 history entries). Initial H_0 = (s_, ∅), where s_ can be learned as a parameter.
  3. Connect temporal feedback: The input for each new token is formed by merging its embedding with the previous step’s s_{t-1} (passing through a small projection layer and then adding), then entering the decoder stack: at each layer, first perform SWA within the window, then cross-attention on the encoder memory, and finally pass through FFN.
  4. Hold the boundary without resetting: At the boundary between prompt and response, s and the SWA cache remain unchanged—this is the soul of the entire mechanism; if reset, it degrades into a standard Transformer.
  5. full BPTT training: Unroll with teacher forcing, supervise the next valid token at every step, and let gradients flow through the entire recursive trajectory. You can detach to speed up, but remember that is a gradient approximation, so draw conclusions based on the approximation.
  6. Rebuild cache during RL: Every time the policy is updated, all parameter-related caches are recalculated; behavior log-prob is calculated using the true sampling distribution; check support coverage before importance sampling.

The core loop compressed into pseudocode is:

H = (s_star, empty_cache)                     # Initial state
for t in sequence:
    x = embed(token[t]) + W_fb @ H.s          # Temporal feedback: final hidden state of previous step
    for l in 1..L_D:                          # Each layer of decoder uses its own weights (shared with encoder across stages)
        x = SWA(x, H.cache[l], window=W)      # Local memory: keep only W-1 history entries
        x = cross_attention(x, enc_kv)        # Global memory: read only from current position
        x = FFN(x)
        H.cache[l].push(KV(x))
    H.s = final_norm(x)
    loss += CE(head(H.s), token[t+1])         # full BPTT, no cutting off midway
# prompt/response boundary: H.s and H.cache are not reset

Putting the six steps together, a mechanism-level verification reproduction can yield results in a month with one or two people. The real difficulty isn’t writing it out, but the discipline in steps 4 and 5—not resetting the boundary and not cutting off the gradient look like just two lines of code, but they are the entire source of “infinite temporal depth”.

Conclusion

RLT decouples Transformer’s computational depth from the number of layers: a 48-layer encoder provides global memory, and a 48-layer weight-shared decoder relies on sliding windows plus temporal feedback to let the effective computational path lengthen linearly with the sequence, while using a complete state definition running through training and inference to plug the structural bias at the prompt boundary. It is currently a single-author, three-day, approx. 743-star research report, with no official code, and experiments are just 79K parameter-level synthetic concept proofs with unmatched FLOPs—the stars are buying into the idea, not the engineering. But for those concerned with latent reasoning, its state definition and that construction-specification-style RL chapter are among the design documents most worth reading item by item in this direction right now.

Reference Sources

  • Recurrent Looped Transformer GitHub repository (README master branch, project homepage, paper PDF Recurrent_Looppped_Transformer.pdf): https://github.com/yifanzhang-pro/recurrent-looped-tranformer
  • GitHub repository metadata (star/fork/creation time/main language/license, api.github.com, as of September 2026)
  • Preliminary synthetic experiment data (README “Preliminary synthetic experiments” section, approx. 79K parameter implementation by independent contributor @AradhyeAgarwal)
  • Prefill-Decode kernel mismatch notes (yifanzhang-pro/Pretraining-RL-Science repository)
广告 · Advertisement

Frequently Asked Questions

What is RLT?

RLT is the abbreviation for Recurrent Looped Transformer, a Transformer model that achieves infinite temporal depth through a cross-token recurrent latent state.

How does RLT achieve infinite temporal depth?

RLT achieves infinite temporal depth by having the number of blocks accumulated by the recurrent path lengthen as the sequence grows, realizing an effective computational path that extends infinitely with the sequence.

Where is the RLT repository?

The RLT repository address is yifanzhang-pro/recurrent-looped-tranformer, and as of September 2026, it has received approximately 743 stars and 77 forks.