Klasifikasi Komentar Toksik Berbahasa Indonesia di Media Sosial Berbasis Fine-Tuning IndoBERT

Authors

  • Luqman Nur Hakim Universitas Muhammadiyah Kudus, Kudus
  • Fida Maisa Hana Universitas Muhammadiyah Kudus, Kudus
  • Widya Cholid Wahyudin Universitas Muhammadiyah Kudus, Kudus

DOI:

https://doi.org/10.30865/jurikom.v13i1.9449

Keywords:

IndoBERT, Text Classification, Hate Speech, Toxic Comments, Natural Language Processing

Abstract

Social media has become a primary platform for Indonesian society to interact and exchange information online. However, freedom of expression in digital spaces is often misused through the use of harsh, offensive, and hateful language. This study aims to develop a toxic comment classification model for the Indonesian language using the IndoBERT architecture through a fine-tuning process. IndoBERT was selected for its capability to understand bidirectional semantic context and its pretraining on a Bahasa Indonesia corpus, making it suitable for handling informal language styles, abbreviations, and common code-mixing phenomena in social media texts. The dataset used in this study is the Indonesian Abusive and Hate Speech Twitter Text, consisting of 12,942 entries 11,647 for training and 1,295 for validation. The research was conducted online using Google Colaboratory with GPU acceleration. The research stages included data preprocessing, tokenization, model training, and evaluation using precision, recall, F1-score, and confusion matrix as metrics. Evaluation results show that the fine-tuned IndoBERT model achieved high performance, with an average precision of 0.8842, recall of 0.884, F1-score of 0.883, and accuracy of 0.8834. These results indicate balanced performance across classes and strong model stability in detecting both toxic and non-toxic comments. This study contributes to the development of an automated Indonesian-language content moderation system, which can be deployed as a comment detection module via API. Although limited to Twitter data and binary classification, this model has the potential to be extended toward multi-class and cross-platform classification in supporting safer and healthier digital spaces in Indonesia.

Author Biography

Luqman Nur Hakim, Universitas Muhammadiyah Kudus, Kudus

Undergraduate student in Computer Science, Universitas Muhammadiyah Kudus.

References

[1] S. Kemp, “Digital 2024: Indonesia,” DataReportal. Accessed: Dec. 06, 2025. [Online]. Available: https://datareportal.com/reports/digital-2024-indonesia

[2] Kominfo, “Kominfo tangani 3,7 juta konten negatif hingga 17 September 2023,” Kontan.co.id. Accessed: Dec. 06, 2025. [Online]. Available: https://nasional.kontan.co.id/news/kominfo-tangani-37-juta-konten-negatif-hingga-17-september-2023

[3] H. Rahmi and A. Corsini, “Tinjauan Fenomena ‘Hate Speech’ dengan Muatan Politik di Indonesia dalam Perspektif ‘ Psychological Hatred’ Review of the phenomenon of ‘Hate Speech’ with political content in Indonesia in ‘Psychological Hatred’ perspective,” 2020.

[4] D. P. N. Lyrawati, “Deteksi Ujaran Kebencian pada Twitter Menjelang Pilpres 2019 dengan Machine Learning,” MATHunesa: Jurnal Ilmiah Matematika, vol. 7, no. 3, pp. 206–211, 2019.

[5] R. M. Yazid, F. R. Umbara, and P. N. Sabrina, “Deteksi Ujaran Kebencian dengan Metode Klasifikasi Naive Bayes dan Metode N-Gram pada Dataset Multi-Label Twitter Berbahasa Indonesia,” Informatics and Digital Expert (INDEX), vol. 4, no. 2, pp. 46–52, Nov. 2022, [Online]. Available: http://index.unper.ac.id

[6] I. Budi, Analisis Media Sosial Sebagai Upaya Dini Deteksi Potensi Konflik Masyarakat di Dunia Maya. Depok: Fakultas Ilmu Komputer, Universitas Indonesia, 2023.

[7] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding,” in Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL-HLT), Association for Computational Linguistics (ACL), May 2019, pp. 4171–4186. doi: 10.18653/v1/N19-1423.

[8] B. Wilie et al., “IndoNLU: Benchmark and Resources for Evaluating Indonesian Natural Language Understanding,” in Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), Association for Computational Linguistics, 2020, pp. 843–857. Accessed: Dec. 06, 2025. [Online]. Available: https://aclanthology.org/2020.aacl-main.85/

[9] G. Z. Nabiilah, S. Y. Prasetyo, Z. N. Izdihar, and A. S. Girsang, “BERT base model for toxic comment analysis on Indonesian social media,” Procedia Comput. Sci., vol. 216, pp. 714–721, Jan. 2023, doi: 10.1016/J.PROCS.2022.12.188.

[10] E. W. Pamungkas, D. G. P. Putri, and A. Fatmawati, “Hate Speech Detection in Bahasa Indonesia: Challenges and Opportunities,” Int. J. Adv. Comput. Sci. Appl., vol. 14, no. 6, pp. 1175–1181, May 2023, Accessed: Dec. 06, 2025. [Online]. Available: https://doi.org/10.14569/IJACSA.2023.01406125

[11] P. Sayarizki, Hasmawati, and H. Nurrahmi, “Implementation of IndoBERT for Sentiment Analysis of Indonesian Presidential Candidates,” Indonesian Journal on Computing (Indo-JC), vol. 9, no. 2, pp. 61–72, Aug. 2024, doi: 10.34818/INDOJC.2024.9.2.934.

[12] M. O. Ibrohim and I. Budi, “Hate speech and abusive language detection in Indonesian social media: Progress and challenges,” Heliyon, vol. 9, no. 8, p. e18647, Aug. 2023, doi: 10.1016/J.HELIYON.2023.E18647.

[13] I. F. Putra, “Indonesian Abusive and Hate Speech Twitter Text,” Kaggle. Accessed: Dec. 06, 2025. [Online]. Available: https://www.kaggle.com/datasets/ilhamfp31/indonesian-abusive-and-hate-speech-twitter-text

[14] K. Kamdan, M. P. Anugrah, M. J. Almutaali, R. Ramdani, and I. L. Kharisma, “Performance Analysis of IndoBERT for Detection of Online Gambling Promotion in YouTube Comments,” in 7th International Global Conference Series on ICT Integration in Technical Education & Smart Society, Aizuwakamatsu, Japan: MDPI AG, Sep. 2025, p. 66. doi: 10.3390/engproc2025107066.

[15] T. Wolf et al., “HuggingFace’s Transformers: State-of-the-art Natural Language Processing,” Journal of Machine Learning Research, Jul. 2020, [Online]. Available: http://arxiv.org/abs/1910.03771

[16] Google, “Google Colaboratory,” Google. Accessed: Dec. 06, 2025. [Online]. Available: https://colab.research.google.com/

[17] O. Rainio, J. Teuho, and R. Klén, “Evaluation metrics and statistical tests for machine learning,” Sci. Rep., vol. 14, no. 1, Dec. 2024, doi: 10.1038/s41598-024-56706-x.

[18] I. P. G. H. Suputra, Linawati, G. Sukadarmika, N. P. Sastra, N. M. A. Wilani, and I. M. A. Setiawan, “Improved Cognitive Distortion Detection using IndoBERT and Important Words Approach for Bahasa Indonesia,” International Journal on Informatics Visualization, vol. 9, no. 6, pp. 2272–2278, 2025, doi: 10.62527/joiv.9.6.3576.

[19] F. Koto, A. Rahimi, J. H. Lau, and T. Baldwin, “IndoLEM and IndoBERT: A Benchmark Dataset and Pre-trained Language Model for Indonesian NLP,” in Proceedings of the 28th International Conference on Computational Linguistics (COLING 2020), International Committee on Computational Linguistics, 2020, pp. 757–770. Accessed: Dec. 06, 2025. [Online]. Available: https://aclanthology.org/2020.coling-main.66

[20] A. F. Hidayatullah, R. A. Apong, D. T. C. Lai, and A. Qazi, “Pre-trained language model for code-mixed text in Indonesian, Javanese, and English using transformer,” Soc. Netw. Anal. Min., vol. 15, no. 1, Dec. 2025, doi: 10.1007/s13278-025-01444-9.

[21] P. A. Mufva, K. H. Chandra, K. F. Aji, I. A. Iswanto, and S. Joddy, “Performance comparison of deep learning approaches for Indonesian twitter hate speech detection using IndoBERTweet embedding,” Procedia Comput. Sci., vol. 269, pp. 1663–1671, Jan. 2025, doi: 10.1016/J.PROCS.2025.09.109.

[22] A. Vaswani et al., “Attention Is All You Need,” in Advances in Neural Information Processing Systems (NeurIPS 2017), Curran Associates, Inc., 2017, pp. 5998–6008. doi: 10.5555/3295222.3295349.

[23] Y. Findawati, D. Purwitasari, and A. B. Raharjo, “Dangerous Speech Classification on Twitter Using Multilabel Aspects and Structural Features,” IEEE Access, vol. 13, pp. 189506–189527, 2025, doi: 10.1109/ACCESS.2025.3627932.

[24] I. Amal and E. W. Pamungkas, “Enhancing Hate Speech Detection in Indonesia Code-Mixed Tweets: the Role of Oversampling and Undersampling Techniques,” in 2025 International Conference on Smart Computing, IoT and Machine Learning (SIML), 2025, pp. 1–6. doi: 10.1109/SIML65326.2025.11081166.

[25] A. Fitro, A. Praba Ristadi Pinem, O. Saeful Bachri, and Chartini, “Cyberbullying Detection on Instagram using IndoBERTa Model,” International Conference on Digital Business Innovation and Technology Management (ICONBIT), vol. 1, no. 2, Aug. 2025, [Online]. Available: https://proceeding.unesa.ac.id/index.php/iconbit/article/view/5798

[26] R. A. Saputra and Y. Sibaroni, “Multilabel Hate Speech Classification in Indonesian Political Discourse on X using Combined Deep Learning Models with Considering Sentence Length,” Jurnal Ilmu Komputer dan Informasi, vol. 18, no. 1, pp. 113–125, Feb. 2025, doi: 10.21609/jiki.v18i1.1440.

[27] V. K. Santoso, N. C. Purba, C. A. Herli, and Y. Muliono, “Privacy Classification of Indonesian Chat Logs Using Indobert Model Variants,” in 2025 International Seminar on Intelligent Technology and Its Applications (ISITIA), 2025, pp. 136–141. doi: 10.1109/ISITIA66279.2025.11137460.

Additional Files

Published

2026-02-28

How to Cite

Luqman Nur Hakim, Fida Maisa Hana, & Widya Cholid Wahyudin. (2026). Klasifikasi Komentar Toksik Berbahasa Indonesia di Media Sosial Berbasis Fine-Tuning IndoBERT. JURNAL RISET KOMPUTER (JURIKOM), 13(1), 202–209. https://doi.org/10.30865/jurikom.v13i1.9449