記事作成日:2023年11月6日


AI

新聞記事でAIに関する重要な英語の論文が紹介されていました。 その論文は経済研究へのAIの活用(特にLLMという言語モデル)に関する内容ですが、実際のビジネスでも活用できる内容と 考え、その翻訳をしてみました。 30ページほどの論文ですが、重要な部分だけを選択して英語と日本語訳の対比という形式で数回に分けて紹介します。

今回は全11回中の8回目です。

第1回 1 Introduction:はじめに
第2回 2 What Are LLMs?:LLMとは何か?
第3回 3 Applications:応用
第4回 3.1 Ideation:アイデア出し
第5回 3.2 Writing:執筆
第6回 3.3 Background Research:背景調査
第7回 3.4 Coding:コーディング
第8回 3.5 Data Analysis:データ分析
第9回 3.6 Mathematical Derivations:数学的導出
第10回 3.7 Summary:まとめ
第11回 4 Outlook and Concluding Thoughts:展望と考察

3.5 Data Analysis

LLMs can format data, extract data from plain text, classify and score text, extract sentiment, and even simulate human test subjects. Moreover, what is perhaps most useful is that these capabilities can be accessed not only through a web interface, like what is shown in the demonstrations below, but also via an API (Application Programming Interface) that allows large amounts of data to be formatted, extracted, classified etc. These operations can be performed in batches to remain within the token limit for each request. (It goes without saying that LLMs can write computer code in order to access their own APIs for example, try out “Python code to ask GPT3 to extract birth dates from text input”.)

3.5 データ分析

LLMは、データの整形、フリーテキストからデータの抽出(データマイニング)、分類タスクや回帰タスク、感情分析などができます。さらに、これらの能力は、今回示す例のようにウェブインターフェースを通じてだけではなく、APIを介しても使用可能です。APIを使用した際に、より大量なデータの整形、加工、抽出、分類を行うことができ、そしてバッチごとに実行することによってトークン制限をはみ出さずに継続して処理できます。例えば、「テキストからGPT-3を用いて生年月日を抽出するためのPythonコード」を試してください。

3.5.1 Extracting data from text

The following example illustrates how LLMs can extract data from written text.

Mark got an A in econ and a B+ in math. Sally got an A- in both econ and math. Frank got a B in econ and a C in math.

Reformat as follows:
Name & econ grade & math grade

Mark & A & B+
Sally & A- & A-
Frank & B & C

The example provided is kept short for illustrative purposes. The data are names and grades, but other applications include numerical data, e.g., stock prices from news articles or dosage information from drug databases. When I prompted the system with “Can you provide examples of what kinds of numbers you can extract from text?” it answered the following 10 types: phone numbers, zip codes, social security numbers, credit card numbers, bank account numbers, dates, times, prices, percentages, measurements (length, weight etc.)

3.5.1 テキストからデータを抽出

次の例は、LLMがどうやってテキストからデータを抽出できるのかをデモストレーションします。

Markさんは経済学でA、数学でB+という成績をもらいました。Sallyさんは経済学と数学の両方でA-という成績をもらいました。Frankさんは経済学でB、数学でCという成績をもらいました。

これらを次のようにフォーマットの整形をしてください。
名前 & 経済学の成績 & 数学の成績

Mark & A & B+
Sally & A- & A-
Frank & B & C

今回の例は説明が目的なので、短くしています。今回、データは名前と成績ですが、他の応用例では、データがニュース記事から抽出される株価や医薬品データベースから抽出される投与量情報などの数値データも含まれます。 私がLLMのシステムに「テキストからどのような種類の数値を抽出できるのか、いくつか例をあげてください」と尋ねたところ、以下の10種類を答えてくれました:電話番号、郵便番号、社会保障番号、クレジットカード番号、銀行口座番号、日付、時刻、価格、パーセンテージ、寸法(長さ、重さなど)。

3.5.2 Reformatting data

LLMs are equally versatile translating data into the desired format. Building on the previous example, I asked the system to format the data first into comma-separated values (CSV) format and then to format it as a LaTeX table:

[continuing the previous example]
Reformat in CSV format:

Name,econ grade,math grade
Mark,A,B+
Sally,A-,AFrank,B,C

Write as a LaTeX table:

\begin{tabular}{lcc}
\hline
Name & econ grade & math grade \
\hline
Mark & A & B+ \
Sally & A- & A- \
Frank & B & C \
\hline
\end{tabular}

It excelled at both these and other similar tasks.

3.5.2 データの再フォーマット

LLMは希望するフォーマットにデータを柔軟に変換することも得意としています。 先程の例を用います。私はシステムに、データをCSV形式に変換し、その後LaTeXの表に変換するように求めました。

[前の例の続き]
CSV 形式で再フォーマットしてください:

Name,econ grade,math grade
Mark,A,B+
Sally,A-,A
Frank,B,C

LaTexの表として書いてください:

\begin{tabular}{lcc}
\hline
Name & econ grade & math grade \
\hline
Mark & A & B+ \
Sally & A- & A- \
Frank & B & C \
\hline
\end{tabular}

このように、LLMはこれらのタスクと類似したタスクで成功しています。

3.5.3 Classifying and scoring text

Social science research frequently employs statistical techniques to represent text as data (Gentzkow et al., 2019). Modern LLMs can go beyond traditional techniques for this because they increasingly understand the meaning of the sentences that they are fed. The following example asks GPT3.5 to classify whether a given task listed in the US Department of Labor’s Occupational Information Network (O*NET) database is easy or hard to automate and to justify its classi cation:

Here are 5 tasks from O*Net:

  1. Monitor operational records and reports to ensure accuracy and efficiency.
  2. Develop and implement policies and procedures for recordkeeping.
  3. Prepare and maintain employee records.
  4. Maintain and update filing, inventory, mailing, and database systems.
  5. Compile and prepare reports, charts, and graphs.

Please classify each of these tasks into easy or hard to automate. Provide your output in the form:
number; task; classi cation; five-word justification

1; Monitor operational records and reports to ensure accuracy and efficiency; Hard to Automate; Requires Human Judgment/Decision-Making
2; Develop and implement policies and procedures for recordkeeping; Hard to Automate; Requires Human Judgment/Decision-Making
3; Prepare and maintain employee records; Hard to Automate; Requires Human Judgment/Decision-Making
4; Maintain and update filing, inventory, mailing, and database systems; Easy to Automate; Repetitive and Structured Tasks
5; Compile and prepare reports, charts, and graphs; Easy to Automate; Repetitive and Structured Tasks

The results are reasonable, although I should emphasize that they are not entirely robust. Just like a human evaluator who may make different calls depending on circumstances, the system’s answers to what is essentially the same question change when the wording of the prompt is changed - and in some cases even when the order of the listed tasks is modified.

3.5.3 テキストの分類とスコアリング

社会科学の分野では、よく統計的な手法を用いて、テキストをデータとして表現しようとします(Gentzkow et al., 2019)。現代のLLMは入力された文章の意味を把握できるため、インサイトを抽出する能力は従来の手法を超えています。次の例は、GPT-3.5に、「米国労働省の職業情報ネットワーク (O*NET) データベースにリストされている特定のタスクを自動化するのが簡単か難しいか」を分類し、その分類の理由を説明するように指示しています。

以下はO*NETからの5つのタスク:

  1. 運用記録とレポートを監視し、正確さと効率性を確保する
  2. 記録保持のためのポリシーと手順の開発と実装
  3. 従業員の記録の作成と管理
  4. ファイル整理、在庫、郵送、データベースシステムの保守と更新
  5. レポート、チャート、グラフの編集

それぞれについて、自動化するのが簡単か難しいかを判断し、以下の形式で答えをアウトプットしてください:
番号; タスク名; 分類; 短い説明

1; 運用記録とレポートを監視し、正確さと効率性を確保する; 自動化が難しい; 人間の判断や意思決定が必要
2; 記録保持のためのポリシーと手順の開発と実装; 自動化が難しい; 人間の判断や意思決定が必要
3; 従業員の記録の作成と管理; 自動化が難しい; 人間の判断や意思決定が必要
4; ファイル整理、在庫、郵送、データベースシステムの保守と更新; 自動化が簡単; 反復作業の多い体系化された作業
5; レポート、チャート、グラフの編集; 自動化が簡単; 反復作業の多い体系化された作業

出力された判断結果はそこそこ妥当に思いますが、完全にロバストではないということを強調しておきたいと思います。人間も状況次第で判断の結果が変わると同様に、LLMに関してもプロンプトを変更することによって返ってくる答えが異なります。時には、リストのなかのタスクの順番まで違ってくることがあります。

3.5.4 Extracting sentiment

LLMs can also extract sentiment from text. They can, for example, classify tweets into “positive” or “negative.” Similarly, they can categorize statements by the Federal Open Market Committee (FOMC) that sets US interest rates, as illustrated in the following example:

The following is the December 2022 FOMC statement: [accessed from Federal Reserve issues FOMC statement]
Recent indicators point to modest growth in spending and production. [remainder omitted for space reasons]
Is the statement hawkish or dovish?

The statement is hawkish. The Committee is raising the target range for the federal funds rate and reducing its holdings of Treasury securities and agency debt and agency mortgage-backed securities. The Committee is also strongly committed to returning inflation to its 2 percent objective.

The system’s assessment is correct and well-argued. I also explored whether the system could identify whether the December 2022 or February 2023 FOMC statement was more hawkish, but its ability to assess Fed-speak was not quite nuanced enough - it focused mainly on the interest rates in February 2023 being higher as opposed to the small and nuanced changes in the text of the statement that could indicate a change in direction.

3.5.4 感情の抽出

LLMはテキストから感情を抽出することもできます。例えば、SNSの投稿をポジティブまたはネガティブに分類します。同様に、次の例に示すように、米国の金利を決定する連邦公開市場委員会 (FOMC) の発言を分類することもできます。

以下にあるは2022年12月のFOMC声明です: [Federal Reserve issues FOMC statement からアクセス可能]
最近の指標は、支出と生産の緩やかな増加を示しています。[紙面の都合上、以下省略]
この発言はタカ派なのか、それともハト派なのかを判断してください。

この発言はタカ派的です。委員会はフェデラルファンド金利の目標レンジを引き上げるとともに、財務省証券、政府機関債券、政府機関モーゲージ担保証券の保有を削減しています。委員会はインフレ率を2%の目標に戻すことにも強力に取り組んでいます。

このシステムの評価は正しく、十分に議論されているように感じます。また、「2022年12月のFOMC声明と2023年2月のFOMC声明のどちらがよりタカ派的だったか」をシステムが識別できるかについても調査を行ったが、FRBの発言を評価するための微妙なニューアンスを十分に把握できておらず、2023年2月の金利が以前よりも高いことにほとんど全ての焦点を当てていました。これに対して声明文の些細な微妙な変化は、方向性の変化を示している可能性があります。

3.5.5 Simulating human subjects

Argyle et al. (2022) propose the use of LLMs to simulate human subjects, based on the observation that the training data of LLMs contains a large amount of information about humanity. They condition GPT3 on the socio-demographic backstories of real humans and demonstrate that subsequent answers to survey questions are highly correlated with the actual responses of humans with the described backgrounds, in a nuanced and multifaceted manner. Horton (2022) showcases applications to economics, using simulated test subjects to replicate and extend upon several behavioral experiments. The following example illustrates the concept:

For each of the following registered voters, would they approve or disapprove of a policy proposal loosen US immigration restrictions on well-educated workers?

  1. A 32-year old female lawyer in Houston, TX who is Hispanic
  2. A 73-year old male retired doctor in Rome, GA who is Caucasian
  3. A 25-year old software engineer in San Francisco, CA who is Asian and identi es as non-binary
  4. A 45-year old female grocery check-out clerk in Brooklyn, NY who is second-generation Italian
  5. A 55-year old insurance agent in Lake City, FL who is Caucasian

  1. Approve
  2. Disapprove
  3. Approve
  4. Approve
  5. Disapprove

There is a significant risk that the simulated results simply propagate false stereotypes, and they must hence be used with great care. However, they also contain valuable information. If used correctly, they can provide useful insights about our society, from which all the data used to train the LLMs ultimately originate.

3.5.5 人間をシミュレート

Argyle et al.(2022)はLLMを用いて、人間をシミュレートすることを提案しています。なぜならLLMの事前学習に用いられる大規模な言語データの中にヒュマニティ(人間性)、人間の振る舞いに関する大量な情報が含まれているからです。この研究では、GPT-3を実際の人間の社会人口学的背景に基づいてファインチューニングをし、アンケートの質問に対するLLMの回答が、同じ背景を持つ人間の反応と多角的に強く相関していることを実証しました。Horton (2022) は、いくつかの行動実験を再現および拡張し、経済学への応用を実証しています。次の例ではこの擬人化の概念を示しています。

次の登録有権者はそれぞれ、「高学歴の労働者に対する米国の入国制限の緩和政策」に賛成しますか?それとも反対しますか?

  1. テキサス州ヒューストン在住のヒスパニック系32歳女性弁護士
  2. ジョージア州ローマに住む73歳の白人男性退職医師
  3. カリフォルニア州サンフランシスコ在住の 25 歳のソフトウェアエンジニア。アジア人かつノンバイナリーと認識されている。
  4. ニューヨーク州ブルックリン在住のイタリア人二世で食料品店のレジ店員の女性(45歳)
  5. フロリダ州レイクシティ在住の55歳の白人で、保険代理店勤務。

  1. 承認する
  2. 不承認
  3. 承認する
  4. 承認する
  5. 不承認

シミュレーションされた結果は、差別的かつ誤ったステレオタイプを拡散してしまうという深刻なリスクがあります。そのため、シミュレーションの結果の扱いには細心の注意を払う必要があります。ただし、貴重な情報も含まれている可能性があります。LLM の訓練に使用されるデータが最終的に我々の社会に由来するため、正しく使用すれば社会についての有益な洞察が得られます。

参照



👇このページのQRコード


    この記事をシェア👉🏻



この記事のカテゴリー
この記事のタグ