Introduction
As Transformer models scale in depth, they frequently encounter the challenge of over-smoothing. While standard residual connections facilitate gradient flow, the hidden states across different tokens tend to converge toward a uniform representation as they traverse deeper layers. This process dilutes the unique, "local" information of individual tokens into abstract, sequence-level features.
Furthermore, deep models often exhibit "attention sinks," where the model disproportionately attends to the initial token. This phenomenon occurs because the value vector's magnitude "drains" over layers, leading to numerical instabilities that the model attempts to mitigate by dumping attention onto the first token to maintain stability.
Methods: ResFormer and SVFormer
To address these issues, the authors propose two architectural innovations centered on "value residual connections." These connections ensure that the raw, token-level information from the early stages of the network is preserved and accessible to deeper layers.
- ResFormer: In a standard Transformer, each layer computes independent value vectors ($V_n$). ResFormer introduces a residual connection that adds the value vectors from the first layer ($V_1$) to the current layer's values before the attention operation. This ensures that raw token-level information remains directly accessible throughout the network.
- SVFormer (Single Value Transformer): A more efficient variant where all layers share the same value embedding from the first layer. This decouples the "value" from the attention operation in subsequent layers, significantly reducing the KV cache requirements during inference.
The researchers also explored a Learnable ResFormer variant, where the weighting ($\lambda$) between initial and current values is a trainable parameter, allowing the model to dynamically balance raw and processed information.
Key Results and Insights
The ResFormer architecture demonstrates significant improvements in both efficiency and performance across various benchmarks, including SlimPajama and zero-shot reasoning tasks.
- Efficiency Gains: ResFormer achieves the same validation loss as a vanilla Transformer with 16.11% fewer parameters and 20.3% less training data. This suggests a much higher information density per parameter.
- KV Cache Reduction: SVFormer reduces the KV cache size by nearly 50% with minimal performance impact, offering a path toward more memory-efficient deployment of large language models.
- Mitigating Attention Sinks: By providing a constant stream of high-magnitude information from the first layer, ResFormer naturally prevents the "value-state drain" that typically causes attention sinks, leading to more stable attention distributions.
- Information Density: Principal Component Analysis (PCA) indicates that ResFormer maintains more complex and diverse representations in its hidden states compared to the smoothed-out averages found in vanilla Transformers.
Limitations and Future Work
While promising, the "Learnable ResFormer" often settles on relative rather than absolute optima for its weighting parameters, suggesting a need for improved initialization or training strategies. Additionally, while tests were conducted up to 1.6B parameters, further validation is required to confirm these scaling benefits in massive models (e.g., 70B+ parameters). Future research may also explore the interaction between value residuals and other architectural components like Grouped-Query Attention (GQA).
Summary updated