2022 Coling-1 610
2022 Coling-1 610
tive format includes but is not limited to Generat- design an element prompt and establish the corre-
ing Structure-Linearized Texts, Labelaugmented spondence between each element with the element
Text(Zhang et al., 2021b) Generating Word Indices prompt. We make the framework treat prompt and
(Yan et al., 2021) Filling Templates (Zhang et al., output text as a combination of independent ele-
2021a), as summarized by (Min et al., 2021). ments by this design. We combine multiple ele-
However, all generative approaches mentioned ment prompts into task prompt. The task prompt
above suffer from 1) training and predicting a sin- of a simple task can be regarded as basic bricks
gle specific task at once; 2) treating output as a which can be assembled to transfer to a complex
whole text rather than a combination of individual task, just like assembling Lego bricks. The out-
elements; 3) poor transferability from simple task put sequence is formed as a concatenation of the
to difficult task. Below is a detailed description of sentinel tokens and the real answer tokens, con-
these three points. sistent with T5. To verify the effectiveness of our
For the first point, in mentioned generative ap- method, we conduct experiments on public datasets.
proaches, the input and output formats do not sup- Comparison results show that our proposed frame-
port training on multiple ABSA tasks simultane- work outperforms previous state-of-the-art (SOTA)
ously, which we call multi-task training setting. approaches in most tasks. Moreover, in the case
For the second point, in previous works, the of missing part of the data annotation, it can also
models cannot understand the meaning of each achieve competitive performance.
element to be extracted because the input and out- In summary, our main contributions are as fol-
put are treated as simple strings, and the model lows:
completes the task of predicting output through • We propose a prompt-based unified genera-
auto-regression. tive framework to solve all ABSA tasks. The
For the third point, previous methods cannot be framework can be trained on multiple tasks
applied to task transfer scenarios. Compared to simultaneously, and it also performs competi-
the triplets like ASTE, pairs like AOPE and E2E- tively in task transfer scenarios.
ABSA are much easier in the annotation. However,
previous works cannot complete ASTE by training • To the best of our knowledge, we are the first
only on AOPE and E2E-ABSA tasks even though to explore solutions for task transfer scenarios.
the ASTE task elements are the same as the union
• The experimental results show that Our
of AOPE and E2E-ABSA task elements. We call
method significantly outperforms the SOTA
this task transfer scenario, and it is a special case
methods on E2E-ABSA, AOPE, ASTE, and
under a multi-task training setting. The proposed
ACSA tasks.
method has a competitive performance in this set-
ting. 2 Methodology
Inspired by above observations, we propose a
unified generative framework LEGO-ABSA that 2.1 Task formulation
can simultaneously solve multiple ABSA tasks and The proposed method will formulate any ABSA
transfer from simple to complex tasks. Specifi- task as a text generation task. Here we give formal
cally, we take T5 as our backbone network and definitions of generative frameworks’ inputs and
combine prompt learning with the practice of plac- output text.
ing sentinel tokens of T5 pre-training. Unlike most The input x consists of two part, the raw text t
previous works that use a piece of simple text as a and a task prompt p: x = t + | + ptask . t =
prompt, e.g."ASQP" in (Zhang et al., 2021a), we [t1 , t2 , ...tn ] where ti is the ith token of t and n is
7003
the length of tokens. ptask = [p1 , p2 , ...pmtask ] 2.3 Task Prompt of Single-task Training
where pi is the ith element prompt of ptask and
mtask is the number of element prompt in ptask , From shallow to deep, we start with the single
which is used as a condition to generate different ABSA task.
output text for different task. The element prompt is defined for each element
Output text otask = [o1 , o2 , ...om′ ], where to be extracted, but in order to complete a specific
′
oi is the ith tokens pair of otask and m is the ABSA task, we need to concatenate different ele-
output length based on the current input x. The ment prompts to form the task prompt, i.e., ptask .
subsequent subsection will describe construction ptask is used as a condition so that the backbone
methods in detail. can distinguish between different tasks. According
to the kind of elements extracted and the order of
2.2 Element Prompt Definition element extraction in each task, we concatenate all
element prompts by commas, e.g. pAOP E can be
2.2.1 Introduction of T5
pao or poa which means pa +, +po and po +, +pa .
T5 is an encoder-decoder model pre-trained on a Because the training for each task is independent, it
multi-task mixture of unsupervised and supervised is trivial to maintain a unique mapping relationship
tasks converted into a text-to-text format. between sentinel token id and element. Here, sen-
In order to minimize the gap in pre-training and tinel token id for each task increments from 0, as
fine-tune, we use the same training mode as the shown in the Figure 1(b) with the sample of AOPE.
T5 dose in pre-training. The goal of T5 is similar The rest of the task prompts also follow the same
to the cloze test. As shown in the Figure 1(a), the method to define.
input of T5 is a sentence with randomly masked
The arrangement order of the element prompt
consecutive spans using sentinel tokens. During
matters since the generation model is generated in
unsupervised training, T5 aims to reconstruct the
an auto-regressive manner, and the elements gener-
continuous span masked by the sentinel token, i.e.,
ated first can provide more prior information for the
<extra_id_i> in the Figure 1(a) incrementing one
elements generated later. From our experimental
by one starting from zero. Through this training
observations, the elements are arranged in priority
object, T5 can learn general language features.
according to aspect term > opinion term = aspect
2.2.2 Element Prompt category > sentiment polarity
In order to make the framework fully understand
the meaning of each element in the output text, 2.4 Task Prompt of Multi-task Training
instead of treating the output as a simple string,
we design an element prompt for each extracted An improvement of our framework is the ability
element. to organize multiple ABSA tasks into a multi-task
We define the element prompt as "aspect: <ex- training task through task prompts.
tra_id_0>", which has two advantages. On the one As shown in Figure 1(c), under the multi-task
hand, the format is consistent with the T5 unsuper- training setting, the task prompt is still constructed
vised training object, which can help us make better by concatenating element prompt like the single
use of the information learned from pre-training. task. The difference is that the one-to-one corre-
On the other hand, by defining a prompt for a sin- spondence between elements and sentinel tokens is
gle element, the output is no longer regarded as a shared between multiple sub-tasks, so we define a
whole text string but as a combination of different global mapping relationship between the sentinel
elements that offer more convenience. token and the corresponding element. Following
The element prompts for the four elements in the the priority of elements mentioned above we as-
ABSA task are as follows. We use w, x, y, and z to sign <extra_id_0> to aspect term , <extra_id_1> to
represent the id of the sentinel token. opinion term, <extra_id_2> to aspect category and
<extra_id_3> to sentiment polarity. After setting
• pa : "aspect : <extra_id_w>" each task prompt, we concatenate task prompts to
• pc : "category : <extra_id_x>" each original input of the corresponding task and
• po : "opinion : <extra_id_y>" then mix the data of all tasks to do multi-task train-
• ps : "sentiment : <extra_id_z>" ing.
7004
Original text Original text
Thank you for inviting me to your party last week Pizza is delicious| aspect : Pizza, opinion : delicious
Inputs Inputs
Thank you <extra_id_0> me to your party <extra_id_1> week Pizza is delicious| aspect : <extra_id_0> , opinion : <extra_id_1>
Outputs Outputs
<extra_id_0> for inviting <extra_id_1> last <extra_id_2> <extra_id_0> Pizza <extra_id_1> delicious <extra_id_2>
Input1
Pizza is delicious| opinion : <extra_id_0> , aspect : <extra_id_1>
Input
Input2 Pizza is delicious| opinion : <extra_id_0>, aspect :
Service is bad| aspect : <extra_id_1> , sentiment : <extra_id_2> <extra_id_1>, sentiment : <extra_id_2>
Output1
Inference result
<extra_id_0> Pizza <extra_id_1> delicious <extra_id_2>
<extra_id_0> Pizza <extra_id_1> delicious
Output2
<extra_id_2> positive <extra_id_3>
<extra_id_1> Service <extra_id_2> bad <extra_id_3>
Figure 1
7006
Task name Task prompt
AOPE opinion:<extra_id_0>, aspect:<extra_id_1>
E2E-ABSA aspect:<extra_id_1>, sentiment:<extra_id_2>
ACSA sentiment:<extra_id_2>, category:<extra_id_3>
ASTE opinion:<extra_id_0>, aspect:<extra_id_1>, sentiment:<extra_id_2>
TASD aspect:<extra_id_1>, sentiment:<extra_id_2>, category:<extra_id_3>
ASQP opinion:<extra_id_0>, aspect:<extra_id_1>, sentiment:<extra_id_2>, category:<extra_id_3>
Table 3: Main result on AOPE, E2E-ABSA, and ASTE tasks. LEGO-ABSA(multi-task) means mixing the training
dataset of three tasks and shuffling the order. LEGO-ABSA(separate) means that a task is trained with only one
dataset, like other baselines. Since the original paper of GAS is not implemented on Peng’s dataset, we reproduce
the results ourselves using the same experiment config. We highlight the best results and results with F1 gaps within
0.2
Table 4: Main results on ACSA, TASD, and ASQP tasks. LEGO-ABSA(multi-task) means mixing individual
training dataset and shuffling the order. We highlight the best results and results with F1 gaps within 0.2 in bold.
Task L14 R14 R15 R16 GM TTO TST task transfer ability
✕ ✕ ✓ ✕
ASTE 49.2 60.9 51.4 50.0 ✓ ✕ ✓ ✕
TASD - - 30.9 30.6 ✓ ✓ ✕ ✕
ASQP - - 25.8 24.5 ✓ ✓ ✓ ✓
Table 5: In-domain task transfer performance. In this Table 7: Factor analysis for task transferability, where
situation, basic tasks and advanced task are on the same GM is global mapping between sentinel token and el-
domain and corpus. ement, TTO is task transfer order that follows rule of
Task Prompt Assemble 2.4.1, and TST is use original
T5 sentinel token instead of custom token.
method Lap → Rest Rest → Lap
GAS-rule 32.4 33.7
LEGO-ABSA 53.9 44.7
element prompts, but replace <extra_id_x> (the
Table 6: Cross-domain task transfer performance on sentinel token used in T5 pre-training) with a cus-
ASTE task. We use dataset from Peng(Peng et al., 2020). tom new token. As shown in Table 7, only when all
Where rule method means that we get results by com- three conditions are met can the backbone obtain
bining (a, s) and (a, o) with same a. the task transferability.
Using the T5 Sentinel Token shows that down-
4.1 Factor Analysis of Transferability stream tasks can indeed reuse the unsupervised out-
put of T5 pre-training. The custom token cannot
We try to 1) increase the sentinel token id from 0 have the function of masking a consecutive span be-
in each basic task, which means no global map- cause it has not been pre-trained. The global map-
ping between sentinel token and element. 2) give a ping between sentinel token and element shows
global sentinel token id for each element but ran- that each sentinel token has a specific meaning af-
domly arrange elements’ order in the basic task. ter downstream task training. More importantly,
3) employ the global mapping and right order of the experiment result shows that a specific element
7008
task prompt Prediction
aspect: <extra_id_0> tech support
opinion: <extra_id_1> not fix
sentiment: <extra_id_2> negative
aspect: <extra_id_0>, opinion: <extra_id_1> tech support, not fix
aspect: <extra_id_0>, sentiment: <extra_id_2> tech support, negative
opinion: <extra_id_1>, sentiment: <extra_id_2> not fix, negative
Table 8: Lego split case for text "tech support would not fix the problem unless I bought your plan for $ 150 plus ."
(a) Decoder attention with AS type atten- (b) Decoder attention with OA type atten-
tion head tion head
prompt arrangement must be used to achieve task Some other attention heads learn associations
transfer and indirectly show that what the backbone between element o and a. As shown in Figure
learns is how to mix two or more task prompts. 3(b), the attention weight between <extra_id_1>
and <extra_id_0> is high, which means that the
Decoder Attention Visualization information of the opinion is used when the aspect
is generated via the <extra_id_1>. Such attention
We conjecture that LEGo-ABSA uses the ending head models the attention relationship between o
element prompt of the previous task as the begin- and a.
ning element prompt of the next task. To verify
In a word, combining information from multi-
this, we visualized two attention heads from the
ple attention heads with different functions, our
T5’s multiple attention heads in Figure 3. In this
framework can model advanced tasks through ba-
example, AOPE and E2E-ABSA are used as basic
sic tasks.
tasks, and ASTE is used as advanced task. Through
the analysis of decoder-attention visualization, we
LEGO split
have following findings.
Some attention heads learn associations between This section introduces how to make the framework
a and s. As shown in Figure 3(a), <extra_id_1> trained on advanced tasks capable of extracting any
nearly never attend to opinion term(good) and custom elements by changing the task prompt like
<extra_id_0>, and <extra_id_2> attend to <ex- an assembled Lego can be divided into parts of
tra_id_1> heavily where the association of aspect different sizes.
and sentiment is established. Such attention head We explored the ASTE task as the target advance
models the relation between a and s. task and traverse the full permutation of the three
7009
element prompts of a, o, and s. For each permu- (Volume 1: Long Papers), pages 340–350, Online.
tation of element prompts, we generate a dataset Association for Computational Linguistics.
with specific task prompt that assembled by ele- Shaowei Chen, Jie Liu, Yu Wang, Wenzheng Zhang,
ment prompts. Finally we mix and shuffle all the and Ziming Chi. 2020. Synchronous double-channel
datasets and train the framework with the setting recurrent network for aspect-opinion pair extraction.
In Proceedings of the 58th Annual Meeting of the As-
of multitask training.
sociation for Computational Linguistics, pages 6515–
As shown in Table 8, we can arbitrarily extract 6524.
any single element and any combination of ele-
Shaowei Chen, Yu Wang, Jie Liu, and Yuelin Wang.
ments by changing the task prompt. The framework
2021. Bidirectional machine reading comprehension
can perfectly control the output content through the for aspect sentiment triplet extraction. In Proceed-
task prompt. This result shows that the approach ings of the AAAI Conference on Artificial Intelligence,
proposed in this paper can make T5 regard the volume 35, pages 12666–12674.
task prompt as a combination of multiple element Zehui Dai, Cheng Peng, Huajie Chen, and Yadong Ding.
prompts, rather than a simple string. 2020. A multi-task incremental learning framework
with category name embedding for aspect-category
5 Conclusion sentiment analysis.
Lei Gao, Yulong Wang, Tongcun Liu, Jingyu Wang, Lei
In this paper, we propose a prompt-based genera- Zhang, and Jianxin Liao. 2021. Question-driven span
tive framework LEGO-ABSA for ABSA tasks that labeling model for aspect–opinion pair extraction. In
use T5 as the backbone, which can make full use Proceedings of the AAAI Conference on Artificial
of the information learned from the T5 unsuper- Intelligence, volume 35, pages 12875–12883.
vised training object through the formulation of Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel
task prompts we proposed. Dahlmeier. 2019. An interactive multi-task learning
LEGO-ABSA does not regard the prompt and network for end-to-end aspect-based sentiment anal-
ysis. In Proceedings of the 57th Annual Meeting of
the output text as a simple string but a combination the Association for Computational Linguistics, pages
of multiple elements to be extracted. It is mainly 504–515, Florence, Italy. Association for Computa-
used in multi-task training and task transfer sce- tional Linguistics.
narios. Extensive experiments on six ABSA tasks Ehsan Hosseini-Asl, Wenhao Liu, and Caiming Xiong.
verify the effectiveness of our framework and its 2022. A generative language model for few-shot
excellent transferability in task transfer scenarios. aspect-based sentiment analysis. arXiv preprint
There is still space for improvement in our frame- arXiv:2204.05356.
work, such as completing the combination extrac- Mengting Hu, Shiwan Zhao, Li Zhang, Keke Cai, Zhong
tion of multiple elements task through the learning Su, Renhong Cheng, and Xiaowei Shen. 2018. Can:
of single element tasks. Constrained attention networks for multi-aspect sen-
timent analysis.
6 Acknowledge Mike Lewis, Yinhan Liu, Naman Goyal, Marjan
Ghazvininejad, Abdelrahman Mohamed, Omer Levy,
Supported by the National Key Research and Devel- Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: De-
opment Program of China (No. 2020YFC0833301) noising sequence-to-sequence pre-training for natural
language generation, translation, and comprehension.
Xin Li, Lidong Bing, Piji Li, and Wai Lam. 2019a.
References A unified model for opinion target extraction and
target sentiment prediction. In Proceedings of the
Hongjie Cai, Yaofeng Tu, Xiangsheng Zhou, Jianfei
AAAI conference on artificial intelligence, volume 33,
Yu, and Rui Xia. 2020. Aspect-category based senti-
pages 6714–6721.
ment analysis with hierarchical graph convolutional
network. In Proceedings of the 28th International Xin Li, Lidong Bing, Wenxuan Zhang, and Wai Lam.
Conference on Computational Linguistics, pages 833– 2019b. Exploiting BERT for end-to-end aspect-based
843. sentiment analysis. In Proceedings of the 5th Work-
shop on Noisy User-generated Text (W-NUT 2019),
Hongjie Cai, Rui Xia, and Jianfei Yu. 2021. Aspect- pages 34–41.
category-opinion-sentiment quadruple extraction
with implicit aspects and opinions. In Proceedings Jian Liu, Zhiyang Teng, Leyang Cui, Hanmeng Liu, and
of the 59th Annual Meeting of the Association for Yue Zhang. 2021. Solving aspect category sentiment
Computational Linguistics and the 11th International analysis as a text generation task. arXiv preprint
Joint Conference on Natural Language Processing arXiv:2110.07310.
7010
Yukun Ma, Haiyun Peng, and Erik Cambria. 2018. Tar- transformer. Journal of Machine Learning Research,
geted aspect-based sentiment analysis via embedding 21(140):1–67.
commonsense knowledge into an attentive lstm. Pro-
ceedings of the AAAI Conference on Artificial Intelli- Kim Schouten and Flavius Frasincar. 2016. Survey on
gence, 32(1). aspect-level sentiment analysis. IEEE Transactions
on Knowledge and Data Engineering, 28(3):813–
Yue Mao, Yi Shen, Chao Yu, and Longjun Cai. 2021. A 830.
joint training dual-mrc framework for aspect based
sentiment analysis. Hai Wan, Yufei Yang, Jianfeng Du, Yanan Liu, Kunxun
Qi, and Jeff Z Pan. 2020. Target-aspect-sentiment
Bonan Min, Hayley Ross, Elior Sulem, Amir joint detection for aspect-based sentiment analysis.
Pouran Ben Veyseh, Thien Huu Nguyen, Oscar Sainz, In Proceedings of the AAAI Conference on Artificial
Eneko Agirre, Ilana Heinz, and Dan Roth. 2021. Re- Intelligence, volume 34, pages 9122–9129.
cent advances in natural language processing via
large pre-trained language models: A survey. arXiv Wenya Wang and Sinno Jialin Pan. 2018. Recursive
preprint arXiv:2111.01243. neural structural correspondence network for cross-
domain aspect and opinion co-extraction. In Proceed-
Ambreen Nazir, Yuan Rao, Lianwei Wu, and Ling Sun. ings of the 56th Annual Meeting of the Association for
2020. Issues and challenges of aspect-based sen- Computational Linguistics (Volume 1: Long Papers),
timent analysis: A comprehensive survey. IEEE pages 2171–2181, Melbourne, Australia. Association
Transactions on Affective Computing, pages 1–1. for Computational Linguistics.
Haiyun Peng, Lu Xu, Lidong Bing, Fei Huang, Wei Lu, Wenya Wang, Sinno Jialin Pan, Daniel Dahlmeier, and
and Luo Si. 2020. Knowing what, how and why: A Xiaokui Xiao. 2017. Coupled multi-layer attentions
near complete solution for aspect-based sentiment for co-extraction of aspect and opinion terms. In
analysis. In Proceedings of the AAAI Conference on Proceedings of the AAAI Conference on Artificial
Artificial Intelligence, volume 34, pages 8600–8607. Intelligence, volume 31.
Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Chao Wu, Qingyu Xiong, Hualing Yi, Yang Yu, Qiwu
Ion Androutsopoulos, Suresh Manandhar, Moham- Zhu, Min Gao, and Jie Chen. 2021. Multiple-element
mad AL-Smadi, Mahmoud Al-Ayyoub, Yanyan joint detection for aspect-based sentiment analysis.
Zhao, Bing Qin, Orphée De Clercq, Véronique Knowledge-Based Systems, 223:107073.
Hoste, Marianna Apidianaki, Xavier Tannier, Na-
talia Loukachevitch, Evgeniy Kotelnikov, Nuria Bel, Meixi Wu, Wenya Wang, and Sinno Jialin Pan. 2020a.
Salud María Jiménez-Zafra, and Gülşen Eryiğit. 2016. Deep Weighted MaxSAT for Aspect-based Opinion
SemEval-2016 task 5: Aspect based sentiment analy- Extraction. In Proceedings of the 2020 Conference
sis. In Proceedings of the 10th International Work- on Empirical Methods in Natural Language Process-
shop on Semantic Evaluation (SemEval-2016), pages ing (EMNLP), pages 5618–5628, Online. Association
19–30, San Diego, California. Association for Com- for Computational Linguistics.
putational Linguistics.
Zhen Wu, Chengcan Ying, Fei Zhao, Zhifang Fan,
Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Xinyu Dai, and Rui Xia. 2020b. Grid tagging scheme
Suresh Manandhar, and Ion Androutsopoulos. 2015. for aspect-oriented fine-grained opinion extraction.
SemEval-2015 task 12: Aspect based sentiment anal- In Findings of the Association for Computational
ysis. In Proceedings of the 9th International Work- Linguistics: EMNLP 2020, pages 2576–2585.
shop on Semantic Evaluation (SemEval 2015), pages
486–495, Denver, Colorado. Association for Compu- Lu Xu, Yew Ken Chia, and Lidong Bing. 2021. Learn-
tational Linguistics. ing span-level interactions for aspect sentiment triplet
extraction.
Maria Pontiki, Dimitris Galanis, John Pavlopoulos, Har-
ris Papageorgiou, Ion Androutsopoulos, and Suresh Lu Xu, Hao Li, Wei Lu, and Lidong Bing. 2020.
Manandhar. 2014. SemEval-2014 task 4: Aspect Position-aware tagging for aspect sentiment triplet
based sentiment analysis. In Proceedings of the 8th extraction. In Proceedings of the 2020 Conference on
International Workshop on Semantic Evaluation (Se- Empirical Methods in Natural Language Processing
mEval 2014), pages 27–35, Dublin, Ireland. Associa- (EMNLP), pages 2339–2349, Online. Association for
tion for Computational Linguistics. Computational Linguistics.
Alec Radford, Jeff Wu, Rewon Child, David Luan, Hang Yan, Junqi Dai, Tuo Ji, Xipeng Qiu, and Zheng
Dario Amodei, and Ilya Sutskever. 2019. Language Zhang. 2021. A unified generative framework for
models are unsupervised multitask learners. aspect-based sentiment analysis. In Proceedings
of the 59th Annual Meeting of the Association for
Colin Raffel, Noam Shazeer, Adam Roberts, Kather- Computational Linguistics and the 11th International
ine Lee, Sharan Narang, Michael Matena, Yanqi Joint Conference on Natural Language Processing
Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the (Volume 1: Long Papers), pages 2416–2429, Online.
limits of transfer learning with a unified text-to-text Association for Computational Linguistics.
7011
Chen Zhang, Qiuchi Li, Dawei Song, and Benyou Wang.
2020. A multi-task learning framework for opinion
triplet extraction. arXiv preprint arXiv:2010.01512.
Wenxuan Zhang, Yang Deng, Xin Li, Yifei Yuan, Li-
dong Bing, and Wai Lam. 2021a. Aspect sentiment
quad prediction as paraphrase generation. In Pro-
ceedings of the 2021 Conference on Empirical Meth-
ods in Natural Language Processing, pages 9209–
9219, Online and Punta Cana, Dominican Republic.
Association for Computational Linguistics.
Wenxuan Zhang, Xin Li, Yang Deng, Lidong Bing, and
Wai Lam. 2021b. Towards generative aspect-based
sentiment analysis. In Proceedings of the 59th An-
nual Meeting of the Association for Computational
Linguistics and the 11th International Joint Confer-
ence on Natural Language Processing (Volume 2:
Short Papers), pages 504–510.
7012