メルマガ読むならアプリが便利
アプリで開く

週刊Life is beautiful 2023年5月23日号: 人工知能の知能テスト

週刊 Life is beautiful
今週のざっくばらん 人工知能の知能テスト かなり昔の人工知能に関する論文を読んでいたところ(生憎なことにリンクは紛失してしまいました)、当時の人工知能には解けない問題として、 Fill an appropriate word in the space for this text. “I parked my car in the compact parking space because it looked __ enough”. という問題がありました。「私は自分の車を小型車用のスペースに止めました。十分に___見えたからです」。 人間であれば、文脈から it が駐車スペースのことであり、答えは big (もしくは、large や wide)であることは明確です。 そこで、最新のAIにこの問題を出したらどうなるかを試したところ興味深い結果になりました。 GPT3.5-turbo (OpenAI) “I parked my car in the compact parking space because it looked small enough.” I think “small” is an appropriate word to fill in the space because compact parking spaces are designed for smaller cars. Using the word “small” in this context indicates that the car being parked is the appropriate size for the designated parking space. GPT4 (OpenAI) “I parked my car in the compact parking space because it looked big enough.” I think “big enough” is appropriate because it indicates that the parking space was sufficiently sized for the car to fit, even though it is a compact space. This provides a clear reason for choosing that parking space. Bard (Google) The word that best fills in the blank is empty. This is because compact parking spaces are typically smaller than regular parking spaces, and they are designed for cars that are smaller in size. If a car is too large, it may not fit in a compact parking space without taking up more than one space. Therefore, the speaker parked their car in the compact parking space because it looked empty and they did not want to take up a regular parking space that could be used by another car. Here are some other words that could be used to fill in the blank: Available Unoccupied Unclaimed Vacant Free However, the word empty is the most accurate and specific word to use in this context. Claude (Anthropic) Here is the text with a word filled in and an explanation: I parked my car in the compact parking space because it looked small enough. I chose the word “small” because the sentence is describing a compact parking space, implying it is a smaller sized space. The phrase “looked __ enough” suggests the space appeared adequately sized for the car being parked in it. The word that fits best in this context is an adjective describing a relatively limited or diminished size. “Small” conveys this appropriately. Vicuna 13B (Open Source) I believe the word “narrow” would fit best in this text because the writer mentioned that the parking space was “compact.” A parking space that is “compact” is likely to be small and therefore “narrow” would be a good adjective to describe it. 正解を答えられたのは、GPT4のみで、GPT3.5とClaudeは “small”、Bardは “empty”、Vicunaは"narrow"と間違った回答をしています。 この問題が難しいのは、「文脈」をしっかりと理解するだけでなく、小型車用の駐車スペースは小さいけれども十分に大きければ大きな自動車を停めることが出来る、という「常識」を持っている必要がある点です。 GPT3.5とClaudeは、常識の方は持ち合わせているようですが、“it” が駐車スペースではなく自動車を指すと勘違いして、smallと答えたように見えます。確かに曖昧さはありますが、人間にはこの文脈では “it” が駐車スペースであることは明確です。Vicunaの間違いも同等です。 Bardは、自動車を駐車スペースに停めるには、そこが空いている必要がある、という一歩手前の部分とらわれた結果、大きさよりも空いているかどうかに着目して、"empty"という答えを出してしまったようです。 どのLLMも、単に「次の単語を予測する」ことから始まった人工知能にしては良くできていると思います。 Embedding-based Retrieval Embeddingsの活用方法をこのメルマガに書いたところ、実際のコードを見たいといリクエストが複数寄せられました。長々とソースコードを見せて解説すのはこのメルマガのスタイルに反するのでしませんが、私が Embeddings の仕組みの理解を深めるために行なったことを紹介することは出来ます。 私が教材として活用したのは、OpenAIが提供しているQuestion answering using embeddings-based searchというチュートリアルです。 GPTのトレーニングに使われたデータは2021年9月以前のものなので、あえて2022年のオリンピックを題材として選び、Embedding検索を活用してオリンピックの結果について質問に答えられるチャットボットを作る、というチュートリアルです。 このチュートリアルには、Wikipediaから取り出した2022年のオリンピックに関する情報がEmbedされた形で用意されているので、それを活用できるのです。自分でデータまで用意するとなると、そこに時間を取られてしまうので、手っ取り早くプロトタイプを作るのであれば、この手の既存のデータを使うのが賢い方法です。 チュートリアルは、このデータをネットからダウンロードし、メモリ中でEmbedding検索を行うという実装になっていますが、そのままだとアプリを立ち上げるたびに数分待たなければならないので、不便すぎます。そこで、Embedding検索をサービスとして提供している Pinecone という会社のオンラインデータベースに、そのデータを書き込むプログラムをまず書きました。 pd.read_csv()関数で OpenAI が提供しているCSV形式のデータを読み込み、apply()関数でリスト形式に変換した後、それぞれの行のデータをPineconeに格納(upsert)しています。Embeddingを作る際に使ったテキストは、"text"という名前のメタデータとして(後で取り出せるように)格納しています。 以上は、データの移行なので、一度だけ実行すれば十分です。 実際にユーザーから質問が入力された際には、fetch_related_article という関数を呼び出します。

この続きを見るには

この記事は約 NaN 分で読めます( NaN 文字 / 画像 NaN 枚)
これはバックナンバーです
  • シェアする
まぐまぐリーダーアプリ ダウンロードはこちら
  • 週刊 Life is beautiful
  • 「エンジニアのための経営学講座」を中心としたゼミ形式のメルマガ。世界に通用するエンジニアになるためには、今、何を勉強すべきか、どんな時間の過ごし方をすべきか。毎週火曜日発行。連載:菅首相に会って来た/米国で起業する時に知っておかねばならないこと。
  • 880円 / 月(税込)
  • 毎週 火曜日(年末年始を除く)