iT邦幫忙

2024 iThome 鐵人賽

DAY 8
0
AI/ ML & Data

30 Days of AI Research系列 第 8

[Day 8] Diversify Question Generation with Retrieval-Augmented Style Transfer

  • 分享至 

  • xImage
  •  

Paper link | Code link | EMNLP 2023

整體想法

這項新任務是透過一種定義了兩階段訓練過程(監督學習和強化學習)的方法來生成不同風格的問題。

這種方法確保了生成的問題既具有一致性又具備多樣性。

摘要

近期的研究主要集中在給定的段落或語義詞空間,以進行多樣化的內容規劃。

然而,外部知識在增強表達多樣性方面的潛力仍需更多的考量。

本研究針對檢索增強風格轉換(RAST),旨在利用外部知識生成使用多樣模板的問題,以提升表達的多樣性。

背景

問題生成(Question Generation, QG)是一項根據給定答案和基礎段落生成問題的任務。

image

然而,QG 系統面臨兩個主要問題:

  1. 不一致性:導致生成的問題與上下文或答案無關。
  2. 缺乏多樣性:QG 系統往往無法從相同的上下文和答案中生成多個不同的問題。

方法

RAST(檢索增強風格轉換)是一個框架,通過從外部集合中檢索問題風格模板,並利用這些模板來生成具有多樣表達的問題。

它包含三個主要組件:

  1. 基礎生成器(Vanilla Generator):負責初步的模板規劃。
  2. 風格檢索器(Style Retriever):根據初步模板篩選相關的風格模板。
  3. 基於風格的生成器(Style-Based Generator):穩健地結合風格模板與內部上下文來生成最終問題。

RAST中的風格檢索器和基於風格的生成器可以通過基於強化學習(RL)的方法聯合訓練。

這種RL方法直接最大化一致性和多樣性獎勵的平衡組合,有效解決了不一致性和缺乏多樣性的問題。

Overview

在問題生成(Question Generation, QG)中,給定一段文字 https://ithelp.ithome.com.tw/upload/images/20240808/20152821HjLib9sNDr.png 和答案 https://ithelp.ithome.com.tw/upload/images/20240808/201528218jHj5d9jQ4.png,需要生成問題 https://ithelp.ithome.com.tw/upload/images/20240808/20152821WsxXl74udV.png

在這裡,我們可以將 https://ithelp.ithome.com.tw/upload/images/20240808/20152821l7zT9CAK0J.png 視為輸入。

以往的研究針對 QG 任務建模 https://ithelp.ithome.com.tw/upload/images/20240808/201528217K5Pq1lVCC.png 如下:

https://ithelp.ithome.com.tw/upload/images/20240808/20152821f4IiJPksOK.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821QJPAHDzgVd.png 是問題風格模板的外部資料庫,https://ithelp.ithome.com.tw/upload/images/20240808/20152821XxLV5SOR9Z.png 是根據上下文 https://ithelp.ithome.com.tw/upload/images/20240808/20152821SchY4JEcK1.png 可以預測的初始問題模板。


image

系統會從外部知識中選擇與初始模板 https://ithelp.ithome.com.tw/upload/images/20240808/20152821Sn4Vakheaj.png 相似但不完全相同的風格模板 https://ithelp.ithome.com.tw/upload/images/20240808/20152821DgJhc9k54M.png。這些風格模板隨後用於生成問題。

在訓練過程中,給定上下文 https://ithelp.ithome.com.tw/upload/images/20240808/20152821LxduRKzjva.png 時,初始模板 https://ithelp.ithome.com.tw/upload/images/20240808/20152821XxLV5SOR9Z.png 是通過屏蔽上下文相關資訊,從真實問題 https://ithelp.ithome.com.tw/upload/images/20240808/20152821RghMuFRK15.png 中提取出來的。

在推理過程中,系統使用基礎問題生成模型 https://ithelp.ithome.com.tw/upload/images/20240808/20152821jrgW9XABZU.png 來生成最佳候選問題 https://ithelp.ithome.com.tw/upload/images/20240808/201528212mjSkhiIhY.png,然後從中提取出初始模板 https://ithelp.ithome.com.tw/upload/images/20240808/201528217O8TxdA9Wi.png

Question Style Templates

Masking

問題模板是通過屏蔽上下文相關資訊從收集到的問題中獲得的。

Duplication removal

通過測量成對的 Jaccard 相似度來移除近似重複的模板。

Retrieval-Augmented Style Transfer

Style Retrieval Model

查詢和樣本風格的編碼方式如下:

https://ithelp.ithome.com.tw/upload/images/20240808/20152821SQj64PFkxI.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821G8GPEzgehE.png 是兩個 encoder 的參數。

Style Transfer Model

他們使用 T5 作為風格轉換模型:

https://ithelp.ithome.com.tw/upload/images/20240808/201528213tZaWHxLLF.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821QCyWQocTte.png 表示問題的長度,https://ithelp.ithome.com.tw/upload/images/20240808/20152821cOxMyD30SQ.png 是模型參數。

Two-Stage Training

  1. 監督學習(Supervised Learning): 用於初始化風格轉換模型。

  2. 強化學習(Reinforcement Learning, RL): 應用於避免暴露偏差,並解決訓練和測試之間的評估差異。

Supervised Learning

由於在 https://ithelp.ithome.com.tw/upload/images/20240808/20152821Xb4YqB1rvA.png 上的原始訓練過程可能會遭遇過擬合,他們引入噪音到模板 https://ithelp.ithome.com.tw/upload/images/20240808/20152821h86ibO28Dj.png 以建立一個噪音模板 https://ithelp.ithome.com.tw/upload/images/20240808/20152821DwlUE5rOJM.png

  1. 用隨機實體替換 [MASK]。
  2. 添加一些名詞。
  3. 刪除 [MASK]。
  4. 隨機選擇另一個模板。

然後,他們使用 cross entropy loss 來訓練模型:

https://ithelp.ithome.com.tw/upload/images/20240808/20152821wc9WGRfbK4.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821MglhM7qzjI.png 代表預設答案標籤,https://ithelp.ithome.com.tw/upload/images/20240808/20152821LVRb9kjjXA.png 代表在時間步 https://ithelp.ithome.com.tw/upload/images/20240808/20152821SrjUpHj0my.png 的預測標籤。

Reinforcement Learning

RL for Style Retrieval and Transfer

在 RAST 中,系統被視為一個與由單詞和問題模板組成的外部環境互動的代理。綜合策略涉及選擇風格或預測下一個單詞。目標是最小化的獎勳函數給出如下:

https://ithelp.ithome.com.tw/upload/images/20240808/201528212MzBcyLEiI.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821d1O2u22hPO.png 代表從風格轉換模型 https://ithelp.ithome.com.tw/upload/images/20240808/20152821xxiZtewnnj.png 中抽樣的單詞,https://ithelp.ithome.com.tw/upload/images/20240808/20152821MtVWAoD3qF.png 表示從風格檢索模型 https://ithelp.ithome.com.tw/upload/images/20240808/20152821iT53NKXkKG.png 中抽樣的模板。

Reward Model

Consistency Reward

為了解決第一個問題,不一致性獎勳受到一篇關於問題回答的論文啟發。他們使用基於 T5 的生成性 QA 模型。不一致性獎勳的測量方法如下:

https://ithelp.ithome.com.tw/upload/images/20240808/20152821k4U2ZGgCKz.png

其中

https://ithelp.ithome.com.tw/upload/images/20240808/20152821ZMs4tSM3Ke.png

在這裡,https://ithelp.ithome.com.tw/upload/images/20240808/20152821u0y83arzQp.png 是答案的長度,https://ithelp.ithome.com.tw/upload/images/20240808/20152821IMo11MIIz7.png 是從 https://ithelp.ithome.com.tw/upload/images/20240808/20152821BZWsBY0Yvv.png 中抽樣的問題。

Diversity Reward

為了解決第二個問題,多樣性獎勳使用 Jaccard 相似度,其定義為:

https://ithelp.ithome.com.tw/upload/images/20240808/20152821tBmZ7urYek.png

最終的總獎勳計算如下:

https://ithelp.ithome.com.tw/upload/images/20240808/201528215arBnaQTvC.png

其中,https://ithelp.ithome.com.tw/upload/images/20240808/20152821OPxCrJB8aM.png 是平衡參數。

image

實驗

在這項研究中,使用了兩個公共數據集:

  1. SQuAD
  2. NewsQA

評估中使用了以下指標:

  1. Top-1 BLEU: 測量頂層生成問題的 BLEU 分數。
  2. Oracle BLEU: 測量所有生成問題中的最高 BLEU 分數。
  3. Pairwise BLEU: 測量生成問題對之間的 BLEU 分數,以評估多樣性。
  4. Overall BLEU: 計算為 https://ithelp.ithome.com.tw/upload/images/20240808/20152821AdbNq6D0zQ.png

注意,所有報告的 BLEU 分數均為 BLEU-4。

下圖顯示了在 NewsQA 和兩個 SQuAD 切分上不同技術的比較:

image

以下是三個 RAST 輸出示例,每個示例展示了不同類型的問題。在每個示例中,給定的答案在源上下文中用紅色突出顯示:

image


上一篇
[Day 7] Benchmarking Large Language Models in Retrieval-Augmented Generation
下一篇
[Day VIII] What is Vector Database?
系列文
30 Days of AI Research30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言