TL;DR
Deep Transformers often suffer from "oversmoothing," where token representations become nearly identical across layers, limiting model depth and performance. This paper introduces Graph-Filter-based Self-Attention (GFSA), which redesigns attention as a learnable graph filter that incorporates high-frequency components to preserve feature diversity. By adding just a few parameters, GFSA consistently boosts performance across computer vision, NLP, speech, and graph tasks.
What Problem Does This Paper Address?
Despite their success, deep Transformers hit a wall: as you add more layers, the output representations of different tokens tend to converge toward a single, indistinguishable value. This phenomenon, known as oversmoothing (or rank collapse), is a well-known issue in Graph Neural Networks (GNNs) but is equally problematic for Transformers.
The authors argue that standard self-attention acts primarily as a low-pass filter. It averages information from neighboring tokens, which effectively smooths out the "signal." While some smoothing is good for learning general features, too much of it destroys the unique information each token carries. The challenge is to enrich the attention mechanism so it can capture both local similarities and complex, high-order dependencies without exploding the computational cost.
Methods
The researchers bridge the gap between Transformers and Graph Signal Processing (GSP). They interpret the attention matrix $\bar{A}$ as a graph adjacency matrix and the self-attention operation as a simple graph convolution.
To fix the oversmoothing, they propose a more sophisticated graph filter:
- Polynomial Filtering: Instead of just using $\bar{A}$, they use a polynomial expression: $H = w_0I + w_1\bar{A} + w_K\bar{A}^K$. This includes an identity term ($I$) to preserve original features and a high-order term ($\bar{A}^K$) to capture long-range dependencies.
- Taylor Approximation: Calculating $\bar{A}^K$ is computationally expensive ($O(n^3)$). To keep the model efficient, the authors use a first-order Taylor approximation. This allows them to estimate the high-order effects using only $\bar{A}$ and $\bar{A}^2$, keeping the complexity manageable.
- Learnable Weights: The coefficients ($w_0, w_1, w_K$) are learnable. This allows each attention head to decide whether it needs to "smooth" (low-pass) or "sharpen" (high-pass) the features.
To further mitigate runtime overhead, they introduce a selective strategy, applying GFSA only to even-numbered layers, which maintains most of the performance gains while significantly reducing training time.
Datasets
The authors evaluated GFSA across a massive range of benchmarks to prove its generality:
- NLP: GLUE benchmark (including CoLA, SST-2, MNLI), Penn Treebank, and WikiText.
- Computer Vision: ImageNet-1k using DeiT, CaiT, and Swin Transformer backbones.
- Graph Tasks: ZINC (molecular property regression), PCQM4Mv2, and the Long-Range Graph Benchmark (LRGB).
- Speech: LibriSpeech (100h and 960h).
- Code: Devign (defect detection) and Java clone detection.
Key Insights and Ideas
- Attention is a Filter: The most profound insight is the formal treatment of self-attention as a low-pass graph filter. This allows researchers to apply decades of signal processing theory to Transformer architecture.
- High-Frequency Matters: By visualizing the filter response, the authors show that standard Transformers almost entirely discard high-frequency information. GFSA restores these frequencies, which is key to preventing oversmoothing.
- High-Order Dependencies: The $\bar{A}^K$ term captures "friends of friends" relationships. In a sentence, this helps the model understand relationships between words that aren't directly connected but are linked through a common context.
- Minimal Overhead: The entire GFSA mechanism adds only tens to hundreds of parameters to models that already have millions. It is an extremely "cheap" upgrade in terms of memory.
Key Results
GFSA delivered impressive gains across the board:
- Image Classification: Improved DeiT-S top-1 accuracy on ImageNet-1k by 1.63%.
- Natural Language Understanding: Boosted RoBERTa's performance on the CoLA dataset by 6.25%.
- Speech Recognition: Achieved a 4.55% improvement in Word Error Rate (WER) on LibriSpeech.
- Graph Regression: Reduced error (MAE) on the ZINC dataset by 4.03%.
Crucially, the visualizations in the paper confirm that GFSA successfully mitigates oversmoothing. As shown in Figure 2, the cosine similarity between token representations stays much lower in GFSA-equipped models compared to vanilla Transformers as the layers get deeper.
Limitations and Future Work
- Computational Complexity: While the Taylor approximation helps, calculating $\bar{A}^2$ still adds a slight overhead to the $O(n^2)$ attention mechanism. For very long sequences, this could become a bottleneck.
- Environmental Impact: The authors briefly mention the carbon footprint of training larger models and suggest that future work should optimize GFSA for even better energy efficiency.
- Advanced Filters: This paper uses a relatively simple polynomial filter. The authors suggest that exploring more complex graph filters (like ChebNet or Cayley filters) could yield even higher accuracy, albeit at a higher computational cost.
Summary updated