Skip to main content
QUICK REVIEW

[Paper Review] Compositional Coding Capsule Network with K-Means Routing for Text Classification

Hao Ren, H. Lü|arXiv (Cornell University)|Oct 22, 2018
Text and Document Classification TechnologiesComputer Science21 citations
TL;DR

This paper proposes a Compositional Weighted Coding (CWC) embedding and k-means routing for capsule networks in text classification, reducing model parameters by up to 36.29% while achieving competitive accuracy. The method uses weighted codeword combinations for embeddings and a cosine-similarity-based routing mechanism that improves stability over dynamic routing.

ABSTRACT

Text classification is a challenging problem which aims to identify the category of texts. In the process of training, word embeddings occupy a large part of parameters. Under the limitation of limited computing resources, it indirectly limits the ability of subsequent network designs. In order to reduce the number of parameters, the compositional coding mechanism has been proposed recently. Based on this, this paper further explores compositional coding and proposes a compositional weighted coding method. And we apply capsule network to model the relationship between word embeddings, a new routing algorithm, which is based on k-means clustering theory, is proposed to fully mine the relationship between word embeddings. Combined with our compositional weighted coding method and the routing algorithm, we design a neural network for text classification. Experiments conducted on eight challenging text classification datasets show that the proposed method achieves competitive accuracy compared to the state-of-the-art approach with significantly fewer parameters.

Motivation & Objective

  • Reduce the high parameter count in word embeddings without sacrificing classification performance.
  • Improve routing stability and robustness in capsule networks for text classification.
  • Design an end-to-end capsule network with BiGRUs that maintains high accuracy using fewer parameters.
  • Demonstrate that compositional coding with weighted codewords outperforms exclusive codeword selection in embedding efficiency and accuracy.

Proposed method

  • Proposes Compositional Weighted Coding (CWC) embedding, where each word’s embedding is formed by summing weighted codewords from multiple codebooks instead of using exclusive codewords.
  • Introduces a k-means routing algorithm that computes coupling coefficients using cosine similarity between capsules, replacing the dot-product-based dynamic routing.
  • Employs a capsule network with BiGRUs to model sequential dependencies and capture hierarchical relationships in text.
  • Uses multiple codebooks, each with K codeword vectors, to represent words via a weighted sum of codewords indexed by a code vector.
  • Applies cosine similarity in k-means routing to determine the strength of connections between lower-level and higher-level capsules.
  • Trains the entire model end-to-end with backpropagation, optimizing both embedding and routing components jointly.

Experimental results

Research questions

  • RQ1Can a compositional weighted coding method reduce the number of parameters in word embeddings while maintaining competitive classification accuracy?
  • RQ2Does k-means routing provide better stability and performance than dynamic routing in capsule networks for text classification?
  • RQ3How does the integration of capsule layers with BiGRUs affect the overall model performance and parameter efficiency?
  • RQ4To what extent does CWC embedding outperform the exclusive codeword approach (CC Embedding) in terms of accuracy and parameter efficiency?

Key findings

  • The proposed CWC embedding reduces model parameters by 24.68% to 36.29% across eight datasets compared to conventional embeddings, with minimal accuracy drop.
  • On the AG’s News dataset, CWC embedding uses only 2.45M parameters versus 4.45M in the baseline, a 45% reduction, while maintaining comparable accuracy.
  • The k-means routing method improves stability and robustness compared to dynamic routing, particularly in capturing nuanced relationships between word embeddings.
  • Replacing the fully connected layer with a capsule layer improves performance by up to 2.82% on the Yelp Review Full dataset when combined with CWC embedding.
  • The full model with CWC embedding and k-means routing achieves competitive accuracy—e.g., 96.56% on Yahoo! Answers—while using significantly fewer parameters.
  • Ablation studies confirm that both CWC embedding and capsule layers contribute independently and synergistically to performance gains, with CWC showing superior results over CC Embedding.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.