Bertmucb: An Efficient Approach for Sentiment Analysis

Bo HuangITM 2025

Abstract

Recent research has made huge progress in sentiment analysis; however, challenges remain in balancing model complexity with performance. Additionally, training models to better fit into conversational contexts remains a significant hurdle. This research proposes a novel algorithm for sentiment analysis called BertmUCB. It leverages Reinforcement Learning's (RL) capability to exploit historical feedback and language models' efficiency to gain better performance, while considering the feasibility of real-world deployment. The approach involves fine-tuning a RoBERTa model with a two-layer Multi-Layer Perceptron (MLP) classifier, followed by a prediction enhancement method optimized by a Proportion-Integration-Differentiation (PID) controller. Finally, a modified Upper Confidence Bound (mUCB) algorithm performs arm selection. In experiments, BertmUCB outperforms standard language models, especially on datasets where models struggle to distinguish fine-grained sentiments.

Introduction: The "Goldilocks" Problem in Sentiment Analysis

Sentiment analysis currently faces a significant trade-off between scale and efficiency. On one end, Large Language Models (LLMs) like the 6-billion-parameter EmoLLM are highly accurate but require massive computational resources, making them expensive for small-scale projects. On the other end, traditional Reinforcement Learning (RL) models are lightweight but typically require thousands of interactions to converge.

Furthermore, human language is inherently subjective and "noisy." A sentence might be interpreted differently by different people, and datasets often contain mislabeled samples. Most standard models struggle to maintain performance when the "ground truth" is ambiguous or when they have very few examples to learn from in a specific conversational context.

Methodology

The BertmUCB architecture bridges the gap between resource-heavy LLMs and data-hungry RL by integrating three distinct stages:

The BertmUCB architecture pipeline, showing the flow from RoBERTa backbone to mUCB selection.

1. The Backbone (RoBERTa + MLP)

The model uses a fine-tuned RoBERTa backbone to extract 768-dimensional semantic vectors from text. These vectors are processed by a two-layer Multi-Layer Perceptron (MLP) to produce initial sentiment probabilities for four categories: Happy, Angry, Hate, and Blue.

2. Prediction Enhancement via PID Control

To amplify high-confidence predictions and suppress weak ones, the output passes through a Sigmoid-like enhancement function. The parameters of this function ($\alpha$ and $\beta$) are dynamically adjusted using a Proportion-Integration-Differentiation (PID) controller. This controller—a staple of industrial automation—adjusts parameters every 8 tests based on the error between expected and actual accuracy growth, allowing the model to adapt to different dataset characteristics without retraining the entire transformer.

3. Modified Upper Confidence Bound (mUCB)

The final stage treats the sentiment classification as a "multi-armed bandit" problem. Since immediate human feedback is often unavailable in research settings, BertmUCB uses its own predicted probabilities as a "proxy" for reward. This allows the mUCB algorithm to refine its label selection over multiple rounds, enhancing stability in low-data regimes.

Experimental Setup and Results

The study utilized the simplyweibo_4_moods dataset, consisting of Chinese social media posts. To simulate real-world ambiguity, the author introduced 30% noise by randomly injecting sentences from incorrect mood categories into each subset.

Performance Comparison

Experiments compared BertmUCB against standard BERT and RoBERTa models on the noisy dataset:

  • Overall Accuracy: BertmUCB achieved an average accuracy of 57.6%, significantly outperforming both BERT and RoBERTa, which plateaued at 45.5%.
  • Fine-Grained Sentiment: Standard models failed almost entirely on the "Hate" label (scoring near 0%), whereas BertmUCB maintained 39.3% accuracy for that category.
  • Ablation Study: Removing the PID controller dropped accuracy to 50.7%, while removing the prediction enhancement entirely caused accuracy to crater to 22.9%, proving the enhancement layer is critical to performance.
UCB selection distribution for a 'happy' sentiment test case, illustrating the model's decision-making over 400 tests.

Key Insights

  • Cross-Disciplinary Optimization: Applying PID control to neural network post-processing makes the model adaptive without the overhead of full retraining.
  • Efficiency in Small Rounds: While traditional RL requires thousands of samples, BertmUCB is designed to make reliable predictions with fewer than 20 data samples, making it viable for real-time applications like chatbots.
  • Probabilities as Proxy Rewards: Using internal probabilities as feedback enables RL-style decision-making in supervised contexts where human feedback is delayed or unavailable.

Conclusion and Future Work

While BertmUCB demonstrates high efficiency and robustness against noise, several areas for improvement remain. The model currently relies on multiple coefficients that require manual or PID-based tuning; future research will focus on automating this optimization. Additionally, the author aims to explore non-intrusive ways to incorporate actual user feedback and further reduce the model size for deployment on edge devices with limited memory.

Summary updated

BibTeX
@inproceedings{huang2025bertmucb,
  author = {Bo Huang},
  title = {{Bertmucb: An Efficient Approach for Sentiment Analysis}},
  booktitle = {ITM},
  year = {2025},
  doi = {10.1051/itmconf/20257804023},
}
Figure