ℎ!"# ℎ!"$ ℎ!"% ℎ!"& This is an apple This is an apple 9 これは,フィルタ幅を単語 数にして,畳み込みなどの 処理をAttentionに置き換え たCNNの発展系と考えるこ ともできる CNNの例 Self-attentionレイヤ Feed-Forward Networkなど This is an apple Ashish Vaswani, et al., "Attention is all you need.”, NIPS2017.
"Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned.”, ACL 2019. 12 From “The Story of Heads”, Head Functions section, Elena Voita, https://lena-voita.github.io/posts/acl19_heads.html (2019) 低頻度語 統語情報 位置情報 各headが捉えている⾔語現象例[1] (捉えている情報が解釈できないheadもある) ⼀つのSelf-Attentionレイヤのみ(Single-head attention)を⽤いた場合 L各単語情報の重み付け和により情報を損失してしまう
14 (※)学習時に⾏った浮動⼩数点演算の回数を推定したもの.少ないほど良い Transformer This is an apple (S (NP This) (VP (V is) (NP (Det an) (N apple)))) Ashish Vaswani, et al., "Attention is all you need.”, NIPS2017.
⻑距離の依存関係を考慮可能 + Positional encodingにより,各トークンの位置情報を保持 性能・汎⽤性ともに優れたモデルアーキテクチャで 注⽬を浴び,その後⽣成系のタスクのスタンダードになってきている 機械翻訳および句構造解析タスクを⽤いた実験で良い性能 15 Ashish Vaswani, et al., "Attention is all you need.”, NIPS2017.
Tree transformer(⽊構造を導出するように制約をかけて改善)[2] (4) モデルアーキテクチャの最適化 è Evolved transformer(NASを適⽤し,最適なアーキテクチャを探索)[3] など… (2)〜(4)のように,Transformer内部の アーキテクチャの改良も⾏われてきている 17 [1]Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. "Reformer: The Efficient Transformer." ICLR2020. [2]Yau-Shian Wang, Hung-Yi Lee, and Yun-Nung Chen. "Tree Transformer: Integrating Tree Structures into Self-Attention.”, EMNLP2019. [3]David R. So, Chen Liang, and Quoc V. Le. "The evolved transformer." ICML2019.
⾔語の階層性を捉えられない è Tree transformer(⽊構造を導出するように制約をかけて改善)[2] (5) アーキテクチャが⼈⼿設計 è Evolved transformer(NASを適⽤し,最適なアーキテクチャを探索)[3] など… ↑ NeurIPS2019では(1)に関する発表が⾒られた ↑ 18 [1]Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. "Reformer: The Efficient Transformer." ICLR2020. [2]Yau-Shian Wang, Hung-Yi Lee, and Yun-Nung Chen. "Tree Transformer: Integrating Tree Structures into Self-Attention.”, EMNLP2019. [3]David R. So, Chen Liang, and Quoc V. Le. "The evolved transformer." ICML2019.
representation 問題点 ⽅向性① タスクに特化した アーキテクチャの導⼊ 近年では,機械翻訳, ⽂書要約[1] , 質問応答[2] などのモデルに組み込まれている NeurIPS2019の発表では機械翻訳をベンチマークに適⽤したものが⾒られた [1]Elozino Egonmwan, and Yllias Chali. "Transformer-based Model for Single Documents Neural Summarization." Proceedings of the 3rd Workshop on Neural Generation and Translation. 2019. [2]Taihua Shao, et al. "Transformer-based neural network for answer selection in question answering." IEEE Access 7 (2019): 26146-26156. Transformer ?? 19
Masked LMの精緻化 XLNet [Zhilin Yang et al.] 37 Zhilin Yang, et al. "Xlnet: Generalized autoregressive pretraining for language understanding." NeurIPS2019. [MASK] dog yard [MASK] ①単語間の独⽴性を仮定 [MASK]トークン間の 依存関係を考慮できない I have a [MASK] . dog
Zhilin Yang, et al. "Xlnet: Generalized autoregressive pretraining for language understanding." NeurIPS2019. 解決⽅法:⾃⼰回帰モデルに変更 J単語間の同時確率を考慮可能 J[MASK]トークン不要 (York|New) " # $ New York is a " ℎ! York ! (is|New, York) " # $ New York is a ℎ" is ! a New, York, is ) " # $ New York is a ℎ# ! # $ … … … しかし… L双⽅向の⽂脈を考慮できない(BERTの良さ) a 単⽅向(左)の ⽂脈のみ
çXLNet ⼊⼒系列の順番はそのままで,トークンの予測順序を⼊れ替え(Permutation) 20タスクでBERTを超え,18タスクでSOTAを達成 簡略化したイメージ図(実際はTwo-stream attentionなどのテクニックが組み込まれるのでもっと複雑) 39 全ての可能な予測順序を考慮することで双⽅向の⽂脈を組み込める Zhilin Yang, et al. “Xlnet: Generalized autoregressive pretraining for language understanding.” NeurIPS2019, slide p.7を参考に具体例で書き直したもの Zhilin Yang, et al. "Xlnet: Generalized autoregressive pretraining for language understanding." NeurIPS2019. (⼊⼒系列)New, York, is, a, city (予測順序)4à2à1à3à0 (city, is, York, a, New) à J⾃⼰回帰モデルとBERTの良いところどりをしたモデル
⾔語理解・⽣成の両⽴ = UniLM コアアイデア:Self-attention Mask(参照できるアテンションを制限できる)の位置を 変更することで⼀つのモデルで 三つの⾔語モデリングタスクを学習できる! Transformerのパラメータは共有 Fine-tuning時に どの情報を使うかをmaskで変更 (例)⾔語⽣成タスクなら Seq2seq⾔語モデルとしてUniLMを使う “は”から”りんご”には アクセスできない. 後ろのトークンは参照できない à 単⽅向になっている! Left-to-rightの場合 41 Li Dong, et al. "Unified language model pre-training for natural language understanding and generation." NeurIPS 2019. From "Unified language model pre-training for natural language understanding and generation.”, Li Dong, et al., NeurIPS2019, Figure 1(2019)
[1]Qian Yang, et al. "Ouroboros: On Accelerating Training of Transformer-Based Language Models.”, NeurIPS2019. [2]Ofir Zafrir, et al. "Q8bert: Quantized 8bit bert.", NeurIPS2019. [3]Xindian Ma, et al. "A tensorized transformer for language modeling.", NeurIPS2019. [4]Victor Sanh, et al. "DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter.", NeurIPS2019. 並列化・量⼦化 推論のみに適⽤可能 圧縮・蒸留 今回はこの中からQ8BERTとDistilBERTを紹介 49
Student Probabilities One-hot This is an [MASK] which I bought at a supermarket DistilBERTのアーキテクチャ - Transformerのレイヤー数を半減 - ⼊⼒情報も⼀部削除 損失②Masked LM loss 事前学習時の損失 52 ① ③ 損失①Distillation loss ⼀般的な蒸留の際の損失 損失③Cosine loss BERTとDistilBERTの 隠れ状態をアラインメント Victor Sanh, et al. "DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter.", NeurIPS2019. Workshop
al., “On the Downstream Performance of Compressed Word Embeddings”, NeurIPS2019 56 有効なアプローチの⼀つである分散表現の圧縮 新しい評価指標としてEigenspace overlap score(EOS)を提案 論⽂内でEOSに関して以下の三つを⽰した - 理論的にダウンストリームタスクでの性能と直接関係する - 経験的にダウンストリームタスクでの性能と強い相関を持つ - 学習しなくても良い精度を⽰す圧縮された分散表現を識別可能 圧縮された分散表現の質を測るための既存の指標では, ダウンストリームタスクにおけるパフォーマンスとの 相関が弱い.つまり適切に評価できていない 結局どの圧縮⼿法が良いのか 実際に学習してみないとわからない From “On the Downstream Performance of Compressed Word Embeddings”, Avner May et al., NeurIPS2019 poster(2019)
予測 分散表現の 左特異ベクトル 分散表現の左特異ベクトルが予測結果を決定(論⽂中で数学的議論がされている) 57 圧縮前・後の分散表現の 左特異ベクトルの類似度を測る ことでダウンストリームタスク での性能と直接的に関連づける Avner May et al., “On the Downstream Performance of Compressed Word Embeddings”, NeurIPS2019 From “On the Downstream Performance of Compressed Word Embeddings”, Avner May et al., NeurIPS2019 poster(2019) From “On the Downstream Performance of Compressed Word Embeddings”, Avner May et al., NeurIPS2019 poster(2019) Eigenspace overlap score(EOS)の直感的なアイデア 注⽬したポイント
強 EOSは,既存の評価指標に⽐べてダウンストリームタスクの 性能との相関が強い評価指標であることを確認 提案指標 既存指標 PIP loss, Spectral approximation error(∆, ∆$%& ) Avner May et al., “On the Downstream Performance of Compressed Word Embeddings”, NeurIPS2019 From “On the Downstream Performance of Compressed Word Embeddings”, Avner May et al., NeurIPS2019, Figure 14(2019) 各圧縮の質の評価値とダウンストリームタスク(⾃然⾔語推論 MNLI)での性能
機械翻訳などのモデルで予測層として⽤いられるSoftmaxレイヤ Ning Miao et al., "Kernelized Bayesian Softmax for Text Generation.”, NeurIPS2019. 59 最終出⼒ 埋め込み⾏列 Lしかし実応⽤上はそうとも限らない This is an これはりんごです ⼊⼒情報 既に出⼒した系列 ⽂脈ベクトルℎ1 Apple Car Example Pear ⼀番近い! 内積計算による分散表現の マッチングにより出⼒を決定 Orange 「これはりんごです è This is an 」 の翻訳過程の例 ? ⾔語のバイアス
新しいアプローチ KerBS(Kernelized Bayesian softmax)を提案 外れ値 60 (1)単語の多義性 (左図) (2)外れ値 (左図) (3)異なる分散 (右図) 「監視する(動詞)」と「モニター(名詞)」 ⼆⼤クラスタがあるが単語ベクトル☆は⼀点 Christian science monitorという新聞紙名 単語ベクトル☆が引っ張られてしまう CarとVehicleは異なる分散を持つにも 関わらず単語ベクトル☆はほぼ同じに シンプルなSoftmaxでは扱えない三つの事象 From "Kernelized Bayesian Softmax for Text Generation.”, Ning Miao, et al., NeurIPS2019.,Figure 1(b,c) (2019) Ning Miao et al., "Kernelized Bayesian Softmax for Text Generation.”, NeurIPS2019.
各単語の語義数はわからないため,合計語義数の みを⼊⼒し,それぞれの単語に割り当て KerBSが⽣成タスクの精度を ブーストさせられることを⽰した (例) TransformerにKerBSを組み込み, 機械翻訳タスクにおける性能(BLEU-4) が1.29向上 BLEU-n:正解データとのn-gramマッチ率 予測層の表現⼒を⾼めるために KerBS[Ning Miao et al.] 61 Word embeddings Sense embeddings From "Kernelized Bayesian Softmax for Text Generation.”, Ning Miao, et al., NeurIPS2019, poster Figure 2(左上), Figure 2(右上), Figure 3(左下) (2019) Ning Miao et al., "Kernelized Bayesian Softmax for Text Generation.”, NeurIPS2019.
et al. “Semantics derived automatically from language corpora contain human-like biases.” Science. 356. 183-186. Word Embedding Association Testsを⽤いてバイアスの強さを検証 ⾔語におけるバイアスの問題 Yi Chern Tan, and L. Elisa Celis. "Assessing social and intersectional biases in contextualized word representations." NeurIPS2019. 63 男性名: Paul ⼥性名:Emily Attributes ⼥性が多い職業:Nurse 男性が多い職業:Doctor 関連 弱 関連 弱 ConceptsとAttributesの組み合わせを 逆にしたときにその単語の関連度の 差を表すエフェクトサイズが ⼤きいほどバイアスが顕著である 関連 強 本研究の貢献 ①WEATsを⽂脈を考慮した単語表現にも適⽤できるように拡張 - 既存のテストでは⽂表現のみを⽤いていたが,今回は単語表現も追加 ②既存のConcept-attributesリストを活⽤し,テストに新しいAttributesを導⼊ ③事前学習に⽤いられるコーパスにおけるバイアスも分析 - 男性代名詞(heなど)が⼥性代名詞(sheなど)に⽐べて⼀貫して出現回数が多い - ニュートラルな代名詞(theyなど)ですら男性の多い職業名と⼀緒に使われることが多い
Elisa Celis. "Assessing social and intersectional biases in contextualized word representations." NeurIPS2019. 男性,⼥性 キャリア,家庭 ?? ヨーロッパ系 or アフリカ系 アメリカ⼈ 有能,無能 ?? 男性 or ⼥性 の ヨーロッパ系 or アフリカ系 アメリカ⼈ 感じが良い,悪い ?? ①ジェンダー ②⼈種 ③交差 ジェンダー + ⼈種 Concepts(例) Attributes (例) 以下の三つのバイアスをテスト From "Assessing social and intersectional biases in contextualized word representations.”, Yi Chern Tan, and L. Elisa Celis., NeurIPS2019, Table 2 (2019)