簡介
本文主要對2023ACL論文《Reasoning Implicit Sentiment with Chain-of-Thought Prompting》主要內(nèi)容進行介紹。
摘要
雖然情緒分析任務(wù)中通常根據(jù)輸入文本中的關(guān)鍵意見表達來確定給定目標的情緒極性,但在隱式情緒分析(ISA)中,意見線索通常是隱含或者模糊的。因此,檢測隱含情緒需要常識和多跳推理能力來推斷意見的潛在意圖。在思想鏈(CoT)思想的啟發(fā),本文引入了一個三跳推理(THOR)CoT框架來模擬ISA的模擬人類推理的過程。THOR設(shè)計了一個三步提示原則,逐步誘導隱含的方面、觀點,最后是情緒的極性。THOR+Flan-T5(11B)在監(jiān)督微調(diào)下將數(shù)據(jù)集最優(yōu)性能(SoTA)提高了6%以上。更引人注目的是,THOR+GPT3(175B)在零樣本設(shè)置下將SoTA提高了50%以上。
引言
情感分析(SA)旨在基于輸入文本檢測對給定目標的情緒極性。SA可分為顯性SA(ESA)和隱性SA(ISA),前者是當前的主流任務(wù),他的情感表達會明確出現(xiàn)在文本中。因此ISA更具挑戰(zhàn)性,因為在ISA中,輸入僅包含事實描述,沒有直接給出明確的意見表達。例如,給定一個文本“Try the tandoori salmon!”,由于沒有顯著的提示詞,幾乎所有現(xiàn)有的情緒分類都預測“tandoori salmon”為中性極性。人類很容易準確地確定情緒狀態(tài),因為我們總是掌握在文本后面隱含的真實意圖或觀點。因此,在沒有真正理解情緒是如何被激發(fā)的情況下,傳統(tǒng)的SA方法對ISA是無效的。
THOR
近期大模型的崛起,讓我們看到了機器對文本的理解有了新的高度。受到大模型中CoT的啟發(fā),文章提出了THOR( Three-hop Reasoning CoT framework),一個三段式的提問框架,能夠通過循循善誘地方法,很好的讓機器對隱形情感進行挖掘并預測,提升了ISA任務(wù)的性能。
如上圖所示:
Traditional Prompting,表明傳統(tǒng)的提示學習方法就是直接問模型,這句話中這個詞的情感極性是什么。
Three-hop Reasoning with CoT Prompting,則是本文提出基于大模型思維鏈(CoT)的方法,提出的三段式提問框架。首先詢問句子在講述方面詞的什么方面;其次,將回答整合后,將整合后的答案繼續(xù)問方面詞背后有什么隱含觀點;最后,再次整合前面的回答,最后問方面詞的情感極性是什么。
通過THOR我們可以看到,使用CoT的方法循循善誘模型得到的答案為positive是正確的,而傳統(tǒng)的提問時neutral是不正確的。
THOR框架具體設(shè)置如下:
假設(shè)我們要預測的句子為:“The new mobile phone can be just put in my pocket.”
其中要預測的方面詞為“The new mobile phone”
不妨設(shè)句子為X,設(shè)方面詞為t
以上述設(shè)置為例:
第一步,模型的輸入為 Given the sentence “X”, which specific aspect of t is possibly mentioned?
假設(shè)模型得到的結(jié)果為"The specific aspect of the new mobile phone mentioned in the sentence is the size or portability",記為A
第二步,模型的輸入為Given the sentence “X”, A(第一問結(jié)果). Based on the common sense, what is the implicit opinion towards the mentioned aspect of the new mobile phone, and why?
假設(shè)模型輸出為"Based on the mentioned aspect of size and portability, the sentence implies that the phone is small enough to fit in the speaker’s pocket. According
to common sense, the implicit opinion of speaker towards the portability is good, because the speaker is able to easily carry the phone with them by
placing it in their pocket, and find the phone to be convenient and easy to use."這個答案不妨記作O。
第三步,模型的輸入為Given the sentence “X”, A(第一問結(jié)果), O(第二問的結(jié)果). Based on such opinion, what is the sentiment polarity towards the new mobile phone?
此時假設(shè)模型的輸出為"The sentiment polarity towards the new mobile phone based on the given sentence is positive. The speaker finds the phone to be convenient and easy
to use, implying having a favorable view of the phone."
此時我們可以看到,模型得到了我們需要的預測結(jié)果為positive。
此時再來看這幅圖,應該是一目了然了吧。
THOR核心代碼
def prompt_for_aspect_inferring(context, target):
new_context = f'Given the sentence "{context}", '
prompt = new_context + f'which specific aspect of {target} is possibly mentioned?'
return new_context, prompt
def prompt_for_opinion_inferring(context, target, aspect_expr):
new_context = context + ' The mentioned aspect is about ' + aspect_expr + '.'
prompt = new_context + f' Based on the common sense, what is the implicit opinion towards the mentioned aspect of {target}, and why?'
return new_context, prompt
def prompt_for_polarity_inferring(context, target, opinion_expr):
new_context = context + f' The opinion towards the mentioned aspect of {target} is ' + opinion_expr + '.'
prompt = new_context + f' Based on such opinion, what is the sentiment polarity towards {target}?'
return new_context, prompt
實驗結(jié)果
文章實驗主要是基于Flan-T5大模型做的(因為這是為數(shù)不多開源且效果不錯的大模型)
這個結(jié)果是使用數(shù)據(jù)集進行監(jiān)督微調(diào)訓練后的結(jié)果,監(jiān)督微調(diào)大模型確實能夠使得模型有更好的表現(xiàn),但是隨著現(xiàn)在預訓練大模型越來越大,我們微調(diào)的成本也越來越大了。
這個結(jié)果是使用zero-shot零樣本得到的結(jié)果(不對大模型進行微調(diào),直接通過THOR框架或者直接prompt詢問結(jié)果,省去了微調(diào)大模型的時間和需要花費的資源,但是整體效果不如監(jiān)督微調(diào)的結(jié)果)。可以看得出使用THOR的方法比直接prompt效果好,并且當用GPT3作為大模型詢問時,效果明顯好很多,因為GPT3的參數(shù)量遠大于Flan-T5而且也并不開源,使用起來可能需要花點錢。這說明目前大模型對自然語言的理解缺失已經(jīng)有了質(zhì)的飛躍了。文章來源:http://www.zghlxwxcb.cn/news/detail-842369.html
總結(jié)
這篇文章使用大模型思維鏈的思路優(yōu)化了隱式情感分析中,隱含觀點等難以挖掘的難題,使得ISA任務(wù)能夠有較大性能的提升。隨著近些年prompt learning的興起,提示學習也逐漸成為NLP中的新范式,也讓我們逐漸發(fā)現(xiàn),訓練出的大模型有很強的能力等待我們?nèi)ネ诰?,就好像一個聰明的小孩,你教他一遍怎么做,他就能幫你把任務(wù)做的不錯了。文章來源地址http://www.zghlxwxcb.cn/news/detail-842369.html
到了這里,關(guān)于論文閱讀之Reasoning Implicit Sentiment with Chain-of-Thought Prompting的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!