- The paper introduces a context-conditioned model using IndoBERT Large to integrate both topical context and text for sentiment classification.
- Experiments show the model achieves 88.1% accuracy and a macro F1 of 0.856, marking a significant improvement over context-free baselines.
- The approach, also effective in binary sentiment detection, has strong implications for applications like news monitoring, crisis tracking, and social media analysis.
Context-Conditioned Sentiment Classification in Indonesian: IndoBERT-Sentiment
Motivation and Problem Definition
Sentiment analysis for Indonesian largely persists in a context-independent formulation, using text classification models trained on product reviews and similar datasets. This approach fails to account for the contextual dependency of sentiment. The semantic valence of a statement is often conditional on the topic under consideration; factual statements may carry positive, negative, or neutral sentiment depending on the topical context. IndoBERT-Sentiment addresses this gap by implementing context-conditioned sentiment classification, where predictions are grounded in both the topical context and the text.
Model Architecture and Dataset
IndoBERT-Sentiment leverages IndoBERT Large (335M parameters) with the input structure [CLS] context [SEP] text [SEP], allowing the [CLS] token embedding to encode both the context and the text for downstream sentiment classification. The training corpus comprises 31,360 context--text pairs spanning 188 topics and 12 thematic domains, derived from formal news, informal social media, and LLM-generated references. Re-labeling for sentiment deployed GPT-4o-mini with a structured, context-dependent protocol. The distribution is imbalanced, with a preponderance of neutral texts and under-representation of positives, mirroring real-world Indonesian media.
Training utilized inverse-frequency class weighting and early stopping on macro F1, with stratified validation. The model was trained for 5 epochs on a single RTX 3090 GPU.
Comparative Evaluation and Results
IndoBERT-Sentiment was evaluated head-to-head against three widely used Indonesian sentiment models, all context-free and fine-tuned on IndoNLU’s SmSA dataset: BERT-Indonesian-SmSA, RoBERTa-Indonesian-Sentiment, and IndoBERT-Sentiment-SmSA. All baselines operate under a single text input paradigm.
The context-conditioned approach produces a marked improvement in all metrics:
- IndoBERT-Sentiment achieves 88.1% accuracy and 0.856 macro F1, outperforming baselines (accuracy: 59.1–62.8%, macro F1: 0.486–0.501) by wide margins.
- The largest performance leap is observed for positive sentiment: the IndoBERT-Sentiment model attains F1 of 0.791, compared to baseline scores of 0.135–0.211 (relative improvement of over 275%).
Context-conditioning enables correct predictions in cases systematically misclassified by context-free models, especially for factual statements with sentiment determined by topic. Qualitative examples reinforce this, demonstrating that context-free models default to neutral classifications for statements where topical framing (growth, crime, environment, health) is essential to sentiment.
Theoretical and Practical Implications
Transferability: The IndoBERT-Sentiment model applies the same architecture and dataset previously used for context-conditioned relevancy classification, merely changing the labeling schema. The effective transfer suggests context-conditioning is a generic paradigm for classification tasks involving context-dependent semantics.
Error Analysis: Baseline models’ failures on positive sentiment are linked to a domain mismatch: product review datasets encode positive sentiment through explicit positive vocabulary, whereas public discourse employs domain-specific achievement terminology whose valence is only realized with topical context.
Binary Variant: To target polarity detection use cases, a binary variant (Negatif/Positif) was trained, achieving 96.06% accuracy and macro F1 of 0.949. This model is suited to applications requiring clear-cut polarity without neutral ambiguity, such as crisis monitoring or reputation tracking.
Applicability: The context-conditioned approach is directly relevant for social media analysis, news monitoring, and any task where sentiment toward a particular topic must be disambiguated from sentiment expressed in isolation. Model deployment does require context as an input, but topic tracking systems naturally provide such context.
Generality: The architecture and methodology are extensible to other context-sensitive classification tasks (stance detection, emotion classification, toxicity detection), indicating potential applicability beyond sentiment.
Limitations
The principal limitation lies in the ground truth protocol, which inherently favors context-dependent sentiment interpretation. Baseline models are disadvantaged under such a scheme; however, it aligns with real-world practice where sentiment assessments are topic-conditioned. The dataset’s imbalance constrains absolute performance on minority classes, though class weighting mitigates this.
Inference requires a topical input, but this is typically straightforward in monitoring applications. The system’s efficacy outside the domain of Indonesian public discourse (e.g., informal conversations or product reviews) demands further empirical assessment.
Conclusion
IndoBERT-Sentiment demonstrates that context-conditioned classification robustly transfers to sentiment analysis in Indonesian text, yielding substantial accuracy and F1 improvements over standard models. The empirical results underscore the importance of topical context in sentiment prediction, especially for positive class detection. Both three-class and binary variants support practical deployment scenarios in social media and news analytics. The methodology is generic and suggests further application to other context-sensitive tasks in NLP, marking a paradigm shift toward context-conditioning as a standard for interpretive classification in multilingual environments.