単語の埋め込み(たんごのうめこみ、英語: Word embedding)とは、自然言語処理(NLP)における一連の言語モデリングおよび特徴学習手法の総称であり、単語や語句が実ベクトル空間上に位置づけられる。単語の数だけの次元を持つ空間から、はるかに低い次元を持つ連続ベクトル空間へと数学的な埋め込みが行われる。

このマッピングを生成する方法として、ニューラルネットワーク[1]、単語共起行列の次元削減英語版[2][3][4]、確率モデル[5]、説明可能な知識に基づく方法[6]、単語が現れる文脈における用語での明示的な表現、などがある[7]

単語と句の埋め込みを入力表現として用いると、構文解析[8]感情分析などのNLPタスクのパフォーマンスを向上させることが示されている[9]

技術の発展 編集

言語学では、単語の埋め込みは、分布意味論の研究分野で議論された。 言語データの大規模なサンプルの分布特性に基づいて、言語項目間の意味的類似性を定量化および分類することを目的としている。 "a word is characterized by the company it keeps"(単語はその周辺によって特徴付けられる)という根本的な考え方は、 ファースによって広められた[10]

単語をベクトルとして表現する手法は、1960年代における情報検索用のベクトル空間モデルの開発が元になっている。特異値分解を使用して次元数を削減することにより、1980年代後半に潜在的意味分析が導入された[11]。2000年にベンジオらが一連の論文で提供した「ニューラル確率言語モデル」は、「単語の分散表現を学習する」ことにより、コンテキスト内の単語表現の高次元性を低減した[12]。単語の埋め込みには、2つの異なるスタイルがある[13]。1つは、単語が共起単語のベクトルとして表現され、もう1つは、単語が出現する言語コンテキストのベクトルとして表現される。RoweisとSaulは Science で「ローカル線形埋め込み」(LLE)を使用して高次元データ構造の表現を発見する方法を示した[14]。この分野は徐々に発展し、2010 年以降に花開いた。ベクトルの品質とモデルのトレーニング速度に重要な進歩があったことも一因となった。

多くの研究チームが単語の埋め込みに取り組んでいる。2013年、トーマス・ミコロフ率いるGoogleのチームがword2vecという単語埋め込みツールキットを開発した。word2vecを用いると、従来法よりも高速にベクトル空間モデルを訓練することができる[15]。ほとんどの新しい単語埋め込み技術は、従来のn-gramモデルや教師なし学習ではなく、ニューラルネットワークのアーキテクチャに基づいて作られている[16]

多義性と同義性 編集

単語の埋め込み(一般に単語ベクトル空間モデル)の制限事項として、複数の意味を持つ単語が単一の表現(意味空間の単一のベクトル)に統合されることが大きい。つまり、多義語と同義語は適切に処理されない。たとえば、「昨日試したクラブは最高でした!」という文章では、「クラブ」という語が「アメリカンクラブハウスサンド」、「野球クラブ」、「クラブハウス」、「ゴルフクラブ」などのうちどれと関連していのるか明確ではない。単語ごとの複数の意味を異なるベクトル(マルチセンス埋め込み)に対応させる必要性から、シングルセンス埋め込みをマルチセンス埋め込みに分割する場合もある[17][18]

マルチセンスの埋め込みを生成するほとんどのアプローチは、単語意味表現に注目して教師なし学習と知識ベースとに分類することができる[19]。word2vecスキップグラムに基づく Multi-Sense Skip-Gram(MSSG)では、単語センスの識別と埋め込みを同時に実行し、各単語の特定の数のセンスを想定しながら、トレーニング時間を改善する[20]。 Non-Parametric Multi-Sense Skip-Gram(NP-MSSG)では、この数が各ワードによって異なる。 Most Suitable Sense Annotation(MSSA)では語彙データベース(WordNetConceptNet、BabelNetなど)・単語の埋め込み・単語の意味の曖昧性といった事前知識を組み合わせており、教師なしおよび知識ベースのアプローチによって、事前に定義されたのスライディングウィンドウのコンテキストを考慮して単語の意味にラベル付けする[21]。 一旦単語の意味が明確になると、標準の単語埋め込み手法で使用できるため、マルチセンス埋め込みが生成される。 MSSAのアーキテクチャを用いることで、明確化と注釈のプロセスを自己改善的に繰り返し実行できる。

マルチセンス埋め込みを使用すると、品詞タグ付け、意味関係の識別、意味関連など、いくつかのNLPタスクのパフォーマンスが向上することが知られている。 ただし、名前付きエンティティの認識と感情分析を伴うタスクでは、複数のベクトル表現の恩恵があまり受けられない[22]

手法 編集

対照学習 編集

対照学習: contrastive learning)はアンカー-正例/負例間の距離最適化に基づく機械学習の総称である[23][24]

対照学習ではまず基準となるサンプル(アンカー)、アンカーと同じクラスに属するサンプル(正例)および異なるクラスに属するサンプル(負例)を用意する。次にエンコーダによってサンプル/正例/負例を埋め込み空間へ投射し、この空間内でアンカー-正例間距離とアンカー-負例間距離を測定する。同じクラスに属する前者の距離は小さく・異なるクラスに属する後者の距離は大きくあるべきであるため、これを損失としてエンコーダを学習する。充分な学習をすることでサンプル間の距離関係を表現した埋め込み空間が得られる(c.f 距離学習)。

ラベル無しに正例/負例を用意すれば自己教師あり学習として、教師ラベルに基づいて正例/負例を用意すれば教師あり学習として学習される[25]

対照学習を用いることで単語間の関係を距離で表現した埋め込み空間が学習され、推論時にはエンコーダを通じて単語の埋め込みを得ることができる。

生物学的配列 編集

生物学的配列(DNA、RNA、タンパク質など)における n-gramの単語埋め込みは、AsgariとMofradにより提案された[26]。バイオベクター(BioVec)は、生物学的配列の総称であり、タンパク質(アミノ酸配列)のタンパク質ベクター(ProtVec)や遺伝子配列の遺伝子ベクター(GeneVec)を指す。この表現は、プロテオーム解析ゲノミクスに対するディープラーニングの応用の場で広く用いられる。AsgariとMofradが提示した結果は、BioVectorsが基盤となる生化学的および生物物理学的解釈に関して生物学的配列を特徴付けられることを示唆している。

思考ベクトル 編集

思考ベクトルは、単語の埋め込みを文章全体またはドキュメント全体にまで拡張したもの。これらが機械翻訳の品質を向上させることを期待している研究者もいる[27]

ソフトウェア 編集

単語埋め込みをトレーニングおよび使用するためのソフトウェアとして、Tomas Mikolov のWord2vec、スタンフォード大学のGloVe英語版[28]、AllenNLPのELMo英語版[29]fastText英語版Gensim[30]、Indra[31]Deeplearning4j などがある。 主成分分析 (PCA)とT-Distributed Stochastic Neighbor Embedding(t-SNE)は、ともに、単語ベクトル空間の次元を削減して単語の埋め込みとクラスターを視覚化するのに用いられる[32]

応用例 編集

fastTextは、オンラインで利用可能な Sketch Engine において、テキストコーパスの単語の埋め込みを計算するためにも使用される[33]

関連項目 編集

主な単語埋め込みの実装・ソフトウェアなど

  • GloVe英語版- スタンフォード大学の単語分散表現モデル
  • word2vec - GoogleのTomas Mikolovらが開発した単語分散表現モデル
  • fastText英語版 - Facebookが開発した単語分散表現モデル
  • BERT - Googleの言語モデル
  • ELMo英語版- AllenNLP の単語埋め込み手法
  • Gensim - fastTextやword2vecなどを実装したPythonの自然言語処理ライブラリ

脚注 編集


  1. ^ Mikolov, Tomas; Sutskever, Ilya. "Distributed Representations of Words and Phrases and their Compositionality". arXiv:1310.4546 [cs.CL]。
  2. ^ Lebret, Rémi; Collobert, Ronan (2013). “Word Emdeddings through Hellinger PCA”. Conference of the European Chapter of the Association for Computational Linguistics (EACL) 2014. arXiv:1312.5542. Bibcode2013arXiv1312.5542L. 
  3. ^ Levy, Omer; Goldberg, Yoav (2014). Neural Word Embedding as Implicit Matrix Factorization (PDF). NIPS.
  4. ^ Li, Yitan; Xu, Linli (2015). Word Embedding Revisited: A New Representation Learning and Explicit Matrix Factorization Perspective (PDF). Int'l J. Conf. on Artificial Intelligence (IJCAI).
  5. ^ Globerson, Amir (2007). “Euclidean Embedding of Co-occurrence Data”. Journal of Machine Learning Research. https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/34951.pdf. 
  6. ^ Qureshi, M. Atif; Greene, Derek (2018-06-04). “EVE: explainable vector based embedding technique using Wikipedia” (英語). Journal of Intelligent Information Systems 53: 137–165. arXiv:1702.06891. doi:10.1007/s10844-018-0511-x. ISSN 0925-9902. 
  7. ^ Levy, Omer; Goldberg, Yoav (2014). Linguistic Regularities in Sparse and Explicit Word Representations (PDF). CoNLL. pp. 171–180.
  8. ^ Socher, Richard; Bauer, John; Manning, Christopher; Ng, Andrew (2013). Parsing with compositional vector grammars (PDF). Proc. ACL Conf.
  9. ^ Socher, Richard; Perelygin, Alex; Wu, Jean; Chuang, Jason; Manning, Chris; Ng, Andrew; Potts, Chris (2013). Recursive Deep Models for Semantic Compositionality Over a Sentiment Treebank (PDF). EMNLP.
  10. ^ Firth, J.R. (1957). “A synopsis of linguistic theory 1930-1955”. Studies in Linguistic Analysis: 1–32.  Reprinted in F.R. Palmer, ed (1968). Selected Papers of J.R. Firth 1952-1959. London: Longman 
  11. ^ Sahlgren. “A brief history of word embeddings”. 2020年12月16日閲覧。
  12. ^ Bengio, Yoshua; Schwenk, Holger; Senécal, Jean-Sébastien; Morin, Fréderic; Gauvain, Jean-Luc (2006). A Neural Probabilistic Language Model. 194. 137–186. doi:10.1007/3-540-33486-6_6. ISBN 978-3-540-30609-2 
  13. ^ Lavelli, Alberto; Sebastiani, Fabrizio; Zanoli, Roberto (2004). Distributional term representations: an experimental comparison. 13th ACM International Conference on Information and Knowledge Management. pp. 615–624. doi:10.1145/1031171.1031284
  14. ^ Roweis, Sam T.; Saul, Lawrence K. (2000). “Nonlinear Dimensionality Reduction by Locally Linear Embedding”. Science 290 (5500): 2323–6. Bibcode2000Sci...290.2323R. doi:10.1126/science.290.5500.2323. PMID 11125150. 
  15. ^ word2vec
  16. ^ “A Scalable Hierarchical Distributed Language Model”. Advances in Neural Information Processing Systems 21 (NIPS 2008) (Curran Associates, Inc.): 1081–1088. (2009). http://papers.nips.cc/paper/3583-a-scalable-hierarchical-distributed-language-model. 
  17. ^ Reisinger, Joseph; Mooney, Raymond J. (2010). Multi-Prototype Vector-Space Models of Word Meaning. Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics. Los Angeles, California: Association for Computational Linguistics. pp. 109–117. ISBN 978-1-932432-65-7. https://www.aclweb.org/anthology/N10-1013/ 2019年10月25日閲覧。 
  18. ^ Huang, Eric. (2012). Improving word representations via global context and multiple word prototypes. OCLC 857900050 
  19. ^ Camacho-Collados, Jose; Pilehvar, Mohammad Taher (2018). From Word to Sense Embeddings: A Survey on Vector Representations of Meaning. Bibcode:2018arXiv180504032C
  20. ^ Neelakantan, Arvind; Shankar, Jeevan; Passos, Alexandre; McCallum, Andrew (2014). “Efficient Non-parametric Estimation of Multiple Embeddings per Word in Vector Space”. Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) (Stroudsburg, PA, USA: Association for Computational Linguistics): 1059–1069. arXiv:1504.06654. doi:10.3115/v1/d14-1113. 
  21. ^ Ruas, Terry; Grosky, William; Aizawa, Akiko (2019-12-01). “Multi-sense embeddings through a word sense disambiguation process”. Expert Systems with Applications 136: 288–303. doi:10.1016/j.eswa.2019.06.026. ISSN 0957-4174. 
  22. ^ Li, Jiwei; Jurafsky, Dan (2015). “Do Multi-Sense Embeddings Improve Natural Language Understanding?”. Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (Stroudsburg, PA, USA: Association for Computational Linguistics): 1722–1732. arXiv:1506.01070. doi:10.18653/v1/d15-1200. 
  23. ^ "contrastive methods build representations by reducing the distance between ... positive pairs ... and increasing the distance between inputs not known to be related (negative pairs)" Kiani. (2022). Joint Embedding Self-Supervised Learning in the Kernel Regime.
  24. ^ "contrastive learning ... pull together an anchor and a “positive” sample in embedding space, and push apart the anchor from many “negative” samples." Khosla. (2020). Supervised Contrastive Learning.
  25. ^ "adapting contrastive learning to the fully supervised setting ... These positives are drawn from samples of the same class as the anchor" Khosla. (2020). Supervised Contrastive Learning.
  26. ^ Asgari, Ehsaneddin; Mofrad, Mohammad R.K. (2015). “Continuous Distributed Representation of Biological Sequences for Deep Proteomics and Genomics”. PLOS One 10 (11): e0141287. arXiv:1503.05140. Bibcode2015PLoSO..1041287A. doi:10.1371/journal.pone.0141287. PMC 4640716. PMID 26555596. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4640716/. 
  27. ^ Kiros, Ryan; Zhu, Yukun. "skip-thought vectors". arXiv:1506.06726 [cs.CL]。
  28. ^ GloVe”. 2020年12月16日閲覧。
  29. ^ Elmo”. 2020年12月16日閲覧。
  30. ^ Gensim”. 2020年12月16日閲覧。
  31. ^ Indra” (2018年10月25日). 2020年12月16日閲覧。
  32. ^ Ghassemi, Mohammad; Mark, Roger; Nemati, Shamim (2015). “A Visualization of Evolving Clinical Sentiment Using Vector Representations of Clinical Notes”. Computing in Cardiology. http://www.cinc.org/archives/2015/pdf/0629.pdf. 
  33. ^ Embedding Viewer”. Embedding Viewer. Lexical Computing. 2018年2月7日閲覧。