Enhancing Sentiment Analysis with Retrieval-Augmented Generation and Domain-Specific Fine-Tuning
摘要
In Natural Language Processing (NLP), sentiment analysis is crucial for interpreting public opinion from user generated text. While models such as BERT (Bidirectional Encoder Representations from Transformers) provide strong baselines, they often struggle with evolving language and domain specific contexts. This study explores Retrieval Augmented Generation (RAG), a framework that enhances transformer models with an external knowledge base and compares it with RoBERTa using a MiniLM encoder. Experiments are conducted on two datasets: Sentiment140, which contains informal Twitter text and Amazon Food Reviews, consisting of structured long form data. To address domain mismatch, we apply domain specific fine-tuning to the retriever in the RAG framework. Results are measured through accuracy, precision, recall, and F1 score and show that fine-tuning consistently improves performance. The goal of this study is to assess whether RAG offers measurable improvements over static models and to highlight the importance of domain adaptation.