For faster navigation, this Iframe is preloading the Wikiwand page for 言語モデル.

言語モデル

この項目は内容が専門的であり、一般の閲覧者にはわかりにくくなっているおそれがあります。 専門用語をわかりやすい表現にするための修正をして下さる協力者を求めています。(2023年2月)

言語モデル(げんごモデル、: language model)は、単語列に対する確率分布を表わすものである[1]

解説

[編集]

言語モデルは、長さがm個の単語列が与えられたとき、その単語列全体に対しての確率 を与える。この確率分布は、1つまたは複数の言語のテキストコーパスを使用して、言語モデルを訓練することによって得られる。しかし、言語は無限に有効な文を表現することができるため[注釈 1]、言語モデリングは、訓練データでは遭遇しないような言語的に有効な単語列にゼロでない確率を割り当てることが課題となる。この問題を克服するために、マルコフ仮定や、回帰型ニューラルネットワークあるいはトランスフォーマー(transformer)などのニューラルアーキテクチャなど、さまざまなモデリング方法が考案されている。

言語モデルは、計算言語学におけるさまざまな問題に役立っている。当初は、低確率で無意味な単語列を予測を防ぐために音声認識[2]での使用から始まった。現在では、機械翻訳(翻訳候補の順位付け)[3]や、より人間に近いテキストを生成する自然言語生成品詞タグ付け英語版構文解析[3]光学文字認識手書き文字認識[4]文法誘導英語版[5]情報検索[6][7]など、幅広い用途に利用されている。

情報検索においては、クエリ尤度モデル英語版において言語モデルが用いられる。この方法では、コレクション内のすべての文書に、個別の言語モデルが関連付けられている。そして各文書は、その文書の言語モデル に対するクエリ の確率 に基づいて順位付けされる。この目的のため一般に、ユニグラム(unigram)英語版言語モデルが利用される。

2018年以降、大規模言語モデル(LLM)が登場し、大きな発展がみられた。これらのモデルは、数十億個の学習可能なパラメータを持つディープ・ニューラルネットワークで構成され、ラベルなしテキストの膨大なデータセットで訓練される。LLMは、さまざまな自然言語処理タスクで目覚ましい成果を示し、研究の焦点が汎用的なLLMの使用へと移り変わっている[8]

モデルの種類

[編集]

n-gramモデル

[編集]

n-gram言語モデルは、マルコフ過程に基づいて単語列をモデル化するものである。このモデルでは、単語列内の次の単語の確率が、先行する単語の固定サイズのウィンドウにのみ依存すると仮定することで単純化する。たとえば、bigramモデル先行するは1つの単語のみを考慮し、trigramモデルは先行する2つの単語を考慮し、n-gramモデルは先行するn-1単語を文脈として考慮する[9]

たとえば、bigram言語モデルは、「I saw the red house(赤い家が見えた)」という文の確率を次のようにモデル化する。ここで、 は文の開始と終了を示す特別なトークンである。

これらの条件付き確率は、テキストコーパスの一部分の頻度カウントに基づいて推定することができる。たとえば、 は、コーパス内での単語「I」に続いて「saw」が出現する割合として単純に推定できる。スパース性の問題(たとえば、コーパス内で「red house」というbigramの出現数がゼロの場合)は、特に大きなコンテキストウィンドウを使用する場合に、平滑化英語版手法によって基本的なマルコフモデルを修正する必要がある[9]

n-gramモデルは、最新のディープラーニング手法、特に最近では大規模言語モデルに取って代わられたため、自然言語処理の研究やアプリケーションで一般的に使用されることはなくなった[要出典]

指数関数モデル

[編集]

最大エントロピー言語モデルでは、単語とn-gramの履歴との関係を符号化する特徴関数を使用する。言語モデルは次の式で表される。ここで、分配関数 はパラメータベクトル、 は特徴関数である。最も単純な形では、特徴関数は特定のn-gramの存在を示す指標にすぎない。モデルの最適なのために、 の事前分布を利用するか、何らかの形で正則化を行うことが有効である。指数関数型の言語モデルの一つの例として、対数双線形モデルがある。

ニューラルネットワーク

[編集]

ニューラル言語モデルは、連続空間言語モデル(continuous space language models)とも呼ばれ、単語の連続的な表現または埋め込みを使用して予測を行う[10]。これらのモデルでは、ニューラルネットワークが使用されている。

連続空間の埋め込みは、言語モデリングにおける「次元の呪い」[注釈 2]を軽減するために有効な手法である。訓練に用いるテキストの大きさ応じて語彙に含まれる固有の単語数も増える。このため、単語列の可能な組みわせ数が指数関数的に増加することにより、データ疎性の問題が発生する。そのため、確率を適切に推定するためには統計が必要となる。この問題を回避するため、ニューラルネットワークでは単語の表現を分散させる手法をとり、ネットワーク内の重みの非線形な組み合わせとして表現する[11]。また、ニューラルネットは言語関数を近似していると捉えることもできる。この目的に使用できるニューラルネットのアーキテクチャには、順伝播型回帰型の2種類がある。前者は単純であるが、後者の方がより一般的である[要解説][要出典]

ニューラルネット言語モデルは一般に、語彙 のすべての単語 について確率分布を予測することを目的とした確率的分類器英語版として構築・訓練される。 すなわち、ネットワークは、与えられた言語的コンテキストに基づいて、語彙の確率分布を予測するように訓練される。これは、バックプロパゲーションを用いた確率的勾配降下法などの標準的なニューラルネットワークの学習アルゴリズムによって行われる[11]。コンテキストは、先行する単語の固定サイズのウィンドウとすることができ、ネットワークは先行する k 個の単語を表す特徴ベクトルからを予測する[11]。もう一つの選択肢として、「過去」と「未来」の単語を特徴として使用し[12]、推定確率をとする、バッグ・オブ・ワードモデル英語版(bag-of-words model)と呼ばれるモデルもある。文脈中の単語の特徴ベクトルを連続演算で連結すると、このモデルは連続バッグ・オブ・ワード(Continuous bag-of-words、CBOW)アーキテクチャと呼ばれる[13]

第3の選択肢は、skip-gram英語版と呼ばれる言語モデルである[14]。これは先の問題を逆にして、与えられた単語から、文脈を出力するようにニューラルネットワークを訓練させるもので、CBOWよりも訓練に時間がかかるが、わずかに良い性能を得ることができる[13]。その目標は、訓練用の単語列 が与えられたとき、平均対数確率を最大化することである。ここで訓練文脈の大きさ k は、中央の単語 の関数とすることができる。skip-gramモデルとbag-of-wordsモデルは、word2vecプログラムの基礎をなしている[15]。 ニューラルネット言語モデルを使用する際に良く行われるのが、実際の確率を計算するのではなく、ネットワークの「隠れ層」に符号化された分散表現を単語の表現として利用するものである。各単語は「単語埋め込み」と呼ばれる n 次元の実数ベクトルが割り当てられる。ここで n は、出力層より前の層の大きさである。特徴的なのは、skip-gramモデルの表現が、単語間の意味的関係を線型結合としてモデル化し、それにより構成性英語版の形式を捉えることである。たとえば、このようなモデルでは、単語 w をその n 次元ベクトル表現に対応付ける関数 v があるとき、という式が成立し、ここで ≈ は正確には右辺が左辺の値の最近傍として定義される[13][14]

その他

[編集]

位置言語モデル(positional language model)は[16]、テキスト内で特定の単語が、すぐに隣接していなくても、近くに出現する確率を評価するものである。同様に、bag-of-conceptsモデルは[17]、「今日、私はとても素敵なクリスマスプレゼントをたくさん買った」のような情報量の多い文章でも、buy_christmas_present のような複数単語表現に関連付けて、そのセマンティクス(意味)を利用するものである。

手話のモデリングにおいては、ニューラルネットワークで一定の成功をあげているが[18]、他の技術が必要であることを研究者は認識している。

Generative Spoken Language Model (GSLM) は音声を入力とした言語モデルである[19][20][21][22]。文字列を入力として一切利用しない。音声は言語情報以外にパラ言語情報・非言語情報を含んでいるため、音声を入力とするGSLMが獲得する表現にはこれらの情報もコードされていると期待される[23]

評価とベンチマーク

[編集]

言語モデルの品質は、通常、典型的な言語指向タスクを反映した、人間が作成したサンプルベンチマークとの比較によって評価される。あまり確立されていないが、言語モデルに固有の特性を調べたり、2つのモデルを比較する品質テストの方法もある。言語モデルは通常は動的であり、訓練で遭遇したデータから学習することを目的としているため、提案されたモデルの中には、学習曲線を調べることによって、学習速度を評価するものもある[24]

言語処理システムを評価するために、いくつかのデータセットが開発されており、次のようなものがある[12]

  • 言語学的許容性コーパス(Corpus of Linguistic Acceptability、CoLA)[25]
  • GLUEベンチマーク(GLUE benchmark)[26]
  • マイクロソフトリサーチ・パラフレーズコーパス(Microsoft Research Paraphrase Corpus、MRPC)[27]
  • 多ジャンル自然言語推論(Multi-Genre Natural Language Inference、MultiNLI)
  • 質問自然言語推論(Question Natural Language Inference、QNLI)
  • Quora質問ペア(Quora Question Pairs、QQP)[28]
  • テキスト含意認識(Recognizing Textual Entailment、RTE)[29]
  • テキスト意味的類似度ベンチマーク(Semantic Textual Similarity Benchmark、STS)
  • スタンフォード質問応答データセット(Stanford Question Answering Dataset、SQuAD)[30]
  • スタンフォードセンチメントツリーバンク(Stanford Sentiment Treebank、SST[31]
  • Winograd NLI(WNLI)
  • BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC, OpenBookQA, NaturalQuestions, TriviaQA, RACE, MMLU (Measuring Massive Multitask Language Understanding), BIG-bench hard, GSM8k, RealToxicityPrompts, WinoGender, CrowS-Pairs.[32] (LLaMa Benchmark)

批評

[編集]

GPT(Generative pre-trained transformer)のような現代の言語モデルは、特定のタスクにおいて人間に匹敵する能力を発揮するが、認知モデルとしての妥当性は不確かになっている。たとえば、回帰型ニューラルネットワークの場合、人間が学習しないパターンを学習したり、人間が学習するパターンを学習できずに失敗することが知られている[33]

参考項目

[編集]
  • キャッシュ言語モデル英語版 - 確率分布によって特定の単語列に確率を割り当てる統計的な言語モデル
  • 深層言語処理英語版 - 理論的・記述的言語学における主に理論的な統語論/意味論を用いた言語モデル
  • Factored language model英語版 - 各単語をk個の因子のベクトルと見なした言語モデル
  • 生成的事前学習トランスフォーマー(Generative pre-trained transformers、GPT)- 事前学習と転位学習を組み合わせたニューラル言語モデルの一種
  • Katzバックオフモデル英語版- 生成的なn-gram言語モデルをの一種
  • 言語技術 - コンピュータ機器が人間のテキストや音声を扱う方法を研究する学問領域
  • 統計モデル - 標本データの生成に関する統計的仮定を具現化した数学モデル
  • 人工知能の倫理 - 人工知能システムに特化した技術倫理の一分野


備考

[編集]
  1. ^ デジタル無限性英語版の特徴
  2. ^ 次元の呪い: 言語モデルがより大規模なテキストで訓練されるにつれて、固有の単語(語彙)の数が指数関数的に増加すること。Heaps' law英語版を参照。

脚注

[編集]
  1. ^ Jurafsky, Dan; Martin, James H. (2021). “N-gram Language Models”. Speech and Language Processing (3rd ed.). https://web.stanford.edu/~jurafsky/slp3/ 24 May 2022閲覧。 
  2. ^ Kuhn, Roland, and Renato De Mori (1990). "A cache-based natural language model for speech recognition". IEEE transactions on pattern analysis and machine intelligence 12.6: 570–583.
  3. ^ a b Andreas, Jacob, Andreas Vlachos, and Stephen Clark (2013). "Semantic parsing as machine translation". Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers).
  4. ^ Pham, Vu, et al (2014). "Dropout improves recurrent neural networks for handwriting recognition". 14th International Conference on Frontiers in Handwriting Recognition. IEEE.
  5. ^ Htut, Phu Mon, Kyunghyun Cho, and Samuel R. Bowman (2018). "Grammar induction with neural language models: An unusual replication". arXiv:1808.10000.
  6. ^ Ponte, Jay M.; Croft, W. Bruce (1998). A language modeling approach to information retrieval. Proceedings of the 21st ACM SIGIR Conference. Melbourne, Australia: ACM. pp. 275–281. doi:10.1145/290941.291008
  7. ^ Hiemstra, Djoerd (1998). A linguistically motivated probabilistically model of information retrieval. Proceedings of the 2nd European conference on Research and Advanced Technology for Digital Libraries. LNCS, Springer. pp. 569–584. doi:10.1007/3-540-49653-X_34
  8. ^ Manning, Christopher D. (2022). “Human Language Understanding & Reasoning”. Daedalus. https://www.amacad.org/publication/human-language-understanding-reasoning. 
  9. ^ a b Jurafsky, Dan; Martin, James H. (7 January 2023). “N-gram Language Models”. Speech and Language Processing (3rd edition draft ed.). https://web.stanford.edu/~jurafsky/slp3/ed3book_jan72023.pdf 24 May 2022閲覧。 
  10. ^ The Unreasonable Effectiveness of Recurrent Neural Networks”. 2018年9月1日閲覧。
  11. ^ a b c Bengio, Yoshua (2008). "Neural net language models". Scholarpedia. Vol. 3. p. 3881. Bibcode:2008SchpJ...3.3881B. doi:10.4249/scholarpedia.3881
  12. ^ a b Devlin, Jacob; Chang, Ming-Wei; Lee, Kenton; Toutanova, Kristina (10 October 2018). "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding". arXiv:1810.04805 [cs.CL]。
  13. ^ a b c Mikolov, Tomas; Chen, Kai; Corrado, Greg; Dean, Jeffrey (2013). "Efficient estimation of word representations in vector space". arXiv:1301.3781 [cs.CL]。
  14. ^ a b Mikolov, Tomas; Sutskever, Ilya; Chen, Kai; Corrado irst4=Greg S.; Dean, Jeff (2013). Distributed Representations of Words and Phrases and their Compositionality (PDF). Advances in Neural Information Processing Systems. pp. 3111–3119.
  15. ^ Harris, Derrick (16 August 2013). “We're on the cusp of deep learning for the masses. You can thank Google later”. Gigaom. 2015年6月22日閲覧。
  16. ^ Lv, Yuanhua; Zhai, ChengXiang (2009). "Positional Language Models for Information Retrieval in" (PDF). Proceedings. 32nd international ACM SIGIR conference on Research and development in information retrieval (SIGIR).
  17. ^ Cambria, Erik; Hussain, Amir (2012-07-28) (英語). Sentic Computing: Techniques, Tools, and Applications. Springer Netherlands. ISBN 978-94-007-5069-2. https://books.google.co.jp/books?id=NrtcLwEACAAJ 
  18. ^ Mocialov, Boris; Hastie, Helen; Turner, Graham (August 2018). “Transfer Learning for British Sign Language Modelling”. Proceedings of the Fifth Workshop on NLP for Similar Languages, Varieties and Dialects (VarDial 2018): 101–110. arXiv:2006.02144. https://www.aclweb.org/anthology/W18-3911/ 14 March 2020閲覧。. 
  19. ^ Facebook AI. (2021). Textless NLP: Generating expressive speech from raw audio.
  20. ^ Lakhotia, et al. (2021). Generative Spoken Language Modeling from Raw Audio.
  21. ^ Polyak, et al. (2021). Speech Resynthesis from Discrete Disentangled Self-Supervised Representations.
  22. ^ Kharitonov, et al. (2021). Text-Free Prosody-Aware Generative Spoken Language Modeling.
  23. ^ "by having access to the full expressivity of oral language, models should incorporate nuances and intonations" Facebook AI. (2021). Textless NLP: Generating expressive speech from raw audio.
  24. ^ Karlgren, Jussi; Schutze, Hinrich (2015), “Evaluating Learning Language Representations”, International Conference of the Cross-Language Evaluation Forum, Lecture Notes in Computer Science, Springer International Publishing, pp. 254–260, doi:10.1007/978-3-319-64206-2_8, ISBN 9783319642055 
  25. ^ The Corpus of Linguistic Acceptability (CoLA)”. nyu-mll.github.io. 2019年2月25日閲覧。
  26. ^ GLUE Benchmark” (英語). gluebenchmark.com. 2019年2月25日閲覧。
  27. ^ Microsoft Research Paraphrase Corpus” (英語). Microsoft Download Center. 2019年2月25日閲覧。
  28. ^ Aghaebrahimian, Ahmad (2017), “Quora Question Answer Dataset”, Text, Speech, and Dialogue, Lecture Notes in Computer Science, 10415, Springer International Publishing, pp. 66–73, doi:10.1007/978-3-319-64206-2_8, ISBN 9783319642055 
  29. ^ Recognizing Textual Entailment”. February 24, 2019閲覧。
  30. ^ The Stanford Question Answering Dataset”. rajpurkar.github.io. 2019年2月25日閲覧。
  31. ^ Recursive Deep Models for Semantic Compositionality Over a Sentiment Treebank”. nlp.stanford.edu. 2019年2月25日閲覧。
  32. ^ Hendrycks, Dan (2023-03-14), Measuring Massive Multitask Language Understanding, https://github.com/hendrycks/test 2023年3月15日閲覧。 
  33. ^ Hornstein, Norbert; Lasnik, Howard; Patel-Grosz, Pritty; Yang, Charles (2018-01-09) (英語). Syntactic Structures after 60 Years: The Impact of the Chomskyan Revolution in Linguistics. Walter de Gruyter GmbH & Co KG. ISBN 978-1-5015-0692-5. https://books.google.com/books?id=XoxsDwAAQBAJ&dq=adger+%22goldilocks%22&pg=PA153 

推薦文献

[編集]
  • J M Ponte and W B Croft (1998). "A Language Modeling Approach to Information Retrieval". Research and Development in Information Retrieval. pp. 275–281. CiteSeerX 10.1.1.117.4237
  • F Song and W B Croft (1999). "A General Language Model for Information Retrieval". Research and Development in Information Retrieval. pp. 279–280. CiteSeerX 10.1.1.21.6467
  • Chen, Stanley; Joshua Goodman (1998). An Empirical Study of Smoothing Techniques for Language Modeling (Technical report). Harvard University. CiteSeerX 10.1.1.131.5458
{{bottomLinkPreText}} {{bottomLinkText}}
言語モデル
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?