Abstract
Capsule Networks are designed to capture hierarchical "part-whole" relationships, which is particularly useful for modeling linguistic structures in Natural Language Processing (NLP). However, traditional routing algorithms focus almost exclusively on vertical connections between layers, neglecting the horizontal semantic relationships between capsules within the same layer. This paper introduces Graph Routing, a novel mechanism that treats capsules as nodes in a graph and employs Graph Convolutional Networks (GCNs) to model intra-layer interactions. By integrating Wasserstein Distance for relationship measurement and a top-down attention mechanism, the proposed approach significantly enhances text classification performance, surpassing both standard routing algorithms and Transformer-based models.
Introduction
In NLP, the "part-whole" hierarchy is evident in how words form phrases and phrases form sentences. Capsule Networks were pioneered to capture these relationships through "routing by agreement." Despite their success, standard architectures treat capsules in the same layer as independent entities, only allowing them to interact when passing information to the next layer.
The authors argue that this ignores vital horizontal context. For instance, in the phrase "The battery has a long life," there is a semantic modification relationship between "long" and "life" that exists at the same level of abstraction. Graph Routing addresses this by enabling capsules to "talk" to one another, enriching their representations with local semantic context before hierarchical aggregation.
Methodology
The core innovation is the integration of a Graph Convolutional Network (GCN) into the capsule routing process. The overall architecture, shown in Figure 1, demonstrates how input features are processed through convolutional layers before entering the Graph Routing module.
The Graph Routing Mechanism
The Graph Routing process treats every capsule in a layer as a node in a complete graph. The mechanism involves several key steps:
- Relationship Measurement: To define the edges of the graph, the model calculates the "distance" between capsule vectors. While Euclidean Distance and Cosine Similarity were tested, Wasserstein Distance (WD) proved most effective. WD treats capsule vectors as probability distributions of attributes, providing a more nuanced measure of semantic similarity.
- Normalization and Identity: Standard GCN normalization is adapted to handle distance values. The authors use a specialized softmax-based normalization, $\tilde{A} \rightarrow \text{softmax}(A) + I_N$, ensuring the adjacency matrix is stable while allowing each capsule to retain its own identity.
- Top-Down Attention: To prevent the aggregation of irrelevant information, a top-down attention filter is applied. This combines the bottom-up feature clustering of routing with a top-down selection process, enhancing model robustness.
Experimental Results
The model was evaluated across five text classification benchmarks: Amazon-Clothing, Amazon-Beauty, Emotion, Yelp, and AG News.
- Performance Gains: Graph Routing with WD and Attention consistently outperformed existing routing methods like Leaky Dynamic Routing and KDE Routing. On the Yelp dataset, accuracy improved by up to 1.01 percentage points.
- Comparison with Transformers: Notably, the model outperformed Transformer-based baselines. This suggests that when intra-layer relationships are properly modeled, the inductive bias of Capsule Networks remains highly effective for text understanding.
- Semantic Consistency: Analysis showed that lower-layer capsules became more consistent with the final classification category after Graph Routing, indicating that the model successfully learns meaningful semantic hierarchies.
Discussion and Conclusion
The success of Graph Routing highlights the importance of horizontal context in neural architectures. By allowing capsules to aggregate information from their neighbors, the model gains a richer understanding of semantic nuances. The use of Wasserstein Distance is a key technical insight, as it aligns well with the probabilistic nature of capsule representations.
However, the approach comes with trade-offs. The calculation of the adjacency matrix, particularly with WD, increases computational overhead and memory usage. Future work may focus on more efficient graph operations or multi-layer GCN structures to further refine these intra-layer relationships. In summary, Graph Routing provides a powerful extension to the Capsule Network paradigm, bridging the gap between hierarchical and relational modeling in NLP.
Summary updated