SlideShare a Scribd company logo
1 of 14
Download to read offline
Visualizing and Understanding
Neural Models in NLP
Jiwei Li, Xinlei Chen, Eduard Hovy, and Dan Jurafsky
NAACL 2016, pages 681-691.
論文 コード TechTalks.tv
読み手: 岡崎 直観 (東北大学) (@chokkanorg)
第8回最先端NLP勉強会
※但し書きがある場合を除き,スライド中の図・表はLi+ (2016) の引用
本研究の貢献: DNNモデルの解釈
• 人間が設計した素性からなるモデルは解釈可能
• 例: 線形識別モデルにおける素性の重み
• 今や幅広いタスクでDNNが最高性能を達成
• 単語ベクトルや隠れ層などでモデルの解釈が困難に
• DNNは意味合成をどのように実現しているのか?
• 強調(intensification)や否定(negation)の取り扱い
• 文中の離れた場所の単語の意味の合成
• 文中の不要な要素(ストップワード)の除去
• 単語の顕著度(saliency)を可視化する手法を検討
• 分散: 文中の単語ベクトルの平均からの乖離度
• 偏微分: 解いているタスクへの単語ベクトルの貢献度
Li+ (2016) Visualizing and Understanding Neural Models in NLP 2
本研究で用いたタスク (1/2):
Stanford Sentiment Treebank (Socher+ 13)
• 句構造に5段階の評価ラベルが付与されたデータ
• 句構造を単語列に展開し,単語列から評価ラベル
を予測する問題に変換した
• 単語列からラベルを予測する方が一般的なため
• 実験設定
• 最適化: ミニバッチAdaGrad
• 次元数: 60 (入力層と隠れ層)
Li+ (2016) Visualizing and Understanding Neural Models in NLP 3
(Socher+ 2013)
モデル 5クラス 2クラス
RNN 0.429 0.850
LSTM 0.469 0.870
双方向LSTM 0.488 0.878
本研究で用いたタスク (2/2):
Seq2seqによる文生成
• 入力文をベクトルにエンコードして,同じ文をデ
コード(生成)するタスク(オートエンコーダ)
• エンコード/デコードにはLSTMを採用
• WMT’14コーパスの英語400万文(平均22.5単語)
を学習データとして利用
Li+ (2016) Visualizing and Understanding Neural Models in NLP 4
very good movie
very good movie
<EOS> very good movie
<EOS>
𝑥𝑥𝑡𝑡
ℎ𝑡𝑡
𝑦𝑦𝑡𝑡 = softmax 𝑊𝑊(𝑦𝑦𝑦)
ℎ𝑡𝑡
句ベクトルの可視化(次元削減なし)
• 強調(左): 特定の次元が強くなる傾向が見られる
• 否定(右): 特定の次元の反転が見られるが(枠線),
強調の場合と比べると傾向は不明瞭
• (読み手注)ベクトルを積極的に変換しているように見える
Li+ (2016) Visualizing and Understanding Neural Models in NLP 5
句ベクトルの可視化(t-SNE)
Li+ (2016) Visualizing and Understanding Neural Models in NLP 6
悪そうなクラスタ
not badが混ざっている (not good ≒ bad; not bad ≠ good)
文ベクトルの可視化(t-SNE)
Li+ (2016) Visualizing and Understanding Neural Models in NLP 7
主節がlikeで逆接を入れるとかなり
遠ざかる
主節がhateで逆接を入れた場合は,
あまり遠ざからない
単語ベクトルの分散による顕著度
• 文𝑆𝑆中の単語𝑖𝑖のベクトル𝒙𝒙𝑖𝑖の𝑗𝑗次元目𝑥𝑥𝑖𝑖,𝑗𝑗の顕著度
Var𝑆𝑆 𝑖𝑖, 𝑗𝑗 = 𝑥𝑥𝑖𝑖,𝑗𝑗 −
1
𝑆𝑆
�
𝑖𝑖′∈𝑆𝑆
𝑥𝑥𝑖𝑖′,𝑗𝑗
2
• 単語ベクトルも学習対象とする場合のみ利用可
• ベクトル合成過程などを可視化できない
Li+ (2016) Visualizing and Understanding Neural Models in NLP 8
文𝑆𝑆中の全単語ベクトル
の𝑗𝑗次元目の平均値
分散の可視化例:
評判を反映しそうな単語の顕著度が上昇
Li+ (2016) Visualizing and Understanding Neural Models in NLP 9
偏微分による顕著度(画像認識の場合)
ILSVRC 2013のテストセットに対して,どのピクセルがクラス分類に貢献したかを可視化
(物体の位置をアノテートしていないのに大体の位置が分かる!)
K Simonyan, A Veldaldi, A Zisserman. Deep Inside Convolutional Networks: Visualising Image
Classification Models and Saliency Maps. ICLR 2014.
Li+ (2016) Visualizing and Understanding Neural Models in NLP 10
偏微分による顕著度
• 文𝑆𝑆中の単語𝑖𝑖のベクトル𝒙𝒙𝑖𝑖の𝑗𝑗次元目𝑥𝑥𝑖𝑖,𝑗𝑗の顕著度
Grad𝑆𝑆 𝑖𝑖, 𝑗𝑗 =
𝜕𝜕𝑙𝑙(𝒙𝒙1 … 𝒙𝒙 𝑆𝑆 , �𝑦𝑦)
𝜕𝜕𝑥𝑥𝑖𝑖,𝑗𝑗
• 解釈: 確率推定値(スコア)の一次近似
𝑙𝑙 𝒙𝒙1 … 𝒙𝒙 𝑆𝑆 , �𝑦𝑦 ≈ 𝑙𝑙 𝑥𝑥𝑖𝑖,𝑗𝑗 + 𝑙𝑙′
𝑥𝑥𝑖𝑖,𝑗𝑗 𝛿𝛿𝑥𝑥 = 𝑙𝑙′
𝑥𝑥𝑖𝑖,𝑗𝑗 𝛿𝛿𝑥𝑥 + 𝑏𝑏
• 単語ベクトルの値を微小に(𝛿𝛿𝑥𝑥だけ)変化させるとき,ラ
ベル�𝑦𝑦の確率推定値(スコア)に大きな影響を与えるも
のを見つける
Li+ (2016) Visualizing and Understanding Neural Models in NLP 11
ラベル�𝑦𝑦を予測した際の
確率推定値またはスコア
一次までのテイラー展開 𝑥𝑥𝑖𝑖,𝑗𝑗を𝛿𝛿𝑥𝑥だけ動か
した時の影響度
定数項
誤差逆伝搬法で計算可
偏微分の可視化例(評判分析)
精度の高いモデル(双方向LSTM)の方がhateによりフォーカスしている
Li+ (2016) Visualizing and Understanding Neural Models in NLP 12
偏微分の可視化例(文生成)
(I like the movie through the plot is boring)
Li+ (2016) Visualizing and Understanding Neural Models in NLP 13
内容語の生成: 入力文の単語ベクトルを使う
機能語の生成: 直前の語(言語モデル)を使う
まとめ
• 単語の顕著度(saliency)を可視化する手法を検討
• 分散: 文中の単語ベクトルの平均からの乖離度
• 偏微分: 解いているタスクへの単語ベクトルの貢献度
• 言語処理のニューラルモデルの可視化の第一歩
• どの可視化方法が良いかは分からない
• ニューラルネットワークの比較検討はこれから
• 読み手の感想
• 文生成モデルの解析は興味深かった
• アテンションを可視化することとの関連性は?
Li+ (2016) Visualizing and Understanding Neural Models in NLP 14

More Related Content

What's hot

条件付き確率場の推論と学習
条件付き確率場の推論と学習条件付き確率場の推論と学習
条件付き確率場の推論と学習
Masaki Saito
 
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモAnaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
ayohe
 

What's hot (20)

Deep Learningによる画像認識革命 ー歴史・最新理論から実践応用までー
Deep Learningによる画像認識革命 ー歴史・最新理論から実践応用までーDeep Learningによる画像認識革命 ー歴史・最新理論から実践応用までー
Deep Learningによる画像認識革命 ー歴史・最新理論から実践応用までー
 
Generative Models(メタサーベイ )
Generative Models(メタサーベイ )Generative Models(メタサーベイ )
Generative Models(メタサーベイ )
 
ドメイン適応の原理と応用
ドメイン適応の原理と応用ドメイン適応の原理と応用
ドメイン適応の原理と応用
 
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monoc...
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monoc...EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monoc...
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monoc...
 
これからの Vision & Language ~ Acadexit した4つの理由
これからの Vision & Language ~ Acadexit した4つの理由これからの Vision & Language ~ Acadexit した4つの理由
これからの Vision & Language ~ Acadexit した4つの理由
 
Point net
Point netPoint net
Point net
 
Retrofitting Word Vectors to Semantic Lexicons
Retrofitting Word Vectors to Semantic LexiconsRetrofitting Word Vectors to Semantic Lexicons
Retrofitting Word Vectors to Semantic Lexicons
 
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
 
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
 
条件付き確率場の推論と学習
条件付き確率場の推論と学習条件付き確率場の推論と学習
条件付き確率場の推論と学習
 
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks? 【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
 
【DL輪読会】Visual Classification via Description from Large Language Models (ICLR...
【DL輪読会】Visual Classification via Description from Large Language Models (ICLR...【DL輪読会】Visual Classification via Description from Large Language Models (ICLR...
【DL輪読会】Visual Classification via Description from Large Language Models (ICLR...
 
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモAnaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
 
「解説資料」ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation
「解説資料」ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation 「解説資料」ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation
「解説資料」ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation
 
Vision and Language(メタサーベイ )
Vision and Language(メタサーベイ )Vision and Language(メタサーベイ )
Vision and Language(メタサーベイ )
 
[DL輪読会]Learning Latent Dynamics for Planning from Pixels
[DL輪読会]Learning Latent Dynamics for Planning from Pixels[DL輪読会]Learning Latent Dynamics for Planning from Pixels
[DL輪読会]Learning Latent Dynamics for Planning from Pixels
 
[DL輪読会]An Image is Worth 16x16 Words: Transformers for Image Recognition at S...
[DL輪読会]An Image is Worth 16x16 Words: Transformers for Image Recognition at S...[DL輪読会]An Image is Worth 16x16 Words: Transformers for Image Recognition at S...
[DL輪読会]An Image is Worth 16x16 Words: Transformers for Image Recognition at S...
 
画像キャプションの自動生成
画像キャプションの自動生成画像キャプションの自動生成
画像キャプションの自動生成
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習
 
モデルではなく、データセットを蒸留する
モデルではなく、データセットを蒸留するモデルではなく、データセットを蒸留する
モデルではなく、データセットを蒸留する
 

Viewers also liked

Viewers also liked (11)

Modeling missing data in distant supervision for information extraction (Ritt...
Modeling missing data in distant supervision for information extraction (Ritt...Modeling missing data in distant supervision for information extraction (Ritt...
Modeling missing data in distant supervision for information extraction (Ritt...
 
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...
 
Learning to automatically solve algebra word problems
Learning to automatically solve algebra word problemsLearning to automatically solve algebra word problems
Learning to automatically solve algebra word problems
 
研究室における研究・実装ノウハウの共有
研究室における研究・実装ノウハウの共有研究室における研究・実装ノウハウの共有
研究室における研究・実装ノウハウの共有
 
Supervised Learning of Universal Sentence Representations from Natural Langua...
Supervised Learning of Universal Sentence Representations from Natural Langua...Supervised Learning of Universal Sentence Representations from Natural Langua...
Supervised Learning of Universal Sentence Representations from Natural Langua...
 
Word2vecの並列実行時の学習速度の改善
Word2vecの並列実行時の学習速度の改善Word2vecの並列実行時の学習速度の改善
Word2vecの並列実行時の学習速度の改善
 
単語・句の分散表現の学習
単語・句の分散表現の学習単語・句の分散表現の学習
単語・句の分散表現の学習
 
単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展
 
深層ニューラルネットワーク による知識の自動獲得・推論
深層ニューラルネットワークによる知識の自動獲得・推論深層ニューラルネットワークによる知識の自動獲得・推論
深層ニューラルネットワーク による知識の自動獲得・推論
 
言語と画像の表現学習
言語と画像の表現学習言語と画像の表現学習
言語と画像の表現学習
 
深層学習時代の自然言語処理
深層学習時代の自然言語処理深層学習時代の自然言語処理
深層学習時代の自然言語処理
 

Similar to Visualizing and understanding neural models in NLP

Dynamic Entity Representations in Neural Language Models
Dynamic Entity Representations in Neural Language ModelsDynamic Entity Representations in Neural Language Models
Dynamic Entity Representations in Neural Language Models
Shun Kiyono
 
20111207 勉強会のパターンを書いてみるワークショップ
20111207 勉強会のパターンを書いてみるワークショップ20111207 勉強会のパターンを書いてみるワークショップ
20111207 勉強会のパターンを書いてみるワークショップ
Yasunobu Kawaguchi
 

Similar to Visualizing and understanding neural models in NLP (15)

Dynamic Entity Representations in Neural Language Models
Dynamic Entity Representations in Neural Language ModelsDynamic Entity Representations in Neural Language Models
Dynamic Entity Representations in Neural Language Models
 
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
 
[DL輪読会]Attention InterpretabilityAcross NLPTasks
[DL輪読会]Attention InterpretabilityAcross NLPTasks[DL輪読会]Attention InterpretabilityAcross NLPTasks
[DL輪読会]Attention InterpretabilityAcross NLPTasks
 
Evaluating Visual Representations for Topic Understanding and Their Effect...
Evaluating Visual Representations for Topic Understanding and Their Effect...Evaluating Visual Representations for Topic Understanding and Their Effect...
Evaluating Visual Representations for Topic Understanding and Their Effect...
 
論文読み会 Enriching Word Vectors with Subword Information
論文読み会 Enriching Word Vectors with Subword Information論文読み会 Enriching Word Vectors with Subword Information
論文読み会 Enriching Word Vectors with Subword Information
 
Acl reading 2nd
Acl reading 2ndAcl reading 2nd
Acl reading 2nd
 
Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...
Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...
Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...
 
日本語文章に対する 述語項構造アノテーション仕様の考察
日本語文章に対する述語項構造アノテーション仕様の考察日本語文章に対する述語項構造アノテーション仕様の考察
日本語文章に対する 述語項構造アノテーション仕様の考察
 
【2016.09】cvpaper.challenge2016
【2016.09】cvpaper.challenge2016【2016.09】cvpaper.challenge2016
【2016.09】cvpaper.challenge2016
 
Natural Language Processing (Almost) from Scratch(第 6 回 Deep Learning 勉強会資料; 榊)
Natural Language Processing (Almost) from Scratch(第 6 回 Deep Learning 勉強会資料; 榊)Natural Language Processing (Almost) from Scratch(第 6 回 Deep Learning 勉強会資料; 榊)
Natural Language Processing (Almost) from Scratch(第 6 回 Deep Learning 勉強会資料; 榊)
 
【DL輪読会】Non-Linguistic Supervision for Contrastive Learning of Sentence Embedd...
【DL輪読会】Non-Linguistic Supervision for Contrastive Learning of Sentence Embedd...【DL輪読会】Non-Linguistic Supervision for Contrastive Learning of Sentence Embedd...
【DL輪読会】Non-Linguistic Supervision for Contrastive Learning of Sentence Embedd...
 
深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向
 
[DLHacks 実装]Network Dissection: Quantifying Interpretability of Deep Visual R...
[DLHacks 実装]Network Dissection: Quantifying Interpretability of Deep Visual R...[DLHacks 実装]Network Dissection: Quantifying Interpretability of Deep Visual R...
[DLHacks 実装]Network Dissection: Quantifying Interpretability of Deep Visual R...
 
2015 08 survey
2015 08 survey2015 08 survey
2015 08 survey
 
20111207 勉強会のパターンを書いてみるワークショップ
20111207 勉強会のパターンを書いてみるワークショップ20111207 勉強会のパターンを書いてみるワークショップ
20111207 勉強会のパターンを書いてみるワークショップ
 

Recently uploaded

Recently uploaded (7)

LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

Visualizing and understanding neural models in NLP