BERTメモ(BertSum)その1
「Document Summarization on CNN / Daily Mail」でSOTAを達成した「BertSum」を試してみる。
github
GitHub - nlpyang/BertSum: Code for paper Fine-tune BERT for Extractive Summarization
実装は「PyTorch」を使用している。
論文
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"を使用する。
トレーニングの流れとしては、例えば、データセットの一つがあったとして、
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)はしていない)