Recurrent Decoding Architectures: KV Cache Growth and Long-Context Inference Tradeoffs
Recurrent decoding reuses the same network layers across multiple passes over an evolving hidden state, but parameter sharing does not imply cache sharing. This article explains how to evaluate such architectures by separating parameters, compute, and cache; why recurrent rounds can become a new KV cache dimension; and three strategies for controlling cache growth: per-round caches, hybrid long-range reuse with short-range state, and shared global memory. It also outlines the practical value and hard limits of this combination for long-context agents, plus how to run fair, multi-dimensional evaluations that separate prefill from decode and account for total serving cost.
1. Evaluating a Recurrent Architecture: Separate Parameters, Compute, and Cache
No architecture can be judged by parameter count alone, and the number of times a block of layers is repeated is not enough to infer either reasoning ability or deployment cost. For a recurrent decoding architecture, three questions have to be answered separately: which parameters are reused, how much compute actually runs, and which intermediate states must be preserved across generation steps.
Recurrent computation means applying the same set of network layers repeatedly to a continuously updated hidden state. This differs from simply stacking more independent layers: independent layers add parameters and compute together, whereas recurrence mainly adds compute depth and does not necessarily add independent parameters in the same proportion.
Parameter sharing, however, does not imply cache sharing. Even when two passes use identical weights, different input hidden states generally produce different keys and values. If later generation must attend to each of those states separately, the system may still need to keep several attention caches.
The core value of a recurrent architecture is therefore not “a small parameter count that behaves like a much larger model.” It is a way to redistribute parameter capacity against inference compute. Any benefit has to be validated jointly through task quality, inference latency, cache overhead, and concurrent throughput; it cannot be derived from the structure description alone.
2. Why Recurrent Computation Tends to Amplify the Attention Cache
2.1 The cache stores historical states, not model parameters
In autoregressive generation, every new token requires the existing context. To avoid recomputing the keys and values of past tokens, implementations typically keep a key-value cache (KV Cache).
Ignoring compression, memory alignment, and additional metadata, cache capacity can be approximated as:
M ≈ 2 × B × T × L × H × D × S
where:
- B is the number of sequences processed concurrently;
- T is the cached context length;
- L is the number of layers that keep an independent cache;
- H is the number of key/value heads;
- D is the dimension of each key/value head;
- S is the number of bytes per element;
- the factor 2 accounts for the key and value parts.
The expression makes one point clear: cache pressure depends not only on context length but also on how many independent sets of historical states exist.
2.2 Recurrent rounds can become a new cache dimension
Suppose a module is executed R times and each round performs attention over its own history. If every round’s state has to be kept separately, that module’s cache may grow by roughly a factor of R.
The reason is straightforward. The first round processes the initial hidden state; the second processes the state after the first update. Their keys and values should not be assumed identical by default.
Feeding the first round’s cache into the second round’s attention changes the computation semantics. That may be a valid architectural choice, but it has to be adopted explicitly in both training and inference; it cannot be treated as an ordinary cache optimization that leaves results unchanged.
Another misconception is worth avoiding: two recurrent rounds do not automatically double the model’s total cache. The actual increase depends on how many layers the recurrence covers, the attention form used in each layer, whether caches are shared, and whether local windows or compression mechanisms are in place.
3. Three Main Approaches to Limiting Cache Growth
3.1 Independent cache per round: clear semantics, higher capacity cost
The most direct option is to maintain a separate history cache for each recurrent round. It expresses clearly that each round depends on its own history, and it makes it easy to check that training and inference agree.
The cost is that cache capacity, memory access, and scheduling overhead may all grow with the number of rounds. For short contexts this may not be a bottleneck; with long contexts and many concurrent requests, it can significantly limit how many requests can be served.
Independent caches are therefore not unreasonable. They fit scenarios with a sufficient cache budget, a need for explicit per-round state, and benefits large enough to cover the cost.
3.2 Long-range reuse with short-range independent cache: a hybrid memory to control cost
Another approach splits history into a long-range and a short-range part: distant history uses a shared or sparse representation, while the most recent context keeps round-specific fine-grained state.
The design tries to satisfy two needs at once: distant information remains accessible, and recent state retains richer computational detail.
It also introduces additional system complexity, for example:
- what filtering or compression strategy is used for distant history;
- how different recurrent rounds use the same history representation;
- how state is migrated or discarded as the local window moves;
- whether sparse indexes need updating;
- how requests of different lengths are batched.
Note in particular that reusing a sparse index is not the same as reusing cache content. Index reuse may reduce the cost of selecting candidate positions, but if each round still stores its keys and values independently, total cache capacity may not drop much.
3.3 Shared global memory: decouple reading history from updating state
A more effective way to control recurrent cache growth is to split the network into a memory-building part and a memory-reading part.
The first part processes the context and builds a historical representation that later layers can access. The second mainly reads that representation through attention and updates the current hidden state. If the recurrence happens in the second part and every round reads the same global memory, it may be possible to avoid adding a full global history cache per round.
Sharing, however, has to be real in storage terms. If each round still produces and long-term stores its own global key/value projections, the cache savings shrink. An architectural analysis should state exactly what is shared: the raw hidden representation, already-projected keys and values, or merely a logical interface.
4. Why Shared Memory Fits Recurrent Computation
The combination can be understood as this conceptual flow:
input context → build shared memory → initialize current state → read memory and update state over multiple rounds → output prediction
The difference from building a full history cache per round is that the storage of long-term information is separated from the iterative computation of the current state.
4.1 Global history does not have to be stored per round
If all recurrent rounds read the same set of historical keys and values, adding rounds mainly adds reads and state updates rather than another full copy of the global cache.
The wording should be precise here: what does not grow with the number of rounds is the shared global history cache, not total GPU memory. Total memory also includes model weights, temporary activations, attention workspace, local state, and request management data.
If the reading part still uses local self-attention and keeps an independent window per round, local cache may also grow with rounds. Its growth is bounded by the window length rather than directly by the full context length.
4.2 Long-term memory and local reasoning can use different strategies
The main goal of long-term memory is to retain retrievable information; the goal of the recurrent part is to integrate information repeatedly and revise the current judgment. Because the two have different responsibilities, they can be optimized separately.
Long-term memory can emphasize sharing, compression, and stable access; local reasoning can emphasize state updates, short-range dependencies, and compute depth. Separating responsibilities helps avoid making every layer carry the full history storage task.
This also imposes an expressiveness constraint: if the shared memory cannot retain the detail a task needs, no number of additional rounds can recover information that has already been lost. More compute depth is not a substitute for sufficient information supply.
4.3 Cache efficiency is not compute efficiency
Shared memory reduces repeated storage; it does not necessarily reduce attention reads. Each extra round may still require another pass over the long-context memory, plus attention, feed-forward transformation, and a state update.
So even when cache capacity stays roughly flat, per-token generation latency may rise as rounds increase. With long histories, memory bandwidth and attention computation can become the new bottleneck.
This is not a basis for claiming that a model can handle million-token contexts cheaply. Whether very long contexts are practical also depends on training length coverage, positional representation, retrieval ability, attention strategy, hardware capacity, and serving scheduling.
5. Practical Value and Limits for Long-Context Agents
Agent applications often need to keep reading task instructions, conversation history, external material, and execution feedback. As the task progresses the context grows, and the system faces two pressures at once: preserving information and making multi-step decisions.
In theory, shared memory plus recurrent computation addresses these separately: shared history reduces repeated storage, and repeated computation provides more compute steps for complex state updates.
Three limits still matter in practice.
First, recurrence is not automatically reliable reasoning. More rounds may improve information integration, but they may also over-smooth state, accumulate errors, or yield diminishing returns. The effective range must be established through task evaluation.
Second, when the context keeps growing, the shared memory itself keeps growing. Sharing solves repeated storage, not unbounded history growth; context trimming, summarization, segmentation, or other memory management strategies are still required.
Third, external actions in an agent must not be triggered repeatedly because of internal recurrence. Internal multi-round computation and external execution need a clear boundary; actions that write, submit, or change resources should be governed by a separate execution control mechanism.
6. Building a Credible Evaluation Method
6.1 Measure prefill and generation separately
Prefill processes the existing context; the generation phase produces new tokens step by step. Where the recurrent computation sits changes its impact on each phase.
Record time to first token, subsequent generation speed, and peak memory at each stage separately, instead of hiding different bottlenecks behind a single average latency.
6.2 Use multi-dimensional experiments instead of single-point demos
At minimum, cover:
- different context lengths;
- different numbers of recurrent rounds;
- different levels of request concurrency;
- different output lengths;
- different task complexity.
Quality tests should not stop at whether the model can locate a specific sentence. They should also include cross-paragraph association, multi-condition constraints, historical state updates, and recognition of distracting information.
6.3 Keep comparisons fair
When comparing cache schemes, control training conditions, numerical precision, input and output lengths, hardware resources, and batching behavior as closely as possible.
It is also useful to compare performance under an equal parameter budget, a comparable compute budget, or the same latency budget. These comparisons answer different questions and should not be merged into a single “better” conclusion.
6.4 Account for the full serving cost
Reducing cache may raise concurrency capacity, while recurrent computation may lower per-request throughput. What matters is how the whole service behaves at the target load, not a single-request memory screenshot.
Key metrics include task success rate, peak memory, cache occupancy, throughput, tail latency, and the degree of quality degradation under long contexts.
7. Conclusion: The Real Question Is Whether State Reuse Holds
What matters in a recurrent decoding architecture is not how many layers are repeated, but which states can be shared during the repeated computation and which must be kept independently.
When the recurrent part depends on a separate global history per round, cache may grow substantially with rounds. When it reads shared global memory, compute depth and global cache capacity can be partially decoupled.
That decoupling has clear limits: it does not mean total GPU memory stays constant, it does not remove the extra cost of long-context computation, and it cannot replace task quality validation. A design worth adopting balances sufficient information retention, reasonable recurrent gains, and controllable serving cost.
