Instruction Tuning with Retrieval-based Examples Ranking for Aspect-based Sentiment Analysis (2024)

Abstract: Aspect-based sentiment analysis (ABSA) identifies sentiment information related to specific aspects and provides deeper market insights to businesses and organizations. With the emergence of large language models (LMs), recent studies have proposed using fixed examples for instruction tuning to reformulate ABSA as a generation task. However, the performance is sensitive to the selection of in-context examples; several retrieval methods are based on surface similarity and are independent of the LM generative objective. This study proposes an instruction learning method with retrieval-based example ranking for ABSA tasks. For each target sample, an LM was applied as a scorer to estimate the likelihood of the output given the input and a candidate example as the prompt, and training examples were labeled as positive or negative by ranking the scores. An alternating training schema is proposed to train both the retriever and LM. Instructional prompts can be constructed using high-quality examples. The LM is used for both scoring and inference, improving the generation efficiency without incurring additional computational costs or training difficulties. Extensive experiments on three ABSA subtasks verified the effectiveness of the proposed method, demonstrating its superiority over various strong baseline models. Code and data are released at https://github.com/zgMin/IT-RER-ABSA.

## introduction aspect-based sentiment analysis (absa) @xcite is a fine-grained text sentiment analysis technique that identifies sentiment information related to specific aspects, and provides deeper market insights for businesses and organizations. absa consists of three subtasks: aspect term extraction (ate), aspect term sentiment classification (atsc), and aspect sentiment pair extraction (aspe). ate identifies the aspects mentioned in the text, and atsc determines the sentiment polarity associated with each aspect. furthermore, aspe jointly performs ate and aspe to extract sentiment tuples, including aspect terms and their associated sentiments. for absa tasks, most previous methods have used transformer-based language models (lms) in either a pipeline or end-to-end framework @xcite @xcite @xcite . by adding task-specific layers to the top of the model, these models are typically initialized from the pretrained checkpoint and then finetuned on the downstream samples. recently, generative models @xcite @xcite have emerged to reformulate absa tasks as generation tasks to produce a sequence with a special pattern, for example, restaurant#positive and food#negative. based on the instruction-tuning paradigm @xcite , several studies @xcite have further improved the generative approach using several predefined instruction prompts @xcite . instruction tuning allows generative models to tune themselves on a few input-output examples. the quality of the output generated by the instruction-tuning model is highly dependent on the quality of in-context examples. well-crafted instructions can help the model generate more accurate and relevant outputs @xcite , whereas poorly crafted instructions can lead to incoherent or irrelevant results. nevertheless, previous studies typically adopted a fixed strategy to use two or more unchanged examples to generate the instruction template. if the examples are unrepresentative of the target task, the model may be unable to learn effectively. for a target sample, for example, the falafel was slightly overcooked and dry, but the chicken was satisfactory, the example the price was too high, but the cab was amazing can be appropriate. they share a similar syntactic structure, which can contribute to imitation and generation. however, such an example is unsuitable for another sample, for example, the staff displays arrogance, and the prices are considerably high for brooklyn standards. because the opinion of high in the example may finally impact the judgment of the aspect price of the target. furthermore, the sample we enjoyed our visit and utilized buses and cabs for transportation seems to have little relevance to the example above. however, the aspect cab may be incorrectly considered an aspect term based on the prompt of the word cab in the example. empirical studies have demonstrated the use of an additional language model as a scorer to produce off-the-shelf sentence embeddings, for example, bm25 @xcite , epr @xcite and llm-r @xcite , for similarity calculations to retrieve examples from the training set. several works explored training a prompt retriever to select examples by measuring surface similarity @xcite @xcite . these methods have two limitations: (i) the similarity calculation typically measures the distance in the latent space, which is independent of the generation target in instruction learning, and (ii) additional encoders are necessary to obtain the representation used for similarity calculations, which also incurs additional computational costs and training difficulties. this study proposes an instruction-tuning method with retrieval-based example ranking for absa tasks, comprising a retriever and inference lm. the lm is a t5 model @xcite with an encoder-decoder structure and several instruction-tuned versions @xcite . the retriever returns the most appropriate examples to form the instruction template. meanwhile, the lm scores the examples for the retriever and generates the final results. to achieve the training of lm and retriever simultaneously, an alternating training schema is proposed. for each target sample, the candidates can be divided into positive and negative examples according to the log-likelihood provided by the lm. then, contrastive learning is applied to force the sample to be near positive examples but distant from negative examples. after composing highquality instructions, the lm can be finetuned using a generative objective. unlike the previously proposed similarity calculation, the retriever evaluates the importance of candidate examples based on the log-likelihood of the lm. this retrieval goal is consistent with the generative objective of the lm. in addition, the lm is used for both scoring and inference, improving the generation performance with tolerable additional computational costs or training difficulties. extensive experiments were conducted on ate, atsc, and aspe tasks to verify the effectiveness of the proposed method. the results show that the proposed model substantially improves the performance compared with several strong baselines. the remainder of this paper is organized as follows. section 2 briefly reviews the related studies. section 3 describes the proposed retrieval-based example mining method for instruction learning in absa. section 4 summarizes the experiment settings and empirical results. finally, section 5 concludes the paper. ## retrieval-based instruction tuning figure 1 shows the overall framework of the proposed instruction-tuning method with retrievalbased example ranking for absa. the training process comprises two phases: example retrieval and task inference. for example retrieval, a retriever is used to select several candidates for a given sample. the inference lm was then used to measure the likelihood of ranking the target and candidates as scores. to train the retriever, we selected the top-k candidates as positive samples and the others as negative samples. subsequently, contrastive learning is performed to propagate the gradients and update the retriever. for task inference, the retriever returns the most suitable examples and forms input instructions according to a predefined template. the negative log-likelihood of the generative results will train the lm. ## alternating training schema the training of a retriever depends on the scoring of the lm. however, the lm training requires the retriever to form an instruction template. the instruction tuning performance depends on the collaborative effort between the two models. thus, we adopted an alternating training schema for the retriever and language models, as shown in figure 4 . in particular, the finetuned lm in the t-1 step is used as a scoring model to train the retriever in the t step. the lm in the t step is finetuned by the instruction generated by the updated retriever. ## conclusion in this study, we proposed a retrieval-based example mining method for instructional learning in absa tasks to improve the performance by selecting effective examples. the proposed method conducts the alternating training of a retriever and lm by employing a two-stage training framework and iterative evolution training scheme. experiments validated its effectiveness across ate, atsc, and aspe tasks, outperforming existing baseline models. future work will extend the proposed method to other tasks and models and refine the training strategies to achieve further performance gains.