Organizations: SocialX · Center of Excellence SAKTI, Research Institute Intelligent Business & Sustainable Economy, Telkom University · Biomedical Engineering Study Program, School of Electrical Engineering, Telkom University · Research Center for Smart Mechatronics, National Research and Innovation Agency (BRIN)
Existing Indonesian sentiment analysis models classify text in isolation, ignoring the topical context that often determines whether a statement is positive, negative, or neutral. We introduce IndoBERT-Sentiment, a context-conditioned sentiment classifier that takes both a topical context and a text as input, producing sentiment predictions grounded in the topic being discussed. Built on IndoBERT Large (335M parameters) and trained on 31,360 context-text pairs labeled across 188 topics, the model achieves an F1 macro of 0.856 and accuracy of 88.1%. In a head-to-head evaluation against three widely used general-purpose Indonesian sentiment models on the same test set, IndoBERT-Sentiment outperforms the best baseline by 35.6 F1 points. We show that context-conditioning, previously demonstrated for relevancy classification, transfers effectively to sentiment analysis and enables the model to correctly classify texts that are systematically misclassified by context-free approaches.
Figures & tables
Sentiment
Count
Percentage
Negatif
10,357
33.0%
Netral
17,315
55.2%
Positif
3,688
11.8%
Total
31,360
100%
Table 1: Dataset statistics after re-labeling for sentiment.
Model
Type
Accuracy
F1 Macro
F1 Wtd.
Params
IndoBERT-Sentiment (ours)
context
88.1%
0.856
0.880
335M
IndoBERT-Sentiment-SmSA
general
62.8%
0.487
0.612
110M
BERT-Indonesian-SmSA
general
62.1%
0.486
0.607
124M
RoBERTa-Indonesian-Sentiment
general
59.1%
0.501
0.593
124M
Table 2: Performance comparison on the same test set (4,704 samples). All baseline models are general-purpose (no context). Best results in bold.
Figure 1: Overall performance comparison. Our context-conditioned model (blue) substantially outperforms all three general-purpose baselines.
Class
Ours
IndoBERT-SmSA
BERT-Indo
RoBERTa-Indo
Negatif
0.876
0.608
0.606
0.654
Netral
0.902
0.716
0.706
0.637
Positif
0.791
0.135
0.145
0.211
Table 3: Per-class F1 scores. The improvement is most dramatic for the Positif class.
Figure 2: Per-class F1 scores. Baseline models nearly fail on Positif (F1 ≤ 0.211), while our model achieves 0.791.
Context
Text
Truth
Ours
Baselines
Pertumbuhan ekonomi
ekonomi Indonesia tumbuh 5.2%, tertinggi di ASEAN
Pos
Pos
Net
Inflasi dan daya beli
indomie sekarang 3500, dulu cuma 1500
Neg
Neg
Net
Korupsi dan penegakan hukum
KPK tangkap bupati yang korupsi dana bansos, akhirnya
Pos
Pos
Net
Kebakaran hutan
Luas Kebakaran Hutan Turun 80%, Upaya Pencegahan Berhasil
Pos
Pos
Net
Polusi udara
Jakarta peringkat 1 kota paling berpolusi di dunia
Neg
Neg
Pos
Kasus DBD
Kemenkes catat kasus DBD naik 200%
Neg
Neg
Net
Table 4: Examples where context-conditioning produces correct predictions that all baseline models miss. In each case, the context provides the interpretive frame that determines sentiment.
Variant
Classes
Accuracy
F1 Macro
IndoBERT-Sentiment (3-class)
Neg / Net / Pos
88.1%
0.856
IndoBERT-Sentiment (binary)
Neg / Pos
96.06%
0.949
Table 5: Performance comparison between three-class and binary variants.
Determining whether a piece of text is relevant to a given topic is a fundamental task in natural language processing, yet it remains largely unexplored for Bahasa Indonesia. Unlike sentiment analysis or named entity recognition, relevancy classification requires the model to reason about the relationship between two inputs simultaneously: a topical context and a candidate text. We introduce IndoBERT-Relevancy, a context-conditioned relevancy classifier built on IndoBERT Large (335M parameters) and trained on a novel dataset of 31,360 labeled pairs spanning 188 topics. Through an iterative, failure-driven data construction process, we demonstrate that no single data source is sufficient for robust relevancy classification, and that targeted synthetic data can effectively address specific model weaknesses. Our final model achieves an F1 score of 0.948 and an accuracy of 96.5%, handling both formal and informal Indonesian text. The model is publicly available at HuggingFace.
Muhammad Apriandito Arya Saputra, Andry Alamsyah, Dian Puteri Ramadhani +2
SocialX · Center of Excellence SAKTI, Research Institute Intelligent Business & Sustainable Economy, Telkom University · Biomedical Engineering Study Program, School of Electrical Engineering, Telkom University +1
This paper benchmarks a classical machine learning approach based on PyCaret AutoML against a deep learning approach based on IndoBERT fine-tuning for binary sentiment analysis of Indonesian-language Twitter comments related to Ibu Kota Nusantara (IKN). The dataset contains 1,472 manually labeled samples, consisting of 780 negative and 692 positive comments. In the machine learning setting, Logistic Regression, Naive Bayes, and Support Vector Machine were evaluated using 10-fold cross-validation, with Logistic Regression achieving the best performance among the classical models at 77.57% accuracy and 77.17% F1-score. In the deep learning setting, the indobenchmark/indobert-base-p1 model was fine-tuned for five epochs and achieved 89.59% test accuracy and 89.37% F1-score. The results show that IndoBERT substantially outperforms the machine learning baselines, highlighting the effectiveness of Transformer-based contextual representations for informal Indonesian social media text.
The exponential growth of e-commerce platforms in Indonesia has generated a massive volume of user-generated product reviews. Analyzing the sentiment of these reviews is critical for measuring customer satisfaction and identifying product issues at scale. This paper benchmarks traditional Machine Learning (ML) approaches against a Transformer-based Deep Learning model for a three-class sentiment analysis task (positive, neutral, negative) on the Tokopedia Product Reviews 2025 dataset. We implemented Term Frequency-Inverse Document Frequency (TF-IDF) feature extraction coupled with three algorithms: Logistic Regression, Linear Support Vector Machine (SVM), and Multinomial Naive Bayes as robust baselines. Subsequently, we fine-tuned the IndoBERT model (indobenchmark/indobert-base-p1) for contextual sequence classification. To computationally address the severe class imbalance inherent in e-commerce feedback, we applied balanced class weights for the baseline models and engineered a custom weighted cross-entropy loss function within the IndoBERT training loop, following the broader motivation of imbalanced-learning research. Our comprehensive evaluation using Accuracy, Macro F1-score, and Weighted F1-score revealed that the traditional Linear SVC model significantly outperformed the IndoBERT model in our experimental setup, achieving an Accuracy of 97.60% and a Macro F1-score of 0.5510, compared to IndoBERT's 88.70% and 0.5088. Detailed analysis indicates that this performance gap was primarily driven by discrepancies in the data sampling regimes, where baselines utilized the full corpus while the Transformer was constrained to a sampled subset. Finally, we demonstrate the practical viability of our pipeline by deploying the final sentiment classification model as an interactive Gradio web application.
Nabila Zakiyah Zahra, Salwa Farhanatussaidah, Nasywa Nur Afifah +3
Department of Data Science Institut Teknologi Sumatera (ITERA) · Department of Informatics Institut Teknologi Sumatera (ITERA)