Increasing Effective Reasoning Depth Without Increasing Parameter Count
Model capability is often equated with parameter count, but code completion, multi-file editing, and mathematical proofs depend heavily on how many times the same representation can be refined—not only on vocabulary size or model width. This article presents an engineering approach for increasing effective depth by repeatedly running a contiguous block of pretrained layers with controlled per-token writeback, shared key-value caches, and reusable sparse-attention indices. It covers training strategy, memory management, inference scheduling, evaluation, and the practical limits of recurrent depth.
Effective Depth Through Parameter Reuse
A model’s width determines how many patterns can be retained in parallel at each step. Its depth determines whether those patterns can be progressively constrained, corrected, and turned into an executable result.
Simply adding new layers increases memory usage, communication, and pretraining cost roughly linearly. A more economical alternative is to take a contiguous block of layers from a trained base model and run it for several additional rounds with shared weights. With a relatively small amount of continued training, the model can gain greater effective depth without increasing its parameter count.
This is not a proposal tied to one particular model release. It is an engineering pattern for implementing recurrent depth in a practical system.
Recurrent Depth and Parameter Sharing
Recurrent execution is not just meaningless repetition of the same computation. The first round can be viewed as building a global working memory: binding symbols, identifying file boundaries, and determining which constraints have already been satisfied. Later rounds refine that memory by tightening types, adding missed branches, or removing unnecessary self-explanation.
Because the weights are shared, the optimizer receives gradients from the same parameter set across multiple virtual layers. This concentrates the training signal, but it can also push hidden states away from the numerical scale familiar to the pretrained base model. Whether recurrence works therefore depends on controlled writeback, cache growth, and avoiding repeated computation of auxiliary indexing structures.
Pretraining a recurrent architecture from scratch is not always cost-effective. Earlier research has shown that, at equal compute budgets, deep networks with shared weights often underperform stacks with independent parameters at every layer. Sharing reduces representational capacity and can make optimization more difficult.
A safer path is to preserve a base model that is already aligned with the data distribution. Only a contiguous group of its middle layers is converted into a recurrent block with a fixed number of rounds, followed by continued training using roughly an order of magnitude less additional computation than full pretraining. Most of the distribution shift then comes from taking a few extra computation steps rather than rebuilding the entire representation space.
Multi-scale experimentation also favors validating the gating, caching, and indexing strategies on a smaller base model before moving to a larger one. When the architecture is structurally identical, instability observed at small scale will often become more pronounced at larger scale.
Per-Token Gating Instead of Whole-Layer Replacement
The simplest recurrent design directly replaces the old hidden state with the new hidden state at every round. Numerically, this is equivalent to resetting the residual stream to a candidate vector. After several rounds, activation norms can grow, causing normalization statistics, attention logits, and feed-forward gates to drift away from their pretrained operating points. The result may appear as loss spikes, repetition, or hallucination in long-context workloads.
A more stable design gives each round its own per-token gate and writes back only a fraction of the candidate change. Let the current hidden state be (h), the candidate update produced by the recurrent sublayer be (\Delta), and the gate be (g \in (0,1)), computed independently for each token:
[
h’ = h + g \odot \Delta
]
When (g) is close to zero, the round is mostly read-only. It can accumulate context without significantly disturbing the existing scale. When (g) approaches one, the round can fully return its refined result to the residual stream.
After continued training, the gates often specialize naturally. Earlier rounds tend to use smaller gate values and establish the global state, while later rounds open the gates further and rewrite the state based on that foundation. This division should not be enforced by manually fixing one round’s gate, because easy and difficult examples may require different update strengths. Per-token gating is particularly important for code, where identifiers, whitespace, and comments do not all require the same amount of additional processing.
Three implementation details matter:
- Use a bounded function for the gate. A value greater than one during early training can cause a single writeback to destabilize the activation norm.
- Keep gate parameters independent for each round. Do not bind them to the recurrent main weights in the same tensor; “how much to write” must remain independently tunable from “what to compute.”
- Monitor activation norms and attention entropy before and after writeback at every round. If later-round norms remain above historical quantiles for the corresponding base-model layers, reduce the learning rate or shorten the recurrent block before increasing the number of rounds.
Key-Value Caching: Global Sharing with a Sliding Window
If every round maintains a complete key-value cache, memory usage grows proportionally with the number of rounds. In long-context inference, the cache is already one of the largest consumers of memory. Keeping a full cache for every round can substantially reduce the maximum sequence length that fits in memory.
A more efficient design divides the cache into two parts:
- A sparse global key-value cache shared across rounds.
- A finite sliding window containing key-values generated in the current round but not yet absorbed into the global index.
The second round does not materialize the entire cache from the first round again. Instead, it reuses the sparse key-values selected during the first round and retains only the key-values it computes within the sliding window. These local entries help correct newly generated tokens and nearby context.
The additional memory is therefore approximately the size of one window rather than the size of the entire sequence multiplied by the number of rounds. The window must cover dependencies near the current generation position, such as a code block that was just closed or a function signature that has not yet been committed. If it is too short, later rounds cannot see local facts they have just written. If it is too long, the benefits of sharing diminish.
Shared caches also introduce a consistency problem. The keys selected in the first round were computed from a shallower state, while the query distribution in the second round has already changed. If later rounds are never allowed to update global keys, refinement is restricted to the query side. If global keys are rewritten at every step, sharing effectively becomes recomputation.
A practical compromise is to freeze global keys between rounds or refresh them infrequently. Sliding-window keys can be updated as generation proceeds, and stable entries can be merged back into the sparse global set at block boundaries. On the serving side, allocate cache pools by sequence rather than by round. This avoids triggering memory reallocation whenever the number of rounds changes.
Reuse Sparse-Attention Indices Whenever Possible
Long-context models often use an indexer to select a small set of important positions before performing attention. If the indexer is rerun at every round, the extra cost becomes more than another pass through the main block: it adds another indexing pass and another main computation pass. Wall-clock time and compiled-kernel launch overhead both increase.
In practice, the second round can often reuse the positions selected by the first-round indexer with quality close to that of recomputing the index. Positions that need to be read repeatedly are usually exposed while the first round is establishing global state. Later rounds generally need deeper processing of those positions, not an entirely new position list.
The prerequisite is that the indexer must operate on a representation or key shared across rounds, rather than on temporary vectors that differ substantially from one round to another. Some tasks may depend heavily on conclusions that emerge only in later rounds. In multi-hop retrieval, for example, an entity needed in a later step may not become identifiable until an earlier entity has been resolved.
For such cases, enable local re-indexing only for the sliding window or tokens newly produced during the current inference step, rather than recomputing indices over the entire sequence. During evaluation, report both full re-indexing and index reuse. Make reuse the default only after confirming that the quality gap is acceptable.
Training Budget and Where the Capability Appears
The recurrent block should not cover the entire network. Layers near the input are responsible for converting discrete tokens into stable representations, while layers near the output help align representations with the vocabulary. Sharing weights across both ends can damage input scaling and output calibration. A contiguous group of middle layers is generally a better candidate for recurrence.
The number of rounds should be small and fixed. This simplifies static-graph compilation, cache reservation, and speculative decoding. Dynamic early exit can be introduced later as an inference optimization, but fixed rounds during training make gradient scales more consistent.
The additional continued-training cost should remain controlled. Each extra round increases forward and backward computation roughly in proportion to the depth of the recurrent block, not the depth of the entire network. Therefore, a modest increase in total training compute with unchanged parameter count is the expected scale of this approach, not an anomaly.
Validation should proceed across progressively larger model sizes. At every size, keep the data mixture and major optimizer settings identical to the baseline, changing only the recurrent block, gates, and caching strategy. Otherwise, improvements cannot be attributed reliably to effective depth.
Recurrent depth is usually less helpful for short and shallow tasks and more helpful for problems requiring multiple rounds of constraint checking. Mathematical reasoning benefits from repeatedly verifying invariants. Long-context processing benefits from aligning previously read content step by step. Code generation benefits from moving between local edits and global type consistency.
In these tasks, the problem is often not that the model failed to remember a fact. The intermediate state simply was not processed again. At the same time, visible output may become shorter because some intermediate steps that were previously expressed as chain-of-thought text are absorbed into the additional internal depth instead of being generated token by token.
Evaluation should therefore include more than final accuracy. Track output length, tool-call count, and latency per unit of work. Otherwise, a reduction in unnecessary text may be mistaken for reduced reasoning, or the extra forward passes may be treated as an unqualified gain.
Placement in an Inference System
From a serving perspective, recurrent depth adds computation within a sequence; it does not create additional model replicas. The scheduler should estimate per-request cost as:
number of rounds × recurrent-block compute
rather than looking only at parameter count.
Requests with the same number of rounds can be batched together. If early exit is supported, split batches at round boundaries so short requests are not held back by longer ones. Manage the key-value pool in two tiers: a shared global region and a per-request sliding-window region. The global region can be reused when prefix-cache entries match, while sliding-window entries must remain isolated per request.
Numerical stability is more important than extreme compression. When quantization, speculative decoding, and recurrence are combined, small gate values can be lost to quantization error, causing the writeback to become effectively all-or-nothing. First stabilize gate behavior in full or higher precision, then enable compression techniques one at a time. Long-code and long-context subsets should be evaluated separately after each change.
At minimum, observability should retain:
- Mean gate values for every round
- Activation norms
- Cache hit rates
- Index reuse rates
These signals explain quality regressions more effectively than aggregate latency alone.
For data and experiment management, checkpoints can be stored in general-purpose object storage, while containerized environments can isolate continued training at different model sizes. Logging and monitoring systems can track activation norms and gate behavior. None of these requirements depends on a proprietary interface.
When comparing against a baseline, enforce three conditions:
- Parameter counts are equal.
- The architecture is identical except for the recurrent block.
- Any increase in total training compute is explicitly recorded.
Only under these conditions can the benefit of effective depth be separated from the effect of simply training for many more steps.
Practical Boundaries
Recurrent depth is most suitable when a capable base model already exists and the bottleneck is multi-step reasoning rather than knowledge coverage. It does not replace data cleaning, and it cannot fix fundamental limitations in the vocabulary or positional encoding for extremely long sequences.
The main mechanisms address different costs:
- Gated writeback controls activation-scale drift.
- Shared key-value caching prevents memory from growing with the number of rounds.
- Index reuse prevents repeated computation of auxiliary attention structures.
All three should be designed together. Implementing only one often allows another cost to eliminate the benefit.
For code workloads, the most meaningful question is whether the one-pass success rate for complex patches improves under the same latency budget, and whether a shorter chain of thought is accompanied by more reliable tool-based verification. When these constraints are included in a unified training and inference budget, recurrence becomes additional depth rather than mere repeated computation.
