Recurrent Depth Scaling and the Evolution of YOCO Architectures

    This article examines why recurrent depth has become a focal point in LLM architecture design, and why placing recurrence inside a standard decoder-only model creates structural engineering problems. It covers three obstacles: KV cache growth across recurrence rounds, wasted prefill compute, and cache misalignment caused by per-token dynamic recurrence. The article then explains how a layered architecture that encodes in the front stage and maps in the back stage (commonly referred to as the YOCO approach) resolves these issues by decoupling cache footprint from loop count, shifting compute to benefit decoding, and making dynamic depth viable. Open problems and practical recommendations are included.

    1. Introduction: Why Recurrent Depth Is Becoming an Architectural Focus

    During inference of large language models, a long-standing tension exists: deeper networks generally deliver stronger representational capacity, but stacking more layers directly increases memory usage and computational latency. Loop-style structures (Loop Transformers) offer a compromise — the same set of layers is reused across multiple passes, trading time for space and extending effective depth without increasing parameter count.

    However, once a recurrent structure is placed inside a standard decoder-only model, engineering complexity rises quickly. Starting from how KV cache behavior changes, this article analyzes the root of the problem and then discusses why a class of layered architectures that encode in the front stage and map in the back stage — commonly known as the YOCO approach — is naturally better suited to hosting recurrent computation.

    2. Three Structural Obstacles to Recurrence in Standard Decoding Architectures

    2.1 KV Cache Expands with the Number of Recurrence Rounds

    In a standard causal decoding structure, the key and value tensors of every layer must be cached so that subsequent tokens can reuse them. Once a few layers are made to run two rounds, the keys and values produced in the second round will double memory usage if they continue to be written to the cache. For million-token contexts, this expansion is unacceptable.

    A common engineering compromise is a tiered caching strategy: distant tokens reuse the sparse keys and values generated in the first round, nearby tokens maintain a separate sliding window holding second-round keys and values, and a sparse index is layered on top for reuse. Such schemes can be made to work, but index maintenance, window switching, and cache consistency checks make the implementation fragile — any mishandled boundary condition can introduce accuracy drift.

    2.2 Wasted Compute in the Prefill Stage

    In long-context agent scenarios, input prompts routinely reach the order of a hundred thousand tokens. If recurrence happens in the front part of the model, every token in the prefill stage must run through all recurrence rounds, yet these intermediate computations contribute little to the final first-token output. Compute is consumed heavily on “warm-up,” and throughput in the decode stage is squeezed as a result.

    2.3 Per-Token Dynamic Recurrence Causes Cache Misalignment

    The ideal recurrence policy adds depth on demand: simple tokens run one round, difficult tokens run five. But in a standard structure, the extra rounds a current token runs change its final hidden state, which in turn affects the key-value cache content of subsequent tokens and causes cache misalignment within the sequence. This makes dynamic depth nearly impossible to implement while preserving causal consistency.

    3. Why Encode-in-Front, Map-in-Back Architectures Fit Better

    The core idea of this architecture is to split the network into two stages. The front stage reads the input and generates a global KV cache; the back stage no longer maintains a global cache of its own, but instead linearly maps the keys and values it needs from the front-stage output. The recurrent structure is placed in the back stage.

    A schematic description of the structure is as follows:

    1. Input tokens
    2. │
    3. ▼
    4. [Front stage L1..Lk] ──► generates and freezes global KV cache
    5. │
    6. ▼
    7. [Back stage Mk..Mn] ──► KV mapped from front-stage output; no global KV stored locally
    8. │ └─ can loop 2/4/8 rounds
    9. ▼
    10. Output logits

    3.1 Cache Footprint Decoupled from Recurrence Rounds

    The back stage writes no global cache, so memory usage for million-token contexts stays constant whether it loops two rounds or eight. This directly eliminates the expansion problem in 2.1 and removes the need for complex sparse reuse and sliding-window switching logic.

    3.2 Prefill Compute Moves Forward, Decode Benefits

    Because recurrence sits in the back stage, the prefill stage only needs the front stage to run once completely in order to freeze the cache; the back-stage loops can be deferred and triggered on demand during the decode stage. In long-prompt scenarios, first-token latency improves markedly, and the compute budget is left for the decoding steps that actually affect generation quality.

    3.3 Dynamic Depth Works Naturally

    Every back-stage round reads the global keys and values already frozen by the front stage, so however many loops the current token makes inside the back stage, it cannot pollute other tokens’ caches. Per-token dynamic computation — one round for simple words, five for hard ones — can therefore be implemented safely, with test-time compute genuinely built into the architecture rather than bolted on as a patch.

    4. Open Problems Still to Be Solved

    4.1 Intermediate States Cannot Be Written Back

    The deep hidden states produced during back-stage recurrence cannot be written back to the global cache; the next token can only see the representation from the final round, not the intermediate reasoning trace of the previous round. This may break information flow across tokens. Viable mitigation directions include introducing an additional side-information channel, compressing some intermediate states into transferable summary vectors, or reserving a few writable slots in the front stage.

    4.2 Mapping Quality Sets the Ceiling

    Back-stage keys and values depend entirely on a linear mapping of the front-stage output, so the capacity of the mapping matrix and the sufficiency of its training directly limit the expressiveness of the back stage. If the mapping is too coarse, the gains from multiple recurrence rounds will be canceled out.

    4.3 Consistency Between Training and Inference

    Dynamic recurrence means sampling over a “round-count distribution” during training; otherwise the round-count decisions made at inference time will mismatch the training distribution. This requires the training pipeline to model the round-scheduling policy explicitly.

    5. Practical Recommendations

    • If the goal is a very-long-context agent, evaluate the layered “front-stage encoding + back-stage recurrence” scheme first, rather than forcing recurrence into a standard structure.
    • Treat the caching strategy as a first-class design concern: decide which layers write the cache and which layers only read mapped values before discussing round counts.
    • Dynamic depth needs a companion round-count predictor and training sampling strategy to avoid distribution drift at inference time.
    • For the intermediate-state passing problem, reserve information-flow channels early in the architecture design instead of patching them in later.

    6. Conclusion

    The value of recurrent depth scaling is beyond doubt, but placing it in the wrong architectural position lets engineering complexity spiral out of control. The layered approach — the front stage handles encoding and caching, the back stage handles mapping and recurrence — holds advantages simultaneously across three dimensions: cache stability, prefill efficiency, and dynamic computation, making it the more worthwhile direction to invest in today. At the same time, intermediate-state write-back and mapping quality remain key topics that need continued refinement.