Intra-Layer Recurrence in Transformers for Language Modeling
Anthony Nguyen, Wenjun Lin
TL;DR
The paper addresses the computational and memory growth of deep Transformer language models by proposing Intra-Layer Recurrence (ILR), a mechanism that re-enters selected layers within a single forward pass to adjust effective depth without adding parameters. ILR is defined by a per-layer reuse map $\mathbf{R}=[r_1,\dots,r_L]$ and a modified forward computation, with gradients propagating through repeated passes via equations for $\partial \mathcal{L}/\partial h^{(l-1)}$ and $\partial \mathcal{L}/\partial \theta^{(l)}$. Empirical results on LLaMA-based decoders at small and large scales show that prioritizing early-layer recurrence yields the strongest perplexity reductions, albeit at increased compute cost, while block recurrence offers mixed benefits. The findings highlight the value of granular, layer-wise recurrence for efficient language modeling and point to future work on adaptive recurrence strategies and scalable discovery of optimal recurrence distributions.
Abstract
Transformer models have established new benchmarks in natural language processing; however, their increasing depth results in substantial growth in parameter counts. While existing recurrent transformer methods address this issue by reprocessing layers multiple times, they often apply recurrence indiscriminately across entire blocks of layers. In this work, we investigate Intra-Layer Recurrence (ILR), a more targeted approach that applies recurrence selectively to individual layers within a single forward pass. Our experiments show that allocating more iterations to earlier layers yields optimal results. These findings suggest that ILR offers a promising direction for optimizing recurrent structures in transformer architectures.
