Abstract: Large Language Models (LLMs) are trained with next-token prediction, implemented in autoregressive Transformers via causal masking for parallelism. This creates a subtle misalignment: residual connections tie activations to the current token, while supervision targets the next token, potentially propagating mismatched information if the current token is not the most informative for prediction. In this work, we empirically localize this input-output alignment shift in pretrained LLMs, using decoding trajectories over tied embedding spaces and similarity-based metrics. Our experiments reveal that the hidden token representations switch from input alignment to output alignment deep within the network. Motivated by this observation, we propose a lightweight residual-path mitigation based on residual attenuation, implemented either as a fixed-layer intervention or as a learnable gating mechanism. Experiments on multiple benchmarks show that these strategies alleviate the representation misalignment and yield improvements, providing an efficient and general architectural enhancement for autoregressive Transformers.
Introduction: The Structural Misalignment
In standard decoder-only LLMs, training relies on causal masking: the model processes token $t_i$ to predict the next token, $t_{i+1}$. To ensure stable training of deep architectures, these models rely heavily on residual connections, which persistently carry the representation of the current token ($t_i$) through the layers.
However, this creates a fundamental tension termed input-output leakage. While the residual stream is anchored to the input $t_i$, the optimization objective forces the hidden state to morph into the prediction target $t_{i+1}$. This paper investigates where this transition occurs and proposes a mechanism to alleviate the resulting structural misalignment.
Localizing the Causal Shift
To pinpoint where the model shifts from "thinking" about the input to "thinking" about the output, the authors employ a technique similar to the "logit lens." By decoding intermediate hidden states back into the vocabulary space, they track the alignment of representations across layers.
As shown in the figure above, the transition is not immediate. In many pretrained models, the first half of the network remains strongly anchored to the input token. The "causal shift"—where the representation becomes more predictive of the target than the input—only happens in the final third of the architecture. This suggests that residual connections in later layers may act as a "drag," forcing the model to fight against its own input-anchored bias to satisfy the next-token prediction objective.
Proposed Method: Residual Attenuation
To address this, the authors propose residual attenuation. The standard residual update $x_{l+1} = x_l + F_l(x_l)$ is modified to $x_{l+1} = \alpha x_l + F_l(x_l)$, where $\alpha \in [0, 1]$ scales the residual contribution. They explore two implementations:
- Fixed-layer intervention: Statically reducing $\alpha$ at a specific layer.
- Learnable gating: A dynamic mechanism that allows the model to learn the optimal attenuation for each layer during training.
Key Results and Gating Dynamics
Experiments on custom GPT-2 models and evaluations of larger pretrained models like Gemma and Mistral confirm that adaptive attenuation improves performance. Interestingly, when the model is allowed to learn the attenuation parameters, it converges to a specific pattern.
The gating mechanism identifies the final layer as the primary bottleneck for misalignment, driving its gate value (representing attenuation strength) toward 1.0. This automated discovery aligns with the empirical observation that the causal shift is most critical just before the final output. The learnable gating approach consistently outperformed baseline models across multiple benchmarks, including Wikitext, LAMBADA, and OpenWebText, with negligible computational overhead.
Conclusion
The "causal shift" reveals a structural inefficiency in the way Transformers handle the transition from input representation to output prediction. By introducing a simple, learnable residual attenuation mechanism, models can more effectively manage this transition. This lightweight architectural refinement offers a promising path for improving the efficiency and accuracy of future autoregressive language models.
Summary updated