Text classification by BERT-Capsules

Authors

  • Minghui Guo

DOI:

https://doi.org/10.61173/wcg0nf17

Keywords:

capsule layer, representation module, probability module, reconstruction module

Abstract

This paper presents a model that integrates a BERT encoder with a Capsule network, eliminating the traditional fully connected layer designed for downstream classification tasks in BERT in favor of a capsule layer. This capsule layer consists of three main modules: the representation module, the probability module, and the reconstruction module. It transforms the final hidden layer output of BERT into the final activation capsule probabilities to classify the text. By applying the model to sentiment analysis and text classification tasks, and comparing the test results with various BERT variants, the performance across all metrics was found to be superior. Observing the model’s handling of multiple entities and complex relationships, sentences with high ambiguity were extracted to observe the probability distribution of all capsules and compared with RNN-Capsule. It was found that the activation capsule probabilities for BERT-Capsule were significantly higher than the rest, and more pronounced than RNN-Capsule, indicating the model’s exceptional ability to process ambiguous information.

References

[1] Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., Stoyanov, V. (2019) RoBERTa. arXiv:1907.11692v1 [cs.CL].

[2] Souza, F.D., Souza Filho, J.B.O. (2022) BERT for Sentiment Analysis: Pre-trained and Fine-Tuned Alternatives. arXiv:2201.03382v1 [cs.CL].

[3] Sun, C., Qiu, X., Xu, Y., Huang, X. (2020) How to fine-tune BERT for text classification. arXiv:1905.05583v3 [cs.CL].

[4] Thongtan, T., Phienthrakul, T. Sentiment classification using document embeddings trained with cosine similarity. Mahidol University, Thailand.

[5] Vaswani, A., Shazeer, N., Parmar, N. et al. (2023) Attention is all you need. arXiv:1706.03762v7 [cs.CL].

[6] Wang, Y., Sun, A., Han, J., Liu, Y., Zhu, X. (2018) Sentiment analysis by capsules. In WWW 2018: The 2018 Web Conference, April 23–27, 2018, Lyon, France. ACM, New York, NY, USA, 10 pages. https://doi.org/10.1145/3178876.3186015.

[7] Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R., Le, Q.V. (2020) XLNet: Generalized autoregressive pretraining for language understanding. arXiv:1906.08237v2 [cs.CL].

[8] Krause, B., Murray, I., Renals, S., Lu, L. (2017) M u l t i p l i c a t i v e L S T M f o r s e q u e n c e m o d e l l i n g . arXiv:1609.07959v3 [cs.NE]

Downloads

Published

2024-02-19