Enhancing Aspect-Based Sentiment Analysis with Dynamic Few-Shot Prompting for Large Language Models

Read full text
Authors: Mohammed Ziaulla, Arun Biradar
Cited by: 0
References: 20

Abstract

While Large Language Models (LLMs) have shown great promise, their effectiveness in few-shot learning settings is often limited by static prompting strategies, where a fixed set of examples may lack contextual relevance for diverse test cases. To address this limitation, this paper introduces a dynamic few-shot prompting methodology for Aspect-based Sentiment Analysis (ABSA) that leverages the Gemini Large Language Model (Gemini LLM). Our approach dynamically selects the most semantically pertinent examples from a training corpus for each individual test instance by computing cosine similarity between sentence embeddings. This ensures the LLM receives tailored, contextually rich guidance for every prediction. We evaluated our methodology on the benchmark SemEval-2014 datasets for the laptop and restaurant domains. The results demonstrate state-of-the-art performance, achieving F1-scores of 87.3% and 90.0%, respectively, significantly surpassing static few-shot prompting and other established baselines. The findings underscore the critical role of example pertinence in few-shot learning and illustrate that dynamic, context-aware prompting is a highly effective strategy for unlocking the full potential of LLMs on specialized Natural Language Processing (NLP) tasks without extensive model fine-tuning.

Fields of Study & Subjects

Sentiment Analysis and Opinion Mining Topic Modeling Domain Adaptation and Few-Shot Learning

Publication details

Journal / source
Engineering Technology & Applied Science Research
Volume
16
Issue
1
Pages
31600–31608
Publication date
9 February 2026
Language
EN