Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep contextualized word representations, Peters+, Allen Institute for Artificial intelligence, NAACL'18 #457

Open
AkihikoWatanabe opened this issue Jun 8, 2022 · 3 comments

Comments

@AkihikoWatanabe
Copy link
Owner

https://arxiv.org/pdf/1802.05365.pdf

@AkihikoWatanabe
Copy link
Owner Author

AkihikoWatanabe commented Jun 8, 2022

ELMo論文。
通常のword embeddingでは一つの単語につき一つの意味しか持たせられなかったが、文脈に応じて異なる意味を表現できるようなEmbeddingを実現し(同じ単語でも文脈に応じて意味が変わったりするので。たとえばrightは文脈に応じて右なのか、正しいなのか、権利なのか意味が変わる)様々な言語処理タスク(e.g. Question Answering, Sentiment Analysisなど)でSoTAを達成。

image

Embedding Layer + 2層のLSTM(1,2の間にはresidual connection)+ linear layerで言語モデルを構成し、順方向言語モデルと逆方向言語モデルを同時に独立して学習する(双方向LSTMではない;損失関数が両方向の言語モデルの対数尤度の和になっている)。
また、Linear LayerとEmbedding Layerのパラメータは両方向の言語モデルで共有されている。

k番目の単語のEmbedding Layerの出力ベクトル、各LSTMのhidden stateをタスクspecificなスカラーパラメタs_taskで足し合わせ、最後にベクトルのスケールを調整するパラメタγ_taskで大きさを調整する。これにより、k番目の単語のELMo Embeddingを得る。
単語単体の意味だけでこと足りるタスクの場合はEmbedding Layerの出力ベクトルに対する重みが大きくなり、文脈を考慮した情報が欲しい場合はLSTMのhidden stateに対する重みが大きくなるイメージ(LSTMの層が深いほど意味的semanticな情報を含み、浅いほど文法的syntacticな情報を含んでいる)。

使い方としては簡単で、ELMoを事前学習しておき、自身のNNモデルのWord Embeddingに(場合によってはRNNのhidden stateにも)、入力文から得られたELMo Embeddingをconcatして順伝搬させるだけで良い。

@AkihikoWatanabe
Copy link
Owner Author

AkihikoWatanabe commented Jun 8, 2022

s_taskとγ_taskはtrainableなパラメータで、
ELMoを適用した先のNNモデルの訓練時に、NNモデルのパラメタと一緒にチューニングする(と思われる)。

allenai/allennlp#1166
allenai/allennlp#2552

@AkihikoWatanabe
Copy link
Owner Author

AkihikoWatanabe commented Jun 8, 2022

ELMoのEmbedding Layerでは、2048 characterの(vocab size?)n-gram convolution filter(文字ごとにembeddingし、単語のembeddingを得るためにfilterを適用する?)の後に2つのhighway networkをかませてlinearで512次元に落とすみたいなことごやられているらしい。ここまで追えていない。

詳細は下記
https://datascience.stackexchange.com/questions/97867/how-does-the-character-convolution-work-in-elmo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant