Oversmoothing and Oversquashing in GNN
Deep Graph Neural Networks face two fundamental challenges that limit their effectiveness: oversmoothing and oversquashing. These phenomena become particularly problematic as the number of layers increases, preventing GNNs from learning meaningful node representations in deeper architectures. This post provides a detailed exploration of both problems, their underlying causes, and state-of-the-art solutions.
While deep neural networks have shown remarkable success in computer vision and natural language processing, stacking many layers in GNNs often leads to performance degradation. Unlike CNNs or Transformers, where depth typically improves performance, GNNs suffer from two distinct but related issues:
- Oversmoothing: Node representations become increasingly similar across the graph
- Oversquashing: Information from distant nodes gets compressed into fixed-size vectors
Understanding these phenomena is crucial for designing effective GNN architectures and training strategies.
Oversmoothing
What is Oversmoothing?
Oversmoothing refers to the phenomenon where node representations in a GNN become indistinguishable as the number of layers increases. After several message-passing iterations, nodes with different structural roles and features converge to similar representations, losing their discriminative power.
Mathematical Formulation
Consider a GNN with $L$ layers. The representation of node $v$ at layer $l$ is denoted as $h_v^{(l)}$. In many GNN architectures, the update rule can be written as:
\[h_v^{(l+1)} = \sigma\left(W^{(l)} \cdot \text{AGGREGATE}\left(\{h_u^{(l)} : u \in \mathcal{N}(v) \cup \{v\}\}\right)\right)\]As $l \to \infty$, under certain conditions, all node representations converge to the same vector:
\[\lim_{l \to \infty} h_v^{(l)} = h^* \quad \forall v \in \mathcal{V}\]where $h^*$ is a fixed point that depends only on the graph structure and initial features, not on individual node identities.
Why Does Oversmoothing Occur?
Oversmoothing arises from the diffusion process inherent in message passing:
- Repeated Averaging: Each layer averages information from neighbors, which acts as a smoothing operation
- Spectral Properties: The graph Laplacian’s spectral properties cause the diffusion to converge to a stationary distribution
- Information Loss: After many layers, local node-specific information gets diluted by global graph structure
Measuring Oversmoothing
Several metrics quantify the degree of oversmoothing:
Representation Distance
The average pairwise distance between node representations:
\[\text{Smoothness}(H^{(l)}) = \frac{1}{|\mathcal{V}|^2} \sum_{u,v \in \mathcal{V}} \|h_u^{(l)} - h_v^{(l)}\|_2\]As oversmoothing occurs, this distance approaches zero.
Dirichlet Energy
A measure of how “smooth” the node representations are:
\[E_{\text{dir}}(H^{(l)}) = \sum_{(u,v) \in \mathcal{E}} \|h_u^{(l)} - h_v^{(l)}\|_2^2\]Lower Dirichlet energy indicates smoother (more similar) representations.
Solutions to Oversmoothing
1. Residual Connections
Adding skip connections helps preserve node identity:
\[h_v^{(l+1)} = h_v^{(l)} + \sigma\left(W^{(l)} \cdot \text{AGGREGATE}\left(\{h_u^{(l)} : u \in \mathcal{N}(v)\}\right)\right)\]This allows the model to learn identity mappings and prevents complete information loss.
2. Layer Normalization
Normalizing representations at each layer can help maintain diversity:
\[h_v^{(l+1)} = \text{LayerNorm}\left(\sigma\left(W^{(l)} \cdot \text{AGGREGATE}\left(\{h_u^{(l)} : u \in \mathcal{N}(v)\}\right)\right)\right)\]3. PairNorm
A specialized normalization technique for GNNs that explicitly maintains representation diversity:
\[\text{PairNorm}(H) = H \cdot \frac{\sqrt{|\mathcal{V}|}}{\sqrt{\sum_{v \in \mathcal{V}} \|h_v - \bar{h}\|_2^2}}\]| where $\bar{h} = \frac{1}{ | \mathcal{V} | } \sum_{v \in \mathcal{V}} h_v$ is the mean representation. |
4. Jumping Knowledge Networks
Aggregating representations from all layers instead of just the final layer:
\[h_v^{\text{final}} = \text{AGGREGATE}_{\text{layers}}\left(\{h_v^{(1)}, h_v^{(2)}, \ldots, h_v^{(L)}\}\right)\]This preserves information from early layers where nodes are still distinguishable.
5. DropEdge
Randomly removing edges during training to prevent over-smoothing:
\[\tilde{A} = A \odot M\]where $M$ is a random binary mask. This creates graph perturbations that force the model to be more robust.
6. Graph Attention Mechanisms
Using attention to selectively aggregate information:
\[h_v^{(l+1)} = \sigma\left(\sum_{u \in \mathcal{N}(v)} \alpha_{vu}^{(l)} W^{(l)} h_u^{(l)}\right)\]where attention weights $\alpha_{vu}$ can help preserve important local information.
Oversquashing
What is Oversquashing?
Oversquashing occurs when a node must compress information from an exponentially growing number of distant nodes into a fixed-size representation vector. As the receptive field expands with depth, nodes receive information from increasingly many neighbors, but the representation dimension remains constant, creating an information bottleneck.
Mathematical Formulation
Consider a node $v$ in a $d$-regular graph. After $L$ layers, its receptive field contains approximately $d^L$ nodes. The information from all these nodes must be compressed into a vector of fixed dimension $D$:
\[h_v^{(L)} = f\left(\{h_u^{(0)} : u \in \mathcal{R}_v^{(L)}\}\right) \in \mathbb{R}^D\]| where $\mathcal{R}_v^{(L)}$ is the $L$-hop neighborhood of $v$ with size $ | \mathcal{R}_v^{(L)} | \approx d^L$. |
The information compression ratio is:
\[\text{Compression} = \frac{|\mathcal{R}_v^{(L)}| \times D}{D} = |\mathcal{R}_v^{(L)}| \approx d^L\]This exponential growth creates a fundamental bottleneck.
Why Does Oversquashing Occur?
- Fixed Representation Size: Unlike transformers that can attend to all tokens, GNNs use fixed-size node representations
- Exponential Receptive Field Growth: Each layer expands the receptive field multiplicatively
- Information Bottleneck: All information must flow through a single vector
- Long-Range Dependencies: Distant nodes’ information gets compressed and may be lost
Measuring Oversquashing
Effective Receptive Field
The number of nodes that significantly influence a target node’s representation:
\[\text{ERF}(v, L) = \left|\left\{u : \frac{\partial h_v^{(L)}}{\partial h_u^{(0)}} > \epsilon\right\}\right|\]Information Entropy
Measuring how much information is preserved in the representation:
\[H(h_v^{(L)}) = -\sum_{i=1}^{D} p_i \log p_i\]where $p_i$ represents the normalized importance of dimension $i$.
Solutions to Oversquashing
1. Graph Rewiring
Modifying the graph structure to reduce path lengths:
- Adding Virtual Nodes: Introducing nodes that connect distant parts of the graph
- Graph Expansion: Adding edges to create shorter paths between nodes
- Learnable Rewiring: Dynamically adjusting graph structure during training
2. Multi-Hop Aggregation
Explicitly aggregating information from multiple hops in a single layer:
\[h_v^{(l+1)} = \text{AGGREGATE}\left(\bigcup_{k=1}^{K} \{h_u^{(l)} : u \in \mathcal{N}_k(v)\}\right)\]where $\mathcal{N}_k(v)$ denotes the $k$-hop neighbors.
3. Hierarchical Pooling
Gradually coarsening the graph to reduce information compression:
\[G^{(l+1)} = \text{POOL}(G^{(l)})\]This creates a multi-resolution representation that preserves information at different scales.
4. Attention Mechanisms
Using attention to selectively focus on important information:
\[h_v^{(l+1)} = \sum_{u \in \mathcal{R}_v^{(L)}} \alpha_{vu} \cdot h_u^{(l)}\]Attention weights allow the model to focus on the most relevant information, reducing the effective compression.
5. Graph Transformers
Using full attention over all nodes (or a subset) to avoid the bottleneck:
\[\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V\]This allows direct information flow between any pair of nodes.
6. Implicit Graph Neural Networks
Using differential equations to model information flow:
\[\frac{dh_v(t)}{dt} = f(h_v(t), \{h_u(t) : u \in \mathcal{N}(v)\})\]This continuous formulation can better handle long-range dependencies.
Comparing Oversmoothing and Oversquashing
While both problems affect deep GNNs, they are distinct phenomena:
| Aspect | Oversmoothing | Oversquashing |
|---|---|---|
| Symptom | Representations become similar | Information from distant nodes is lost |
| Cause | Repeated averaging/smoothing | Fixed-size bottleneck with exponential receptive field |
| Manifestation | Low Dirichlet energy | High information compression ratio |
| Affected Nodes | All nodes converge | Nodes with large receptive fields |
| Layer Dependency | Gets worse with depth | Gets worse with depth and graph diameter |
| Primary Solution | Normalization, residual connections | Graph rewiring, attention, hierarchical methods |
Relationship Between the Two
Interestingly, oversmoothing and oversquashing can interact:
- Oversquashing can lead to oversmoothing: When information is compressed, nodes may lose distinguishing features
- Solutions may conflict: Some methods that address oversmoothing (like aggressive normalization) may exacerbate oversquashing
- Balanced approaches needed: Effective solutions must address both problems simultaneously
Best Practices and Mitigation Strategies
Architectural Choices
- Shallow Networks: For many tasks, 2-4 layers are sufficient
- Residual Connections: Always use skip connections in deep networks
- Attention Mechanisms: Prefer attention-based aggregation for better information flow
- Hierarchical Design: Use pooling or coarsening for large graphs
Training Strategies
- Early Stopping: Monitor validation performance to stop before oversmoothing occurs
- Regularization: Use DropEdge or DropNode to prevent overfitting to smooth representations
- Multi-Task Learning: Training on diverse tasks can help maintain representation diversity
- Contrastive Learning: Explicitly encouraging different nodes to have different representations
Graph-Specific Considerations
- Graph Density: Dense graphs are more prone to oversmoothing
- Graph Diameter: Large-diameter graphs suffer more from oversquashing
- Node Degree Distribution: Highly skewed degree distributions can exacerbate both problems
- Graph Size: Very large graphs may require specialized architectures
Recent Advances
Graph Transformers
Recent work has shown that transformer architectures can mitigate both problems:
- Full attention allows direct information flow (reduces oversquashing)
- Positional encodings preserve node identity (reduces oversmoothing)
Implicit GNNs
Continuous-depth models using neural ODEs:
- Better handle long-range dependencies
- More flexible information flow
- Can adapt receptive field size dynamically
Adaptive Depth
Learning the optimal number of layers per node:
- Nodes with small receptive fields can use more layers
- Nodes with large receptive fields use fewer layers
- Reduces both oversmoothing and oversquashing
Conclusion
Oversmoothing and oversquashing represent fundamental limitations of traditional message-passing GNNs. Understanding these phenomena is crucial for:
- Designing better architectures: Knowing the problems helps design solutions
- Choosing appropriate depth: Understanding when to stop adding layers
- Selecting mitigation strategies: Picking the right techniques for specific graph properties
- Interpreting model behavior: Recognizing when these problems affect performance
As the field progresses, new architectures and training methods continue to address these challenges, enabling deeper and more effective GNNs for complex graph learning tasks.
Further Reading
- On the Bottleneck of Graph Neural Networks and its Practical Implications
- PairNorm: Tackling Oversmoothing in GNNs
- Oversquashing in GNNs through the lens of information theory and the graph structure
- Graph Neural Networks Exponentially Lose Expressive Power for Node Classification
This post is part of our Graph Representation Learning series. Understanding these fundamental challenges is essential for building effective GNN architectures.

