SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Training RNNs as Fast as CNNs
Tao Lei, Yu Zhang and Yoav Artzi
arXiv 2017/09 (11月版を紹介)
M1 山岸駿秀
Introduction
● LSTMやGRUは並列処理に向いていない
○ 前のステップの計算を待たないと計算が始められないから
● SRU(Simple Recurrent Unit)を提案
○ ゲートの計算を並列化できるようにした
○ LSTMの精度を落とさず高速化
LSTM(研究会の資料から再掲)
● ゲートの計算にht-1
が必要
● 前のステップの計算が終わっていないと次のゲートが
計算できない
SRU
● 入力: X = {x1
, … , xt
, … , xn
} (xt
はd次元のベクトル)
● 各重み行列 W は d×d次元
● ゲート
○ Forget gate: f
○ Reset gate: r
● メモリセルct
をもつ
○ これは並列化できない
SRUの式
● ゲートは各時刻の入力にのみ依存
○ まとめて実行できる
● ht
に入力が一定量入る(highway connection)
○ 多層にしやすい
● g( )は基本的にtanh
実際の計算
● U(n × (minibatch_size) × 3d次元)の行列で代用
● LSTM: 各時刻で行列積を4回計算
● SRU: 全時刻で1回だけ計算
QRNN[Bradbury+ ICLR2017]
● ゲートは畳み込みで一括計算
○ W: 窓幅k × embed_size(チャネル数) nのフィルタがm枚
○ Z、F、O: 系列の長さT × mの行列
● セルと隠れ層は(1)で求めたゲートでそれぞれ計算
○ fo-pooling(average poolingの代わりに使っている)
QRNN[Bradbury+ ICLR2017]との差分 (11月版で追加)
● SRUはQRNNの変形
○ 窓幅1かつ、フィルタの数 = embedding sizeでほぼ等価
○ x~
を作る時の非線形関数が恒等変換に変わっている
○ highway connectionがあるかないか
実験
● 5つの実験
○ Classification
○ Question Answering
○ Language Modeling
○ Neural Machine Translation
○ Speech Recognition(省略)
● 共通の設定
○ GPU: GeForce GTX1070、Cuda 8.0
○ 処理速度は学習時に計測
○ 引用がない結果は著者がPyTorchで再実装 (SRUもPyTorch)
○ Dropoutは時間軸方向にもかける
実験1: Classification
● 6つの実験
○ Movie review sentiment
○ Subjectivity
○ Customer review polarity
○ TREC question type
○ MPQA polarity
○ SST
● 文が入力(各単語の分散表現はGoogle Newsで学習)
○ 1000億語あるコーパス
結果
● LSTMを上回った
速度
QRNNとの比較
QRNNとの比較
● QRNN + Highway でほぼSRUと同等
● 恒等変換より非線形変換の方が精度がいい
実験2: Question Answering
● Data: SQuAD (Stanford Question Answering Dataset)
○ 質問と回答のペアが10万対
○ Wikipediaより抽出
● 設定
○ Document Reader model [Chen+ ACL2017] で使われている
LSTMをSRUにする
○ 隠れ層の次元: 128
○ dropoutの確率は一番良かったものを選択
■ SRU = 0.2、LSTM = 0.3
○ F値とExact Matchで測定
結果
● 同等の性能で学習時間が短くなった
実験3: Language Modeling
● Data: Penn Treebank corpus
● 設定
○ dropout: 0.75
○ SGD(学習率1.0にして、175 epoch以降を0.98倍していく)
○ 300 epoch
○ g( )は恒等変換
結果
● SRUを使うことで精度が向上した
○ 処理速度もよくなった
● 著者のLSTM実装の結果が悪い
○ 時間軸方向にdropoutをかけることがよくない?
実験4: Machine Translation
● Data: WMT2014 英独翻訳
○ 400万文対
○ newstest2012と2013をdev、2014をtestに使用
● OpenNMT-pyを書き換えてSRUにした
○ Luongのattention
○ 前の隠れ層ht-1
(h~
t-1
では)を入力するが並列化のため未入力
○ 隠れ層の次元: 500
結果
● パラメータ数が減り、学習時間も短くなった
● 多層にしやすくなったので結果がよくなった
○ (層数が同じときはむしろ下がっているが……)
○ (テスト時は並列化できないので、多層にすると遅くなりそう)
所感
● QRNNより便利そう
● 実装が凝っている
○ SRUのところをCUDAで書いて、コンパイルしている
○ それをcupyで読んでいる
● 翻訳の実験が雑
○ 文生成では速くならないのでは?

Contenu connexe

Plus de 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
 

Plus de Hayahide Yamagishi (16)

[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...
 
[ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use C...
[ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use C...[ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use C...
[ACL2018読み会資料] Sharp Nearby, Fuzzy Far Away: How Neural Language Models Use C...
 
[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
 
入力文への情報の付加による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
 
[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...
 

[ML論文読み会資料] Training RNNs as Fast as CNNs