ichou1のブログ

主に音声認識、時々、データ分析のことを書く

BERTメモ(BertSum)その1

「Document Summarization on CNN / Daily Mail」でSOTAを達成した「BertSum」を試してみる。

論文

https://arxiv.org/pdf/1903.10318.pdf

モデルの構成としては、Bertモデルの後ろに、レイヤを追加する。
以下は、「Classifer」モデルのサマリ。

Summarizer(
  (bert): Bert(
    (model): BertModel(
      (embeddings): BertEmbeddings(...)
      (encoder): BertEncoder(
        (layer): ModuleList(
          (0): BertLayer(
            (attention): BertAttention(...)
            (intermediate): BertIntermediate(...)
            (output): BertOutput(...)
          )
          ...
          (11): BertLayer(
            (attention): BertAttention(...)
            (intermediate): BertIntermediate(...)
            (output): BertOutput(
              (dense): Linear(in_features=3072, out_features=768, bias=True)
              (LayerNorm): BertLayerNorm()
              (dropout): Dropout(p=0.1, inplace=False)
            )
          )
        )
      )
      (pooler): BertPooler(
        (dense): Linear(in_features=768, out_features=768, bias=True)
        (activation): Tanh()
      )
    )  # end of BertModel
  )    # end of Bert 
  (encoder): Classifier(
    (linear1): Linear(in_features=768, out_features=1, bias=True)
    (sigmoid): Sigmoid()
  )
)



3つ以上の文章に対応するため、"Interval Segment Embeddings"を使用する。


https://user-images.githubusercontent.com/49365155/58623978-bb2ceb80-8301-11e9-9368-34064a02b0c2.png



レーニングの流れとしては、例えば、データセットの一つがあったとして、
Gary Gardner will return to Aston Villa to be assessed by Tim Sherwood but he refuses to rule out a return to Nottingham Forest | Daily Mail Online

この例では以下の「highlight」が正解(参照要約)に該当する。

  • Gary Gardner confirms he'll report to Aston Villa for pre-season training
  • The 22-year-old is out on loan at Championship side Nottingham Forest
  • Tim Sherwood is keen to asses Gardner ahead of next season
  • The midfielder would prefer a move back to Forest if Villa doesn't wok out

本文中の各文章ごとに、参照要約に対するスコアを計算して、スコアが高い文章を「抽出」(Extract)するように学習する。
(「抽象化」(Abstract)はしていない)