SlideShare a Scribd company logo
Sharp Nearby, Fuzzy Far Away:
How Neural Language Models Use Context
Urvashi Khandelwal, He He, Peng Qi, Dan Jurafsky
(Stanford University)
M2 山岸駿秀 @ ACL2018読み会
Introduction
● n-gram Language Modelと比較して、Neural Language Model
(NLM)は長距離文脈を使えるようになったとされる
● 実際に長距離文脈を捉えられているのかをAblation Test
● Neural Cache ModelはLMにどう影響するかを調査
読んだ理由
● 文脈の知見が欲しかったから
● “We propose a novel architecture …” に疲れたから
2
言語モデルの復習と今回の入力例
● 以下の確率を計算
● Negative Log Likelihoodを計算
● Perplexityで評価
... the company reported a loss after
taxation and minority interests of NUM
million irish borrowings under the
short-term parts of a credit agreement
</s> berlitz which is based in
princeton n.j. provides language
instruction and translation services
through more than NUM language centers
in NUM countries </s> in the past five
years more sim has set a fresh target
of $ NUM a share by the end of </s>
reaching that goal says robert t. UNK
applied 's chief financial officer than
NUM NUM of its sales have been outside
the u.s. </s> macmillan has owned
berlitz since NUM </s> in the first six
3
実験設定
● Corpus: PennTreeBankとWikitext-2
● モデルは普通のNLM
○ Dropoutを時間方向にも適用
○ Random seedを変えて3つ用意
→ 平均値を報告
● 学習時は対象文の前の文を全て使用
● Devで評価(Testの特徴を調べるのは気が引けたらしい) 4
How much context is used?
● 実験1: LSTMは何単語覚えられるのか?
○ δ-function: Test dataの変更方法を指示
● effective context sizeを調べる
○ Perplexityが収束する長さ(全て使ったときのPerplexity + 1%くらい)
● 評価はLossかPerplexityの変化率(以降全てこれ)
○ n単語消去したら、文長-n単語分のLossを測定
5
結果1: 文長とHyperparameter(右: PTB)
● PTBで150単語、Wikiで250単語あたりが限界
● Hyperparameterは性能に影響するが、記憶力には無関係
6
結果2: 単語のクラスごとのLoss(右: Wiki)
● Infrequent words(Trainで出現数800回以下)は長距離文脈が必要
● Function words(前置詞と冠詞)は周辺単語だけでいい
7
Nearby vs. long-range context
● LSTMはだいたい200単語くらい覚えられる
→ 場所による特徴はあるのか?
● 文脈の途中(長さは span = (s1, s2] で管理 )を変化させる
○ ρはshuffleかreverse
● 文長は300単語で固定
8
結果3(右: Wiki)
a. s2 = s1 + 20のとき: 近い文脈は語順が重要
b. s2 = nのとき: 離れた文脈は「出現したこと」が重要、
違う単語列(語順は整っている)で置換すると悪い
9
Types of words and the region of context
● 「単語が出現したこと」が重要なら、function wordsはいらない?
● fPOS
(y, span): span中でPOSがyの単語を除去
● 同数の単語をrandomに削除する実験もした
10
結果4: 機能語/内容語の削除(左:PTB 右:Wiki)
● 近くのContent wordsは絶対に必要
● 20単語くらい離れるとFunction wordsの影響が小さい
● 遠くの単語は意味だけを大まかに覚えているのか?
11
Can LSTMs copy words without caches?
● Neural Language GenerationではCopy Mechanismが使われる
○ AttentionとかCopyNetとかCacheとか
● 「200単語も記憶できるならCopy Mechanismいらないのでは?」
以下の場合分けをして実験
● 文脈の距離: “nearby” ≦ 50 < “long-range”
● Copyすると解になる単語がどこにあるか → これを消す
○ Cnear: “nearby”にある
○ Cfar: “long-range”にある
○ Cnone: どこにもない
12
結果5: Cを消した(左:PTB 右:Wiki)
● Cfarを消してもそこまで悪くならない → 大まかな意味を学習?
● Cnearを消してはいけない → 近くの単語をCopyする能力がある?
● 長距離の文脈を消すとCnoneの性能に悪影響
13
結果6: 除去の代わりに置換(左:PTB 右:Wiki)
● “Similar”: 同程度のfrequencyかつ同じPOSの単語
● 近いところは表層が同じであることが重要
● 遠いところはCfarを消しても分布仮説的なもので予測可能?
14
How does the cache help?
● Neural Cache Model [Grave+, ICLR2017]
○ hi
はそれまでのhidden states
○ 各単語に対してPcacheを計算し、Plm + Pcacheを生成確率とする
● 300単語以上使う(Document lengthの平均)
○ PTB: 500単語
○ Wiki: 3875単語
● Cache Modelを基準としたNLMのPPLの増加率で評価
15
結果7: Cacheの影響(左: PTB 右: Wiki)
● 文脈に出てきた単語はCopyされていそう
● 文脈に出てきていない単語を出すことには向いていない
● LSTMとCacheでできることが違う → 補完できているのでは?
16
出てきていれば生成できる
17
まとめ
● LSTMを使ったNeural Language Modelの性能を調べた
● 以下のことがわかった
○ LSTMは200単語くらい覚えられる
○ Hyperparameterは性能を変化させるが、記憶力には影響がない
○ 近くの単語は語順が重要、遠くの単語は存在することが重要
○ Cacheを使うと遠くの単語を使えるようになる
● “この結果はdata-drivenかもしれないので要追試”
○ “一応PTBとWikiでデータの多様性を持たせたつもり”
18
感想
● 読みやすい & 謙虚な文体 & マジメな実験で好感が持てる
● 語順が自由な言語では違いがありそう
● 学習の設定がちょっと特殊
○ 普通、無限に文脈を使える設定で学習しないのでは
○ 長距離文脈が現れる設定と1文しかこない設定では結果が変わりそう
● 200単語以上覚えておく必要がないだけなのか覚えられないのか
○ 平均単語文長20単語だから、10文くらい
○ LSTMは原理的には全部覚えられるはず……
● 何単語消したのかとか、そういうデータがほしかった
19

More Related Content

What's hot

RNNLM
RNNLMRNNLM
Ism npblm-20120315
Ism npblm-20120315Ism npblm-20120315
Ism npblm-20120315隆浩 安
 
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
Hayahide Yamagishi
 
2016word embbed
2016word embbed2016word embbed
2016word embbed
Shin Asakawa
 
TensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vecTensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vec
Shin Asakawa
 
Deep neural models of semantic shift
Deep neural models of semantic shiftDeep neural models of semantic shift
Deep neural models of semantic shift
Makoto Takenaka
 
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
Naoaki Okazaki
 
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
Makoto Takenaka
 
All-but-the-Top: Simple and Effective Postprocessing for Word Representations
All-but-the-Top: Simple and Effective Postprocessing for Word RepresentationsAll-but-the-Top: Simple and Effective Postprocessing for Word Representations
All-but-the-Top: Simple and Effective Postprocessing for Word Representations
Makoto Takenaka
 
文献紹介:SemEval-2012 Task 1: English Lexical Simplification
文献紹介:SemEval-2012 Task 1: English Lexical Simplification文献紹介:SemEval-2012 Task 1: English Lexical Simplification
文献紹介:SemEval-2012 Task 1: English Lexical Simplification
Tomoyuki Kajiwara
 
Character word lstm language models
Character word lstm language modelsCharacter word lstm language models
Character word lstm language models
浩気 西山
 
G社のNMT論文を読んでみた
G社のNMT論文を読んでみたG社のNMT論文を読んでみた
G社のNMT論文を読んでみた
Toshiaki Nakazawa
 
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
Deep Learning JP
 
鬱くしい日本語のための形態素解析入門
鬱くしい日本語のための形態素解析入門鬱くしい日本語のための形態素解析入門
鬱くしい日本語のための形態素解析入門Hiroyoshi Komatsu
 
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築役所からの公的文書に対する「やさしい日本語」への変換システムへの構築
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築長岡技術科学大学 自然言語処理研究室
 
Reusing weights in subword aware neural language models
Reusing weights in subword aware neural language modelsReusing weights in subword aware neural language models
Reusing weights in subword aware neural language models
広樹 本間
 

What's hot (17)

RNNLM
RNNLMRNNLM
RNNLM
 
Ism npblm-20120315
Ism npblm-20120315Ism npblm-20120315
Ism npblm-20120315
 
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
[ACL2016] Achieving Open Vocabulary Neural Machine Translation with Hybrid Wo...
 
2016word embbed
2016word embbed2016word embbed
2016word embbed
 
TensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vecTensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vec
 
Deep neural models of semantic shift
Deep neural models of semantic shiftDeep neural models of semantic shift
Deep neural models of semantic shift
 
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
Pennington, Socher, and Manning. (2014) GloVe: Global vectors for word repres...
 
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
[NeurIPS2018読み会@PFN] On the Dimensionality of Word Embedding
 
All-but-the-Top: Simple and Effective Postprocessing for Word Representations
All-but-the-Top: Simple and Effective Postprocessing for Word RepresentationsAll-but-the-Top: Simple and Effective Postprocessing for Word Representations
All-but-the-Top: Simple and Effective Postprocessing for Word Representations
 
文献紹介:SemEval-2012 Task 1: English Lexical Simplification
文献紹介:SemEval-2012 Task 1: English Lexical Simplification文献紹介:SemEval-2012 Task 1: English Lexical Simplification
文献紹介:SemEval-2012 Task 1: English Lexical Simplification
 
Character word lstm language models
Character word lstm language modelsCharacter word lstm language models
Character word lstm language models
 
G社のNMT論文を読んでみた
G社のNMT論文を読んでみたG社のNMT論文を読んでみた
G社のNMT論文を読んでみた
 
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
[DL輪読会]BERT: Pre-training of Deep Bidirectional Transformers for Language Und...
 
「やさしい日本語」変換システムの試作
「やさしい日本語」変換システムの試作「やさしい日本語」変換システムの試作
「やさしい日本語」変換システムの試作
 
鬱くしい日本語のための形態素解析入門
鬱くしい日本語のための形態素解析入門鬱くしい日本語のための形態素解析入門
鬱くしい日本語のための形態素解析入門
 
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築役所からの公的文書に対する「やさしい日本語」への変換システムへの構築
役所からの公的文書に対する「やさしい日本語」への変換システムへの構築
 
Reusing weights in subword aware neural language models
Reusing weights in subword aware neural language modelsReusing weights in subword aware neural language models
Reusing weights in subword aware neural language models
 

Similar to [ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use Context

A scalable probablistic classifier for language modeling: ACL 2011 読み会
A scalable probablistic classifier for language modeling: ACL 2011 読み会A scalable probablistic classifier for language modeling: ACL 2011 読み会
A scalable probablistic classifier for language modeling: ACL 2011 読み会正志 坪坂
 
Extract and edit
Extract and editExtract and edit
Extract and edit
禎晃 山崎
 
Chainer with natural language processing hands on
Chainer with natural language processing hands onChainer with natural language processing hands on
Chainer with natural language processing hands on
Ogushi Masaya
 
形態素解析の過去・現在・未来
形態素解析の過去・現在・未来形態素解析の過去・現在・未来
形態素解析の過去・現在・未来Preferred Networks
 
Paper: seq2seq 20190320
Paper: seq2seq 20190320Paper: seq2seq 20190320
Paper: seq2seq 20190320
Yusuke Fujimoto
 
Acl yomikai, 1016, 20110903
Acl yomikai, 1016,  20110903Acl yomikai, 1016,  20110903
Acl yomikai, 1016, 20110903
Yo Ehara
 
言語資源と付き合う
言語資源と付き合う言語資源と付き合う
言語資源と付き合うYuya Unno
 
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
Shohei Okada
 
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
Shirou Maruyama
 
一般化線形混合モデル入門の入門
一般化線形混合モデル入門の入門一般化線形混合モデル入門の入門
一般化線形混合モデル入門の入門
Yu Tamura
 
Recurrent Neural Networks
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural Networks
Seiya Tokui
 
Jacet2014ykondo_final
Jacet2014ykondo_finalJacet2014ykondo_final
Jacet2014ykondo_final
早稲田大学
 
Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介
Masayoshi Kondo
 
Generalized data augmentation for low resource translation
Generalized data augmentation for low resource translationGeneralized data augmentation for low resource translation
Generalized data augmentation for low resource translation
platinum-vallay
 
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
Kosuke Futamata
 
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
Deep Learning JP
 
第8回Language and Robotics研究会20221010_AkiraTaniguchi
第8回Language and Robotics研究会20221010_AkiraTaniguchi第8回Language and Robotics研究会20221010_AkiraTaniguchi
第8回Language and Robotics研究会20221010_AkiraTaniguchi
Akira Taniguchi
 
2015 08 survey
2015 08 survey2015 08 survey
2015 08 survey
marujirou
 
読解支援@2015 06-05
読解支援@2015 06-05読解支援@2015 06-05
読解支援@2015 06-05
sekizawayuuki
 

Similar to [ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use Context (20)

A scalable probablistic classifier for language modeling: ACL 2011 読み会
A scalable probablistic classifier for language modeling: ACL 2011 読み会A scalable probablistic classifier for language modeling: ACL 2011 読み会
A scalable probablistic classifier for language modeling: ACL 2011 読み会
 
Extract and edit
Extract and editExtract and edit
Extract and edit
 
Chainer with natural language processing hands on
Chainer with natural language processing hands onChainer with natural language processing hands on
Chainer with natural language processing hands on
 
形態素解析の過去・現在・未来
形態素解析の過去・現在・未来形態素解析の過去・現在・未来
形態素解析の過去・現在・未来
 
作文入門
作文入門作文入門
作文入門
 
Paper: seq2seq 20190320
Paper: seq2seq 20190320Paper: seq2seq 20190320
Paper: seq2seq 20190320
 
Acl yomikai, 1016, 20110903
Acl yomikai, 1016,  20110903Acl yomikai, 1016,  20110903
Acl yomikai, 1016, 20110903
 
言語資源と付き合う
言語資源と付き合う言語資源と付き合う
言語資源と付き合う
 
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
文献紹介:Recursive Deep Models for Semantic Compositionality Over a Sentiment Tre...
 
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
文法圧縮入門:超高速テキスト処理のためのデータ圧縮(NLP2014チュートリアル)
 
一般化線形混合モデル入門の入門
一般化線形混合モデル入門の入門一般化線形混合モデル入門の入門
一般化線形混合モデル入門の入門
 
Recurrent Neural Networks
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural Networks
 
Jacet2014ykondo_final
Jacet2014ykondo_finalJacet2014ykondo_final
Jacet2014ykondo_final
 
Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介
 
Generalized data augmentation for low resource translation
Generalized data augmentation for low resource translationGeneralized data augmentation for low resource translation
Generalized data augmentation for low resource translation
 
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
Neural G2Pの最新動向 SIGMORPHON及び関連緩急の紹介
 
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
[DL輪読会]Discriminative Learning for Monaural Speech Separation Using Deep Embe...
 
第8回Language and Robotics研究会20221010_AkiraTaniguchi
第8回Language and Robotics研究会20221010_AkiraTaniguchi第8回Language and Robotics研究会20221010_AkiraTaniguchi
第8回Language and Robotics研究会20221010_AkiraTaniguchi
 
2015 08 survey
2015 08 survey2015 08 survey
2015 08 survey
 
読解支援@2015 06-05
読解支援@2015 06-05読解支援@2015 06-05
読解支援@2015 06-05
 

More from Hayahide Yamagishi

[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
Hayahide Yamagishi
 
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
Hayahide Yamagishi
 
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
Hayahide Yamagishi
 
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
Hayahide Yamagishi
 
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
Hayahide Yamagishi
 
[ML論文読み会資料] Teaching Machines to Read and Comprehend
[ML論文読み会資料] Teaching Machines to Read and Comprehend[ML論文読み会資料] Teaching Machines to Read and Comprehend
[ML論文読み会資料] Teaching Machines to Read and Comprehend
Hayahide Yamagishi
 
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
Hayahide Yamagishi
 
[ML論文読み会資料] Training RNNs as Fast as CNNs
[ML論文読み会資料] Training RNNs as Fast as CNNs[ML論文読み会資料] Training RNNs as Fast as CNNs
[ML論文読み会資料] Training RNNs as Fast as CNNs
Hayahide Yamagishi
 
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
Hayahide Yamagishi
 
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
Hayahide Yamagishi
 
Why neural translations are the right length
Why neural translations are  the right lengthWhy neural translations are  the right length
Why neural translations are the right length
Hayahide Yamagishi
 
A hierarchical neural autoencoder for paragraphs and documents
A hierarchical neural autoencoder for paragraphs and documentsA hierarchical neural autoencoder for paragraphs and documents
A hierarchical neural autoencoder for paragraphs and documents
Hayahide Yamagishi
 
ニューラル論文を読む前に
ニューラル論文を読む前にニューラル論文を読む前に
ニューラル論文を読む前に
Hayahide Yamagishi
 
ニューラル日英翻訳における出力文の態制御
ニューラル日英翻訳における出力文の態制御ニューラル日英翻訳における出力文の態制御
ニューラル日英翻訳における出力文の態制御
Hayahide Yamagishi
 
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
Hayahide Yamagishi
 

More from Hayahide Yamagishi (15)

[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
[PACLING2019] Improving Context-aware Neural Machine Translation with Target-...
 
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
[修論発表会資料] 目的言語の文書文脈を用いたニューラル機械翻訳
 
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
[論文読み会資料] Beyond Error Propagation in Neural Machine Translation: Characteris...
 
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
[NAACL2018読み会] Deep Communicating Agents for Abstractive Summarization
 
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
[論文読み会資料] Asynchronous Bidirectional Decoding for Neural Machine Translation
 
[ML論文読み会資料] Teaching Machines to Read and Comprehend
[ML論文読み会資料] Teaching Machines to Read and Comprehend[ML論文読み会資料] Teaching Machines to Read and Comprehend
[ML論文読み会資料] Teaching Machines to Read and Comprehend
 
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
 
[ML論文読み会資料] Training RNNs as Fast as CNNs
[ML論文読み会資料] Training RNNs as Fast as CNNs[ML論文読み会資料] Training RNNs as Fast as CNNs
[ML論文読み会資料] Training RNNs as Fast as CNNs
 
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
入力文への情報の付加によるNMTの出力文の変化についてのエラー分析
 
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
[ACL2017読み会] What do Neural Machine Translation Models Learn about Morphology?
 
Why neural translations are the right length
Why neural translations are  the right lengthWhy neural translations are  the right length
Why neural translations are the right length
 
A hierarchical neural autoencoder for paragraphs and documents
A hierarchical neural autoencoder for paragraphs and documentsA hierarchical neural autoencoder for paragraphs and documents
A hierarchical neural autoencoder for paragraphs and documents
 
ニューラル論文を読む前に
ニューラル論文を読む前にニューラル論文を読む前に
ニューラル論文を読む前に
 
ニューラル日英翻訳における出力文の態制御
ニューラル日英翻訳における出力文の態制御ニューラル日英翻訳における出力文の態制御
ニューラル日英翻訳における出力文の態制御
 
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
[EMNLP2016読み会] Memory-enhanced Decoder for Neural Machine Translation
 

[ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use Context

  • 1. Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use Context Urvashi Khandelwal, He He, Peng Qi, Dan Jurafsky (Stanford University) M2 山岸駿秀 @ ACL2018読み会
  • 2. Introduction ● n-gram Language Modelと比較して、Neural Language Model (NLM)は長距離文脈を使えるようになったとされる ● 実際に長距離文脈を捉えられているのかをAblation Test ● Neural Cache ModelはLMにどう影響するかを調査 読んだ理由 ● 文脈の知見が欲しかったから ● “We propose a novel architecture …” に疲れたから 2
  • 3. 言語モデルの復習と今回の入力例 ● 以下の確率を計算 ● Negative Log Likelihoodを計算 ● Perplexityで評価 ... the company reported a loss after taxation and minority interests of NUM million irish borrowings under the short-term parts of a credit agreement </s> berlitz which is based in princeton n.j. provides language instruction and translation services through more than NUM language centers in NUM countries </s> in the past five years more sim has set a fresh target of $ NUM a share by the end of </s> reaching that goal says robert t. UNK applied 's chief financial officer than NUM NUM of its sales have been outside the u.s. </s> macmillan has owned berlitz since NUM </s> in the first six 3
  • 4. 実験設定 ● Corpus: PennTreeBankとWikitext-2 ● モデルは普通のNLM ○ Dropoutを時間方向にも適用 ○ Random seedを変えて3つ用意 → 平均値を報告 ● 学習時は対象文の前の文を全て使用 ● Devで評価(Testの特徴を調べるのは気が引けたらしい) 4
  • 5. How much context is used? ● 実験1: LSTMは何単語覚えられるのか? ○ δ-function: Test dataの変更方法を指示 ● effective context sizeを調べる ○ Perplexityが収束する長さ(全て使ったときのPerplexity + 1%くらい) ● 評価はLossかPerplexityの変化率(以降全てこれ) ○ n単語消去したら、文長-n単語分のLossを測定 5
  • 6. 結果1: 文長とHyperparameter(右: PTB) ● PTBで150単語、Wikiで250単語あたりが限界 ● Hyperparameterは性能に影響するが、記憶力には無関係 6
  • 7. 結果2: 単語のクラスごとのLoss(右: Wiki) ● Infrequent words(Trainで出現数800回以下)は長距離文脈が必要 ● Function words(前置詞と冠詞)は周辺単語だけでいい 7
  • 8. Nearby vs. long-range context ● LSTMはだいたい200単語くらい覚えられる → 場所による特徴はあるのか? ● 文脈の途中(長さは span = (s1, s2] で管理 )を変化させる ○ ρはshuffleかreverse ● 文長は300単語で固定 8
  • 9. 結果3(右: Wiki) a. s2 = s1 + 20のとき: 近い文脈は語順が重要 b. s2 = nのとき: 離れた文脈は「出現したこと」が重要、 違う単語列(語順は整っている)で置換すると悪い 9
  • 10. Types of words and the region of context ● 「単語が出現したこと」が重要なら、function wordsはいらない? ● fPOS (y, span): span中でPOSがyの単語を除去 ● 同数の単語をrandomに削除する実験もした 10
  • 11. 結果4: 機能語/内容語の削除(左:PTB 右:Wiki) ● 近くのContent wordsは絶対に必要 ● 20単語くらい離れるとFunction wordsの影響が小さい ● 遠くの単語は意味だけを大まかに覚えているのか? 11
  • 12. Can LSTMs copy words without caches? ● Neural Language GenerationではCopy Mechanismが使われる ○ AttentionとかCopyNetとかCacheとか ● 「200単語も記憶できるならCopy Mechanismいらないのでは?」 以下の場合分けをして実験 ● 文脈の距離: “nearby” ≦ 50 < “long-range” ● Copyすると解になる単語がどこにあるか → これを消す ○ Cnear: “nearby”にある ○ Cfar: “long-range”にある ○ Cnone: どこにもない 12
  • 13. 結果5: Cを消した(左:PTB 右:Wiki) ● Cfarを消してもそこまで悪くならない → 大まかな意味を学習? ● Cnearを消してはいけない → 近くの単語をCopyする能力がある? ● 長距離の文脈を消すとCnoneの性能に悪影響 13
  • 14. 結果6: 除去の代わりに置換(左:PTB 右:Wiki) ● “Similar”: 同程度のfrequencyかつ同じPOSの単語 ● 近いところは表層が同じであることが重要 ● 遠いところはCfarを消しても分布仮説的なもので予測可能? 14
  • 15. How does the cache help? ● Neural Cache Model [Grave+, ICLR2017] ○ hi はそれまでのhidden states ○ 各単語に対してPcacheを計算し、Plm + Pcacheを生成確率とする ● 300単語以上使う(Document lengthの平均) ○ PTB: 500単語 ○ Wiki: 3875単語 ● Cache Modelを基準としたNLMのPPLの増加率で評価 15
  • 16. 結果7: Cacheの影響(左: PTB 右: Wiki) ● 文脈に出てきた単語はCopyされていそう ● 文脈に出てきていない単語を出すことには向いていない ● LSTMとCacheでできることが違う → 補完できているのでは? 16
  • 18. まとめ ● LSTMを使ったNeural Language Modelの性能を調べた ● 以下のことがわかった ○ LSTMは200単語くらい覚えられる ○ Hyperparameterは性能を変化させるが、記憶力には影響がない ○ 近くの単語は語順が重要、遠くの単語は存在することが重要 ○ Cacheを使うと遠くの単語を使えるようになる ● “この結果はdata-drivenかもしれないので要追試” ○ “一応PTBとWikiでデータの多様性を持たせたつもり” 18
  • 19. 感想 ● 読みやすい & 謙虚な文体 & マジメな実験で好感が持てる ● 語順が自由な言語では違いがありそう ● 学習の設定がちょっと特殊 ○ 普通、無限に文脈を使える設定で学習しないのでは ○ 長距離文脈が現れる設定と1文しかこない設定では結果が変わりそう ● 200単語以上覚えておく必要がないだけなのか覚えられないのか ○ 平均単語文長20単語だから、10文くらい ○ LSTMは原理的には全部覚えられるはず…… ● 何単語消したのかとか、そういうデータがほしかった 19