A Generative Language Model for Few-shot Aspect-Based Sentiment Analysis
Paper · 2022 · Ehsan Hosseini-Asl, Wenhao Liu and Caiming Xiong
Summary
A restaurant review can praise the food and complain about the service in the same sentence. A single sentiment label loses the connection between each opinion and its target. Aspect-based sentiment analysis preserves that connection. It identifies the words that name a target, such as a dish, or assigns the opinion to a pre-defined category, such as food. It then determines the sentiment attached to each. Hosseini-Asl and colleagues ask whether a single way of training a generative language model can handle these different outputs when labeled reviews are scarce.
The authors turn the annotations into a continuation of the review. During fine-tuning, GPT2 reads training sequences that contain the review, markers identifying the different parts of the sequence, and the labeled answers. It learns by predicting each next token, using its existing vocabulary output for both the review and the answers. At evaluation time, it receives only the part of the sequence it needs to start the task. If an aspect is supplied, it continues with a polarity label. If given the review alone, it can generate aspects and their labels, including both the specific terms in the review and the broader categories. The paper studies few-shot learning by updating the system on small samples of labeled training data.
The clearest gains are in polarity prediction when the target is already known. For restaurant aspect terms on SemEval14, using 1% of the training data, described as 20 examples, the authors report an advantage of 9 points in mean accuracy over BERT-PT and a reduction of 6.2 points in standard deviation. GPT2-medium frequently matches or exceeds that review-post-trained baseline with small samples, although the baseline retains an advantage in some settings. Generating terms and categories together also helps some restaurant extraction results. On full-shot SemEval14 restaurant term extraction, GPT2-medium scores 81.52 F1 when generating terms with their polarities and 82.04 when also generating categories with their polarities. On laptop term extraction, the joint GPT2 systems trail the BERT-based baselines.
A comparison within GPT2 helps explain the few-shot result. Attaching a classifier and training only for the sentiment decision produces weaker results than keeping next-token training. The training curves suggest that predicting the text throughout the sequence supplies useful supervision beyond the label. That explanation remains an interpretation of the curves, since the two arrangements also differ in how they represent and predict the answer. Additional experiments on movie-review sentiment and intent detection extend the comparison to tasks where a system generates a label for the whole input.
Deep dive: A Generative Language Model for Few-shot Aspect-Based Sentiment Analysis
Hosseini-Asl and colleagues use GPT2 to generate aspects and sentiment from reviews, and test how well it learns from very few labeled examples. · about 35 minutes to read
The problem and its context
What a sentiment label leaves out
A review expresses an opinion about something. At document level, that something can be the product or business under review. At sentence level, it can be the subject of a particular statement. At aspect level, a system has to make a finer distinction. A customer can approve of one part of a meal, object to another, and mention a third without expressing a clear opinion about it. The annotations have to preserve those distinctions for an evaluation to tell whether the system understood which judgment applied where.
The paper places this problem in the tradition of opinion mining and sentiment classification. It cites work on identifying the overall orientation of reviews, including Thumbs Up? and Thumbs Up or Thumbs Down?. The move to aspect-level analysis changes the prediction from an assessment of a passage as a whole into a set of decisions about targets within it. The benchmarks the authors use come from SemEval-2014 Task 4 and SemEval-2016 Task 5, which the paper calls SemEval14 and SemEval16.
The benchmarks distinguish an aspect term from an aspect category. A term is a span of words in the sentence. It can name a specific dish or a member of the restaurant staff. A category comes from a pre-defined inventory. Different dishes can fall under food, and different staff roles under service. A system that produces the right category may still overlook individual terms. A system that copies the right terms can still misidentify the category or miss an opinion expressed at a broader level. Evaluating these outputs separately makes it possible to see where an error occurred.
The same distinction applies to polarity. One task asks how the review treats a designated term. Another asks how it treats a designated category. Positive, negative, neutral and conflict are available labels in the paper's formulation. The conflict label lets a target carry mixed evaluations without forcing a choice between positive and negative. Giving a sentence a positive and a negative label for different targets is also possible. The difficulty is to assign each label at the granularity required by the annotation.
Term extraction and category detection ask a different kind of question from polarity prediction. In the former tasks, the answer can contain several targets. In the latter tasks, the system is told which target to assess. Knowing where to look makes polarity prediction a useful test in its own right. It also removes errors that a system would face if it had to discover the aspects before judging them. This difference in what the system receives becomes central when the paper compares single-task and joint evaluation.
Separate predictors for separate decisions
The authors describe early aspect analysis as relying on engineered features. Subsequent work learned representations from text and used different output mechanisms for different tasks. Double Embeddings and CNN-based Sequence Labeling for Aspect Extraction combined general and domain-specific word representations. A convolutional network used those representations for extraction, and a classifier assigned word-level labels that identified aspect spans. The output design made sense for a task whose answer boundaries occur inside the sentence.
The paper also describes work that transferred supervision between levels of granularity. The Multi-granularity Alignment Network used recurrent computation for term polarity and drew on out-of-domain data with coarser sentiment supervision. That line of work addressed a problem that also motivates this paper. Detailed annotations about multiple targets within one review can be expensive to obtain, while training signals at a broader level may already exist. The generative approach examines whether different kinds of signal can also be combined inside the task's output sequence.
With BERT, prior work had a way to represent each word using context from both directions. BERT Post-Training for Review Reading Comprehension and Aspect-based Sentiment Analysis framed review interpretation as a form of question answering. It used separate output heads for locating a term span and predicting a term's polarity. An output head is the part of the system that turns its internal representation into the answer required by a task. A span head locates text, while a polarity head chooses a sentiment class. BERT-PT also received additional training on review data and on reading-comprehension examples from SQuAD.
Other BERT-based studies examined how much could be gained from the representation that feeds those outputs. The paper describes approaches that combine predictions from multiple BERT layers, either in parallel or by passing information through a hierarchy. It also discusses BERT-IL, which compares contextual representations with GloVe vectors for an aspect term. These approaches are relevant because the few-shot problem could lie partly in how the input is represented. The authors' proposal changes the way supervision reaches that representation and the way the answer is expressed.
Why generate the answer?
The related work already included alternatives to conventional classifiers. The authors describe a BART-based approach that scores combinations of aspect categories and polarities and chooses the strongest pair. They also describe an approach that cast term polarity as a natural-language inference problem and used additional training on reviews. Those examples show that the task can be posed through language and that category prediction in particular already had a generative precedent. This paper investigates a shared serialization for term extraction, category detection and their corresponding sentiment decisions.
GPT2 supplies a different starting point from BERT. Its Transformer and attention mechanism is causal, meaning that the next prediction draws on the sequence to its left. In pretraining, the system acquires the ability to continue text in this manner. The authors ask it to continue a review with a structured answer. A polarity label, an aspect span and a category identifier can all be expressed using the same vocabulary. The training procedure therefore has a natural output for every task even when the desired answers vary in length.
Language Models are Few-Shot Learners motivates this approach through a different use of generative prediction. It describes GPT3 responding to labeled demonstrations placed in its input without updating its parameters. In the aspect-based sentiment paper, the small collection of examples is used for parameter updates. At prediction time, the input contains the review and whatever portion of the task specification is needed for that example. The experiment concerns what can be learned from a small fine-tuning set.
That choice brings the scarcity of training data into the design of the loss. A classifier trained on a designated aspect gets a signal about the sentiment attached to that aspect. A next-token objective can use the review, the annotation structure and the label as prediction targets within a single training example. The paper asks whether that broader signal helps with limited annotations and whether the same training setup can support answers requiring several related decisions.
The method, step by step
Decide what the continuation has to contain
The authors organize the sentiment tasks around the information available at the start of prediction. For aspect term extraction, called SB1, the desired output identifies the terms in the review. This includes terms whose annotation is neutral. For aspect term polarity, SB2, the term is already supplied and the output gives its sentiment. The term might be a single word or a longer span. Its role in the input is to direct the sentiment decision.
Aspect category detection, SB3, identifies categories from a pre-defined inventory. Aspect category polarity, SB4, supplies a category and asks for its label. SemEval14 restaurant annotations use broad categories such as food, price and service. SemEval16 encodes a category as an entity and attribute pair, as in FOOD#QUALITY. The entity identifies what is being discussed, while the attribute identifies the dimension under discussion. The system has to learn which of these names belongs in the continuation for the dataset it sees.
A term prediction draws directly on words in the review. A category prediction may require an abstraction from those words. For instance, the paper's examples include individual dishes marked with positive sentiment and a corresponding positive food category. The category can summarize evidence from several term mentions. In another case, there may be enough language to support a category even if the review lacks a span that names the relevant aspect in the same way. The text format accommodates both types of annotation by assigning them separate parts of the answer.
Put the review and annotations into a sequence
Each training example begins with the review. Markers indicate where that text starts and ends. An aspect term segment follows for term tasks, and a category segment follows for category tasks. In the combined task, the term segment comes before the category segment. Within a segment, each target is followed by its polarity. Separators mark where one pair ends and another can begin.
One of the paper's examples describes an evening where the writer was pleased with both the food and the live entertainment. For term training, the sentence comes first, followed by the food term and its positive label and then the entertainment term and its positive label. If the system is tested only on the sentiment of food, the evaluation prefix extends through the food term. If it is being tested on joint term prediction, the prefix ends after the review. It has to supply both terms, along with their labels.
The paper uses identifiers such as <|review|> and <|term|> to distinguish segments and identifiers such as <|endofreview|> and <|endofterm|> to close them. Their textual form gives the sequence visible boundaries. The authors construct the identifiers from pieces of the existing vocabulary, so the segments can be learned with the existing embeddings, the vectors associated with vocabulary entries. The appendix reports that adding identifiers as fresh vocabulary entries hurt performance. The authors attribute that result tentatively to the difficulty of learning newly initialized vectors with sparse training data.
In the multitask sequence, the category segment comes after the generated terms and polarities. The ordering matters because the generator works left to right. The earlier part of the answer can provide context for the later part. During training, the target term segment is present in the sequence. During prediction, the term segment consists of what has already been generated. Thus a category output can draw on the review and the preceding term predictions. This dependency is built into the format, while the experiments measure the performance of the resulting complete answers.
From a labeled review to a generated answer
The steps in order.
Predict a token at each step
A token is a unit of text drawn from the system's vocabulary. A sequence may contain tokens for the review words, the markers, the aspect names, the sentiment labels and the separators. The entire training example has a probability under the next-token system. As in the earlier neural probabilistic language model cited by the authors, the probability of a sequence can be factored into conditional probabilities for its successive elements. In the paper's notation, the factorization is
pθ(x) = ∏ₜ₌₀ⁿ pθ(xₜ | x₍<t₎)
Here x is the sequence, n is its length as described by the paper, and t is a position in the displayed product. The product sign ∏ indicates multiplication across positions. θ denotes the trainable parameters, and pθ is the probability assigned using those parameters. xₜ is the token at position t. x₍<t₎ is the sequence before that position, and the vertical bar means that the probability of the token depends on that earlier sequence. The displayed product starts at 0, while the training sum below starts at 1. In both cases the role of the expression is to break sequence prediction into successive predictions from the left context.
During training, the complete sequence supplies the target at each position. When a review token is the target, the system learns to predict it from what comes before it. When an answer token is the target, the preceding text includes the review and any annotation tokens that appear earlier. The same vocabulary output is used throughout. The paper's loss is the negative log-likelihood of the training sequences.
Lᴅ = −∑ₖ₌₁ᴷ ∑ₜ₌₁ⁿ log pθ(xₖₜ | xₖ,<t)
Lᴅ is the loss on the training collection D. The outer sum, indexed by k, runs over its K examples. The inner sum, indexed by t, runs over the sequence positions through n. xₖₜ is the target token at position t in example k, and xₖ,<t contains the earlier tokens in that example. pθ is the conditional probability computed by the parameters θ. Taking log converts the product of token probabilities into a sum, and the minus sign makes higher assigned probabilities correspond to lower loss.
The choice of prediction positions is part of the intervention under study. In a polarity classifier, the supervised decision is the sentiment class for the supplied target. With this training loss, the polarity also has a designated position, but it contributes alongside predictions about the rest of the sequence. For example, the training text can teach the system how review sentences are written, how a target is expressed and where a sentiment word belongs relative to other parts of the answer. The paper later compares training loss at the label position with the behavior of the full-sequence loss.
Represent aspect terms and categories as pairs
The authors use separate notation for the two sorts of aspect annotations. The term annotations for review k are written as
Tₖ = {TPₖⁱ = (tₖᵢ, ptₖᵢ) | i ∈ I}
Tₖ is the collection of annotated term–polarity pairs for review k. TPₖⁱ names the pair indexed by i. Its first component tₖᵢ is the term text, and its second component ptₖᵢ is the term's polarity. The braces enclose the collection. i ∈ I says that i ranges over the term annotations for the review. In the paper, I also describes how many such pairs the example contains.
The category annotations follow the same pattern.
Cₖ = {CPₖʲ = (cₖⱼ, pcₖⱼ) | j ∈ J}
Cₖ is the collection of category–polarity pairs for review k. CPₖʲ is the jth pair. cₖⱼ is the category from the dataset's inventory, and pcₖⱼ is its polarity. The condition j ∈ J ranges over the category annotations for that review. The authors also use J for their number. The notation describes the information to preserve, while the sequence format chooses where to place the information in the text.
For a term training sequence containing all annotated terms, the paper writes
xₖ = [Sₖ; Tₖ]
xₖ is the serialized training example for review k. Sₖ is the review sentence, and Tₖ is the collection of term pairs. The brackets and separator denote concatenation in that order, using markers and separators to give the parts boundaries. This sequence supplies the text used to learn term continuations.
For category training, the corresponding expression is
xₖ = [Sₖ; Cₖ]
xₖ is again the training sequence for review k. Sₖ is the review and Cₖ is the category collection. The review comes first and the serialized category pairs follow. In the multitask training format, both kinds of annotation follow the review, with the term pairs before the category pairs.
A variant used in the sequence-format ablation repeats a review separately with each term pair.
{xₖᵢ = [Sₖ; TPₖⁱ] | i ∈ I}
xₖᵢ is the training sequence made from review k and its term pair indexed by i. Sₖ is the repeated review, and TPₖⁱ is that sequence's term and polarity. i ∈ I ranges over the available pairs. The outer braces group all sequences produced for the review. This procedure can create more training sequences from the selected sentences, because assignments that had occupied successive positions in one example now appear in separate examples.
Stop the prefix where the answer begins
At evaluation time, the prefix determines the job. In single-task term polarity prediction, the prefix contains the review and the designated aspect term. The paper describes generating a label token at the next position for this aspect-polarity case.
ptₖᵢ = LMₜₑᵣₘ(Sₖ, tₖᵢ)
ptₖᵢ is the predicted polarity of term i in review k. LMₜₑᵣₘ denotes the generator trained using term annotations. Its inputs here are Sₖ, the review sentence, and tₖᵢ, the aspect term to assess. The generator receives these in their serialized form, with the task's markers.
For single-task category polarity, the known target is a category.
pcₖⱼ = LM꜀ₐₜₑ꜀ₒᵣᵧ(Sₖ, cₖⱼ)
pcₖⱼ is the predicted polarity of category j in review k. LM꜀ₐₜₑ꜀ₒᵣᵧ denotes the generator trained using category annotations. The inputs Sₖ and cₖⱼ are the review and the supplied category. The sentiment decision is evaluated for that category, so errors in searching for categories play no role in this particular score.
Joint prediction starts earlier in the sequence. For the term version, the review is enough to start generation, and the target terms and their labels are both part of the answer.
Tₖ = LMₜₑᵣₘ(Sₖ)
Tₖ is now the generated collection of term–polarity pairs for review k. LMₜₑᵣₘ is the term generator, and Sₖ is its review input. The notation uses the same Tₖ as for the annotations because the generator is meant to recover that collection. It must generate a sequence that can express several such pairs.
The joint category version follows the same design.
Cₖ = LM꜀ₐₜₑ꜀ₒᵣᵧ(Sₖ)
Cₖ is the generated collection of category–polarity pairs. LM꜀ₐₜₑ꜀ₒᵣᵧ is the category generator and Sₖ is the review for instance k. Categories and sentiment labels come from the continuation, so this task involves detecting categories as well as judging them.
The multitask version places both groups in the output.
[Tₖ; Cₖ] = LMₘᵤₗₜᵢ(Sₖ)
LMₘᵤₗₜᵢ denotes the generator trained to produce terms and categories from the same review. Sₖ is the input sentence for example k. Tₖ is its generated term–polarity group and Cₖ is its generated category–polarity group. The brackets and separator give their order in the output. The continuation proceeds token by token through the answer until the terminating marker described by the authors.
Carry the same idea to other labels
The paper uses related formats for the auxiliary tasks. A movie-review passage is followed by a sentiment marker and the name of its sentiment class. The fine-grained version can express a label such as somewhat positive in words. For intent detection, a user's utterance is followed by an intent marker. The example in the paper is a request for an Italian translation, mapped to a translation intent. In each case, the answer occupies the end of the training sequence, and the test prefix stops before it.
The authors identify the accompanying code as fewshot_absa. The aspect datasets come from the SemEval challenges, and the additional experiments use the Stanford Sentiment Treebank and the out-of-scope intent detection data. Across those datasets, the design choice stays the same. An existing language-generation objective learns to continue input text with the supervised answer, using a format adapted to the task.
Experiments and results
Training budgets and test conditions
The aspect experiments use restaurant and laptop reviews. The reported SemEval14 dataset distribution gives the restaurant domain 3041 training examples and 800 test examples. For laptops it gives 3045 training examples and 800 test examples. On SemEval16, the corresponding counts are 2000 training and 676 test examples for restaurants, and 2500 training and 808 test examples for laptops. The SemEval16 analysis is restricted to English sentence-level reviews, which the authors chose to support comparisons with previous work.
The domains support different tasks. Both restaurant datasets contain annotations for terms and categories, so a combined answer can be evaluated there. The laptop reviews supply term annotations in SemEval14 and category annotations in SemEval16. Laptop results therefore cover the relevant tasks for each release. They cannot provide the same combined term-and-category evaluation that the restaurant annotations make possible.
For term tasks, the authors randomly subsample the training set at 1%, 5%, 10% and 20%. The paper describes the smallest sample as containing roughly 20 sentences in its illustrative case. For category polarity, the budget is specified in examples per category. The authors sample 1, 5, 10 or 20 examples for each category. A 1-shot condition in a category plot and a 1% condition in a term plot thus refer to different sampling rules. Reading them as equivalent budgets would imply a comparison the sampling design does not make.
SemEval14 and SemEval16 lack official development splits in the dataset distribution reported by the paper. The authors use the official trial data as validation and remove those examples from the training pool. They also retain cases labeled conflict. The paper says some prior studies excluded these cases because they were difficult to predict. The authors reproduce full-shot BERT-PT results under their own protocol so that comparison includes the difficult polarity cases. The resulting scores refer to that evaluation setup.
The main comparison is with BERT and BERT-PT. BERT-PT uses additional post-training on review and reading-comprehension data, so it is a more specialized reference point than ordinary BERT. GPT2-base and GPT2-medium are evaluated without a corresponding extra stage on those corpora. For few-shot comparisons, the authors leave out BERT-IL because its code was unavailable to them. The extraction comparison at full shot includes further discriminative systems for which the paper reports results.
What each score measures
Single-task polarity accuracy counts correct labels for supplied aspect terms or categories. A system can succeed on this metric even if it would have failed to find the target itself. The setup is useful for isolating sentiment prediction. It is also the setting in which a BERT polarity classifier and the GPT2 continuation can most directly be compared, because they are answering the same question about the same designated aspect.
Term extraction and category detection use F1, which combines precision and recall. Here precision concerns how much of the predicted material is correct, and recall concerns how much of the annotated material is recovered. The paper describes the computation in terms of overlap between generated and annotated answers. Extraction F1 can detect a missing or extra aspect even if the sentiment labels are set aside. It therefore provides a common component measure for single-task extraction baselines and a generator trained to produce more information.
Joint accuracy is more demanding. For joint term prediction, a review counts as correct only when all its required terms and their polarities are correct. The combined evaluation likewise scores complete answers in the multitask setting. A review can have several correct aspect decisions and still fail the joint check. The subtask scores alongside it allow some of that partial success to be seen. The paper distinguishes these outcomes from the independent polarity experiment, where the aspect is supplied.
The additional sentiment datasets use accuracy. The out-of-scope intent evaluation reports accuracy across in-domain and out-of-scope examples together. In the main aspect polarity plots, the lines show mean accuracy across 4 random seeds, and the shaded regions indicate standard deviation. The mean describes the typical result in the repeated runs. The standard deviation describes how much those runs differ. These are distinct properties when a small change in the selected examples or run can matter to the resulting score.
Polarity prediction with known aspects
Across the reported single-task SemEval comparisons, GPT2-base is stronger than ordinary BERT on aspect polarity at the few-shot and full-shot budgets. The authors draw attention to the very smallest budgets, where the BERT curves tend to drop and their dispersion widens. GPT2 more frequently retains both higher mean accuracy and tighter variation between runs. For someone selecting a system under scarcity, that difference matters even if the best individual run of a competing system happens to be strong.
The paper highlights the SemEval14 restaurant term result at 1% of training data. At this budget, described as 20 examples, GPT2's mean test accuracy is higher than BERT-PT's by 9 points, and its standard deviation is lower by 6.2 points. These are the reported differences for that task and training budget. The comparison addresses the sentiment of an aspect already provided to both systems, and the stability result describes repeated runs of that evaluation.
BERT-PT presents a closer comparison than ordinary BERT. GPT2-medium matches or beats its average accuracy in many few-shot settings, and GPT2-base beats it in the smallest settings highlighted by the authors. On SemEval16 restaurant category polarity, the authors report a GPT2-base advantage over BERT-PT across the tested budgets. Elsewhere, the paper identifies cases where BERT-PT leads GPT2-medium, including some comparisons with more training data. The reported pattern favors generation most clearly when the labeled sample is very small.
The authors suggest that BERT-PT's additional training on data outside the target benchmark could help explain its higher run-to-run spread. That is a proposed mechanism. The baseline varies from GPT2 in its architecture, its additional data and its downstream objective. The comparison establishes the behavior of the resulting systems on these runs. The objective ablation addresses a more focused question by keeping the GPT2 backbone.
Finding the aspects as well as judging them
The full-shot SemEval14 comparison asks whether generation can still extract terms accurately when it has to generate their sentiment too. In the restaurant domain, joint GPT2-medium reaches 81.52 extraction F1. The multitask arrangement also generates categories and their polarities and reaches 82.04 on that term metric. The single-task BERT-PT extraction result is 77.97. The GPT2-base figures show a smaller change across objectives, with 77.59 for joint training and 77.92 for multitask training.
Full-shot SemEval14 restaurant test results for aspect term extraction
GPT2-medium leads the displayed extraction comparison when it generates categories as well as terms.
The numbers
| System or setting | F1 |
|---|---|
| BERT single-task | 74.1 |
| BERT-PT single-task | 77.97 |
| GPT2-base joint | 77.59 |
| GPT2-base multi-task | 77.92 |
| GPT2-medium joint | 81.52 |
| GPT2-medium multi-task (this paper) | 82.04 |
These figures measure the quality of the extracted terms, irrespective of whether the answer also successfully assigns all the labels. The distinction shows up in the paper's full-shot joint accuracy column. For restaurant reviews, the joint term configuration reaches 56.47 with GPT2-base and 60.07 with GPT2-medium. In the multitask configuration, which also has category decisions in its answer, the same table reports 49.84 and 54.43. Because the requirements for a complete answer have expanded, those values describe different tasks. Higher term F1 can coexist with lower complete-answer accuracy when category mistakes can also cause an answer to fail.
The laptop term results go in a different direction from the restaurant extraction result. On full-shot SemEval14 laptop extraction, joint GPT2-medium scores 75.94 F1. BERT-PT scores 84.26, and BERT-HSUM scores 86.09. Joint GPT2-base scores 72.61. The authors suggest that the nature or amount of supervision available for the laptop joint objective may contribute to the gap. The experiment shows that generating term and polarity pairs can be less effective for term extraction than the dedicated alternatives in this domain.
Full-shot SemEval14 laptop test results for aspect term extraction
The displayed discriminative baselines recover laptop terms more accurately than the joint GPT2 systems.
The numbers
| System or setting | F1 |
|---|---|
| GPT2-base joint | 72.61 |
| GPT2-medium joint (this paper) | 75.94 |
| BERT-PT single-task | 84.26 |
| BERT-PSUM single-task | 85.94 |
| BERT-HSUM single-task | 86.09 |
The single-task BERT baselines are comparable on extraction F1 because the term list can be evaluated separately. They do not have comparable complete-answer scores in the paper's joint table. In the single-task polarity setup, the BERT-PT classifier sees the annotated aspect. A joint GPT2 prediction has to find it. Reporting the two scores side by side as equivalent sentiment results would conceal the difference in information available at test time.
Generating terms and categories together
The multitask experiments in the appendix follow each annotation type as the training budget changes. They report joint accuracy and separate scores for term extraction, term polarity, category detection and category polarity. This layout shows when a complete answer improves in parallel with its individual components and when changes in one component diverge from the others.
On SemEval14 restaurant reviews, multitask joint test accuracy at 1% is 20.75 for the 12-layer GPT2 and 20.62 for the 24-layer GPT2. At 100%, the multitask appendix reports joint test accuracy of 51.63 and 55.62, respectively. The larger configuration has the higher score at the full budget, while the smaller configuration has the higher score at the smallest reported fraction. The size comparison depends on how much labeled data is used.
The component results also depend on which annotation is being measured. In the SemEval14 multitask appendix at 100%, the 24-layer configuration has term extraction F1 of 81.53 and term polarity accuracy of 57.92. For the 12-layer configuration, those figures are 77.43 and 49.71. Category detection moves in the other direction at that budget, with F1 of 85.34 for the 12-layer system and 82.4 for the 24-layer system. The category polarity accuracies are 70.57 and 70.38, respectively. These scores come from the appendix's multitask comparison. The full-shot extraction chart reports the figures from the separate comparison against extraction baselines.
The SemEval16 restaurant multitask results have a similar dependence on the training budget. At 1%, joint test accuracy for the 12-layer configuration is 11.6, compared with 9.04 for the 24-layer configuration. At 100%, joint test accuracy is 32.42 and 43, respectively. For the 24-layer configuration at 100%, term extraction is 50.27 F1 and category detection is 76.78 F1. The polarity accuracies in that same generated output are 30.15 for terms and 69.6 for categories. The gap between components illustrates how strongly overall success depends on recovering the term answers as well as the category answers.
SemEval16 restaurant multi-task joint test accuracy for 24-layer GPT2
Complete restaurant answers become more frequent at each larger training budget shown.
The numbers
| System or setting | accuracy % |
|---|---|
| 1% of training data | 9.04 |
| 5% of training data | 20.48 |
| 10% of training data | 22.18 |
| 20% of training data | 26.96 |
| 100% of training data (this paper) | 43 |
The multitask results support the feasibility of predicting the full collection of annotations in a single continuation. They also show why a component score is useful alongside complete-answer accuracy. Detection of broad categories can be relatively strong while the generated terms are still incomplete. A system can make a plausible statement about what the review discusses and still lose credit for the details of how the review expresses it.
Movie reviews and intent labels
The binary and fine-grained movie-review tasks use SST-2 and SST-5, respectively. The distribution reported for SST-2 contains 66,749 training, 872 development and 1821 test examples. SST-5 contains 8544 training, 1101 development and 2210 test examples. Those figures describe the available datasets. The few-shot experiments draw on the restricted budgets described in the figures, where 1-shot means one example per class. The SST-2 few-shot plot is explicitly a development-set comparison.
For out-of-scope intent detection, the paper reports 15,100 training examples, 3100 development examples and 4500 test examples. The task is intended for chatbots and includes utterances outside the covered intents. The evaluation combines the in-domain and out-of-scope cases in the reported overall accuracy. This extends the test of label generation to requests whose answer names an intent instead of expressing a sentiment.
The authors report a few-shot advantage for GPT2 over BERT-based classifiers on these auxiliary comparisons. For intent detection they also report an advantage over TOD-BERT, which received additional dialogue pretraining. The additional tasks support the use of next-token fine-tuning for several forms of short text classification. They test a single answer for an input and therefore address a simpler output structure than the multi-aspect experiments.
What the ablations show
The same GPT2 backbone can learn different downstream tasks
The most direct ablation asks what happens when GPT2 is fine-tuned as a classifier. The authors attach a classification layer to the representation of the final input token and train it to choose the polarity class. This version discards the next-token objective for the downstream task. Its input still passes through GPT2's causal attention. The generative version uses the same kind of backbone and learns through the continuation objective.
On SemEval14 restaurant term polarity at 1% of training data, the GPT2 classifier performs below BERT, while generative GPT2 achieves the stronger validation and test results. Related appendix comparisons cover laptop and category polarity as well. The appendix reports that the GPT2 classifier trails BERT across the few-shot and full-shot regimes examined there. This comparison is especially informative because a favorable BERT versus GPT2 result alone could have reflected GPT2's pretrained representations. Replacing generation with classification changes the outcome while retaining GPT2 as the source of the input representation.
The authors suggest that bidirectional attention may give BERT an advantage when a system is used as an encoder for classification. Causal GPT2 builds a representation appropriate for continuing a sequence. Training it with a next-token loss makes use of that property. These are explanations for the observed ordering, and the experiment changes the form of the head together with the training objective. It therefore establishes the effectiveness of the generative arrangement as a whole more directly than it establishes the contribution of any single part.
Training loss and validation performance tell different stories
The authors examine the progress of BERT, the GPT2 classifier and generative GPT2 during few-shot training. The central example is the SemEval14 restaurant term polarity task with 1% of the training data. BERT brings its training loss down quickly with a classification head that has 4 outputs. Generative GPT2 reduces its full-sequence loss more slowly while learning to assign probabilities throughout a sequence with a vocabulary-sized output.
The authors also track the generative loss at the label position alone. This is a closer view of what GPT2 is learning about the classification decision. Between 40–90 training steps in the restaurant example, the paper reports that GPT2's label-position loss is lower than BERT's classification loss and that GPT2 has higher validation accuracy. Later, BERT reaches lower training loss while its evaluation performance remains below GPT2's. The eventual training ordering therefore gives a misleading picture of which system generalizes better on this task.
The paper interprets the curves as possible evidence of overfitting by the classifiers. A small classification head lets BERT improve its fit to the labels it sees. With limited examples, improving that fit can yield little improvement on validation cases. The generator has to fit the label and other parts of the sequence. Predicting those extra positions could help it preserve or adapt representations that are useful for the task. The appendix shows examples on other aspect tasks where the generator retains a validation advantage even while its training losses are comparatively high.
The comparison also highlights a measurement issue. The full generative loss covers review text and the answer, while a classification loss is concerned with the class decision. Their magnitudes reflect different prediction problems. The authors' label-position analysis narrows the comparison, but the answer still comes from a vocabulary in one case and from a class head in the other. Validation and test accuracy provide the task-level evidence, and the loss curves describe the paths the systems take to get there.
Where parameters move during few-shot training
The authors measure how much the weights change during fine-tuning. The study uses 1% of SemEval14 restaurant training data for term polarity and compares BERT, the GPT2 classifier and generative GPT2. The measure is based on a step-to-step change divided by the initial value. The paper's figure caption defines the per-step quantity as
(wⁱ − wⁱ⁻¹) / w⁰
wⁱ is the weight at training step i, and wⁱ⁻¹ is its value at the preceding step. w⁰ is the value before fine-tuning. Subtracting the previous value measures the change at that step. Dividing by the initial weight expresses that change relative to its starting value.
The layer expression in the appendix accumulates these normalized changes.
∑ᵢ₌₀ᵏ (wₗⁱ − wₗⁱ⁻¹) / wₗ⁰
l identifies the layer, and i indexes training steps up to the displayed upper bound k. wₗⁱ, wₗⁱ⁻¹ and wₗ⁰ represent the corresponding current, previous and initial weights for that layer. ∑ adds the normalized terms. The paper describes the plotted quantity as a mean for a layer. Its displayed sum starts at 0, while the caption describes the change from a preceding step. The averaging and treatment of the initial boundary are left implicit in the displayed formula.
BERT shows greater variability across layers in this analysis, especially for its randomly initialized classification layer. It moves more than generative GPT2 early in training on the reported measure, and less at the end. The most pronounced difference favoring GPT2 is in its embeddings. The authors report that the generative embedding updates are larger than those of BERT and the GPT2 classifier by one order of magnitude early in training, rising to two orders of magnitude by the end.
The weight diagnostics are consistent with the possibility that next-token training delivers a broader signal to GPT2. The embeddings participate in predicting the serialized review and answer throughout the sequence. A polarity-only loss reaches the representation through a single decision for each example. The diagnostics show where the systems changed under those arrangements. They do not connect a particular weight change to a particular corrected aspect or sentiment decision.
Splitting a review into more training sequences
The sequence-format ablation changes what counts as a training example. In the regular setup, a review with several annotated aspect terms can be followed by all of their term–polarity pairs. With GPT2-Split, those pairs go into separate sequences, each preceded by the same review. This can turn a small set of reviews into a larger collection of sequences. It also changes what follows each review and how many times the review text contributes to the training loss.
The appendix reports that at the 1% budget, the regular format has 20, 14 and 12 training sequences in the three term-polarity comparisons it discusses. The split format gives 36, 23 and 17 sequences in the corresponding comparisons. These are counts of serialized training inputs. The selected sentences themselves are shared across the formatting variants. Splitting can give each aspect direct exposure after the review without adding labels from independently sampled reviews.
GPT2-Split often helps at small budgets, while the regular arrangement tends to work better at full shot. There are exceptions, including at 1% and 5% in one of the plots. The authors suggest that splitting is most helpful when the initial number of training sequences is especially low. Because splitting changes sequence structure as well as count, the experiment supports the choice of format under certain data conditions. It leaves open whether repetition, the position of the target in the sequence or some combination accounts for the differences.
The format also changes what the generator sees of relationships among aspects. In an unsplit sequence, later aspect pairs follow earlier ones from the same review. In a split sequence, each pair follows a fresh presentation of the review. That can make the focused single-aspect training example more similar to the polarity request made at test time. The paper's results make the tradeoff visible through the accuracy curves, without isolating that possible source of the improvement.
What shared term and category supervision changes
The qualitative analysis compares the joint term output, the joint category output and the multitask output for restaurant reviews. In one example, a complaint about watered-down sangria leads the term system to predict negative sentiment correctly. The category-only system assigns a neutral label to food. The multitask continuation gives both the drink term and the food category the negative polarity expected by the annotations. This illustrates how the same sentence can support a consistent interpretation at both levels.
Another example praises several members of the restaurant staff. The term-only output assigns a neutral label to the bartender even though the sentence includes that role in the praise. The combined output correctly treats the bartender, host and servers positively, while also assigning positive sentiment to service. In a different example, the joint term output includes the place as an extra target and labels it negatively. The combined output retains the food terms and their positive sentiment and omits the extra target. These cases illustrate changes in sentiment assignment and in selection of spans.
The authors also show mixed-opinion failures. A review that criticizes the sushi in one respect, praises its freshness and comments favorably on cleanliness is annotated with conflict for the sushi and food and positive sentiment for ambience. The multitask output gets the positive ambience but gives the sushi and food a positive reading. The review contains support for that reading, while the expected answer needs to preserve the criticism as well. More annotation types in the continuation do not automatically resolve opposing evidence.
Other failures involve the boundary of the annotated term or the level at which the opinion should be attached. The paper includes a review about portions whose annotation groups the relevant words into a longer span. The generated answer picks out shorter pieces and assigns negative sentiment. Even a plausible account of what the reviewer disliked can differ from the expected aspect span and label. These examples help explain why terms, categories and joint accuracy can improve at different rates.
Limitations
Limits identified by the authors
The authors restrict the SemEval16 analysis to English sentence-level data. The challenge includes other languages and a text-level task, so the evaluation establishes performance on a particular subset. Restaurant reviews supply the annotations required to evaluate the multitask answer. Laptop reviews do not supply both kinds together in the releases used here. Those annotation differences limit the domains in which the most complete version of the method can be tested.
The paper also identifies limits in the baseline comparison. A classifier evaluated on a known aspect has a different task from a generator that has to discover the aspect. The authors compare their joint output with the single-task baselines where a common metric is available, such as term extraction F1. They omit a direct comparison on joint accuracy. Code availability also constrains the few-shot baseline set, with BERT-IL left out of those runs.
The qualitative discussion identifies difficulty with negative and conflict sentiment, especially when a single sentence expresses opposing opinions across aspects. Retaining conflict examples in the evaluation makes that difficulty part of the benchmark. The errors are meaningful for the task. A customer can praise an attribute while expressing an overall reservation about the same target, and producing the dominant sentiment can discard information the annotation was designed to preserve.
The broader-impact discussion raises concerns about bias and toxicity in sentiment predictions and about reduced human control when systems are used to automate opinion mining. The authors point to earlier studies of gender and race bias in sentiment systems and bias in language generation. Their experiments measure task performance and variation under small-sample conditions. They offer no corresponding measurement of whether the generative approach changes the incidence of those harms.
Limits of what the comparisons establish
The ablation using a GPT2 classifier makes a strong case for carrying the existing generation objective into fine-tuning. Several properties still change together. The generative variant uses a vocabulary output rather than a dedicated class head, represents the answer as text and predicts tokens throughout the sequence. The classifier version makes a decision from the representation at the end of the input. The paper's experiments leave these ingredients bundled. Assigning the entire gain to the number of predicted tokens, to using a sentiment word as the answer or to preserving the pretrained output would require a comparison that varied that ingredient by itself.
The BERT-PT comparison has additional differences. The systems bring different pretraining and downstream objectives to the task, and BERT-PT receives a review and reading-comprehension post-training stage. The authors' suggestion that this extra stage contributes to its spread is plausible within their discussion. The design does not isolate the stage's effect on run-to-run variability. Conversely, the fact that GPT2 performs well without that extra training establishes an advantage for the tested setup under those conditions, without establishing how either approach would behave under matched pretraining.
The variance claim is tied to repetition of the benchmark experiments. The aspect plots summarize 4 random seeds. Their shaded bands report standard deviations across those runs. This describes repeatability under the paper's setup. It does not on its own establish insensitivity to other forms of change, such as a different domain, a shifted category inventory or a different way of assigning annotations. The laptop term result gives an example within the paper where the extraction advantage seen in restaurants does not carry over.
Similarly, the few-shot budgets describe supervised fine-tuning. The study shows how the systems respond when training is limited to small labeled subsets. It gives no direct comparison with using the same examples as demonstrations at inference time. The connection to the earlier GPT3 work is a motivation for casting the answer as text. It does not extend the reported performance comparison to in-context learning.
The multitask scores treat several kinds of evidence together. The combined sequence has more annotations and a longer answer, and its categories can depend on the terms generated before them. The restaurant extraction results show that this arrangement can improve a component of the answer. They do not identify whether the gain arises primarily from extra supervision on the shared parameters, from learning the relation between terms and categories during generation or from both. The qualitative examples suggest plausible relationships, while the benchmark metrics measure their combined effect.
The overall joint measure is strict, but it leaves many distinctions to the component measures and the qualitative examples. Missing a term, assigning the wrong polarity and generating an extra category can each spoil the complete answer. Conversely, a strong category score can coexist with weak recovery of the underlying terms. The paper gives examples of both span and sentiment errors. It does not provide a full error distribution linking every type of joint failure to the training choices.
The other datasets extend the result across short-label tasks, but their scope is narrower than the aspect tasks in a different way. A whole-input sentiment judgment and an intent label test the generator's capacity to express a semantic decision as text. They provide no evidence about recovering multiple targets with separate polarities in other application areas. For intent detection, the aggregate accuracy reported in the paper combines supported and out-of-scope requests. That figure alone cannot show how much of the gain came from recognizing unsupported requests specifically.
What came after
Continuous Attentive Multimodal Prompt Tuning for Few-Shot Multimodal Sarcasm Detection cites the study and moves the small-sample problem to multimodal sarcasm detection. The later work's title identifies its method as continuous attentive multimodal prompt tuning. Its point of contact with Hosseini-Asl and colleagues is the use of a language-based adaptation strategy for a task involving evaluative or figurative meaning when few labeled examples are available.
The task and adaptation choices are distinct. Hosseini-Asl and colleagues fine-tune GPT2 with serialized textual annotations so it can list targets and attach sentiment to each. The later work concerns a decision about sarcasm and brings multiple modalities into a prompt-tuning setup. The citation connects those few-shot research problems. Whether the later method reuses the earlier paper's next-token objective, aspect serialization or joint prediction scheme is unspecified.
Cite
Cite as Ehsan Hosseini-Asl, Wenhao Liu and Caiming Xiong. 2022. A Generative Language Model for Few-shot Aspect-Based Sentiment Analysis. Findings of the Association for Computational Linguistics: NAACL 2022.
@inproceedings{hosseiniasl2022generative,
title = {{A Generative Language Model for Few-shot Aspect-Based Sentiment Analysis}},
author = {Ehsan Hosseini-Asl, Wenhao Liu and Caiming Xiong},
booktitle = {Findings of the Association for Computational Linguistics: NAACL 2022},
year = {2022},
doi = {10.18653/v1/2022.findings-naacl.58},
url = {https://doi.org/10.18653/v1/2022.findings-naacl.58}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/asl-2022-generative-language-model-few-shot/