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.
SocialX · Center of Excellence SAKTI, Research Institute Intelligent Business & Sustainable Economy, Telkom University · Biomedical Engineering Study Program, School of Electrical Engineering, Telkom University +1