Indonesian Hate Speech Detection Using IndoBERTweet and BiLSTM on Twitter

Juanietto Kusuma - Bina Nusantara University, Jakarta, 11480, Indonesia
Andry Chowanda - Bina Nusantara University, Jakarta, 11480, Indonesia

Citation Format:



Hate speech is an act of speech to spread hate to other people. In this digital era where everyone connects with social media, hate speech is growing rapidly and uncontrollably. Many people do not realize they are giving hate speech when critics something on social media due to a lack of awareness of the difference between hate speech and free speech. The results make victims feel alienated from society, and the people who spread it would often face the law. Detection in the sentences to identify whether it contains hate speech is essential to counter people's ignorance. For detecting such sentences, a machine learning algorithm is widely used to help identify each sentence. In this paper, we used a subset from machine learning named deep learning with the latest IndoBERT model named IndoBERTweet and combined it with RNN layer named BiLSTM. The appearance of IndoBERTweet opened more chances to further improve text classification performance with the addition of BiLSTM layer. The model first made a token representative from the sentence, then calculated it to analyze and made the classification based on the calculation. For this model to be effective, we trained our model with the labeled public dataset retrieved from Twitter. These datasets are classified into hate speech and non-hate speech, and these labels are applied to the models. We evaluated our model and achieved an accuracy of 93.7%, an improvement for classifying hate speech sentences from previous research.


Hate speech; IndoBERTweet; BiLSTM; Classification

Full Text:



S. Kemp, "Digital 2021: Global Overview Report," 27 January 2021. [Online]. Available: [Accessed 25 Maret 2021].

W. Warner and J. Hirschberg, "Detecting Hate Speech on the World Wide Web," Proceedings of the second workshop on language in social media, pp. 19-26, 2012.

J. W. Howard, "Free speech and hate speech," Annual Review of Political Science, pp. 93-109, 2019.

B. Mathew, R. Dutt, P. Goyal and A. Mukherjee, "Spread of Hate Speech in Online Social Media," Proceedings of the 10th ACM Conference on Web Science - WebSci '19, pp. 173-182, 2019.

H. I. Harahap, "Hate Speech in Election: Increasing Trends and Concerns," Advances in Social Science, Education and Humanities Research, pp. 44-46, 2019.

A. Purnomo, "Legal perspectives concerning hate speech in indonesia," PalArch's Journal of Archaeology of Egypt/Egyptology, pp. 544-554, 2020.

M. Mozafari, R. Farahbakhsh and N. Crespi, "A BERT-Based Transfer Learning Approach for Hate Speech Detection in Online Social Media," COMPLEX NETWORKS 2019, SCI 881, pp. 928-940, 2020.

G. B. Herwanto, A. M. Ningtyas, I. G. Mujiyatna, I. N. P. Trisna and K. E. Nugraha, "Hate Speech Detection in Indonesian Twitter using Contextual Embedding Approach," IJCCS (Indonesian Journal of Computing and Cybernetics Systems), pp. 177-188, 2021.

F. Koto, J. H. Lau and T. Baldwin, "INDOBERTWEET: A Pretrained Language Model for Indonesian Twitter with Effective Domain-Specific Vocabulary Initialization," In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP 2021), pp. 1-9, 2021.

I. Alfina, R. Mulia, M. I. Fanany and Y. Ekanata, "Hate Speech Detection in the Indonesian Language: A Dataset and Preliminary Study," Proceeding of 9th International Conference on Advanced Computer Science and Information Systems 2017(ICACSIS 2017), pp. 233-238, 2017.

M. O. Ibrohim and I. Budi, "Multi-label Hate Speech and Abusive Language Detection in Indonesian Twitter," Proceedings of the Third Workshop on Abusive Language Online, pp. 46-57, 2019.

F. D. Vigna, A. Cimino, F. Dell'Orletta, M. Petrocchi and M. Tesconi, "Hate me, hate me not: Hate speech detection on Facebook," Proceedings of the First Italian Conference on Cybersecurity (ITASEC17), pp. 86-95, 2017.

B. Gambäck and U. K. Sikdar, "Using Convolutional Neural Networks to Classify Hate-Speech," Proceedings of the First Workshop on Abusive Language Online, pp. 85-90, 2017.

Z. Al Makhadmeh and A. Tolba, "Automatic hate speech detection using killer natural language processing optimizing ensemble deep learning approach," Computing, pp. 501-522, 2019.

H. Faris, I. Aljarah, M. Habib and P. A. Castillo, "Hate Speech Detection using Word Embedding and Deep Learning in the Arabic Language Context," Proceedings of the 9th International Conference on Pattern Recognition Applications and Methods (ICPRAM 2020), pp. 453-460, 2020.

P. Kapil, A. Ekbal and D. Das, "Investigating Deep Learning Approaches for Hate Speech Detection in Social Media," unpublished, 2020.

T. B. Nguyen, Q. M. Nguyen, T. H. Nguyen, N. P. Pham, T. L. Nguyen and Q. T. Do, "VAIS Hate Speech Detection System: A Deep Learning based Approach for System Combination," unpublished, 2019.

S. S. Aluru, B. Mathew, P. Saha and A. Mukherjee, "Deep Learning Models for Multilingual Hate Speech Detection," unpublished, 2020.

T. L. Sutejo and D. P. Lestari, "Indonesia Hate Speech Detection using Deep Learning," International Conference on Asian Language Processing (IALP), pp. 39-43, 2018.

A. R. Isnain, A. Sihabuddin and Y. Suyanto, "Bidirectional Long Short Term Memory Method and Word2vec Extraction Approach for Hate Speech Detection," IJCCS (Indonesian Journal of Computing and Cybernetics Systems), pp. 169-178, 2020.

A. Marpaung, R. Rismala and H. Nurrahmi, "Hate Speech Detection in Indonesia Twitter Texts using Bidirectional Gated Recurrent Unit," International Conference on Knowledge and Smart Technology (KST), no. 13, pp. 186-190, 2021.

R. Aggarwal, "Bi-LSTM," 4 July 2019. [Online]. Available: [Accessed 12 August 2021].

V. Kotu and B. Deshpande, Data Science (Second Edition), Elsevier, 2019.