13
3

GPT Reseacherがそれなりのレポートを安定して生成できる要因を考察した

Posted at

要因考察のモチベーション

GPT Researcherを使用して、予想以上に良い体験ができました。このアプリに似たものを開発する際にこの考察が参考になればと思います。

GPT Reseacherとは

GPT Researcherは「様々なタスクに対する包括的なオンラインリサーチを行う自律的なエージェント」と説明されるオープンソースのアプリケーションです。

簡単に言えば、あるトピックについて調査を依頼すると、適切なレポートを生成してくれるアプリです。

GPT Reseacherが生成したレポート

⚠️GPT Reseacher v0.1.0、modelはGPT-4、検索エンジンはGoogleを使用しています。
以下は、GPT Researcherが生成したレポートの例です。"LLMを開発している日本のスタートアップ"についての調査を依頼した際のものです。(生成されたレポートのため、画像で示します。)
スクリーンショット 2023-11-22 21.12.27.png

使用してみた感想

使用してみた感想をまとめました。

  • 良いところ
    • それなりのレポートを安定して生成できる ❤️❤️❤️
    • 要求に応じたレポート様式まで考えてくれる ❤️❤️❤️
    • 生成が速い ❤️❤️❤️
    • ハルシネーションが抑えられている(気がする) ❤️❤️❤️
    • (プロンプトを直せば) 日本語で回答してくれる ❤️❤️❤️
    • 参考にした記事とサイトが分かりやすくまとまっている ❤️❤️❤️
    • カスタマイズ可能 ❤️❤️❤️
    • レポートだけでなく、調査のアウトライン作成やデータソースのレコメンドができる ❤️❤️❤️
    • 綺麗にスクレイピングしてくれている(ように見える) ❤️❤️
    • 実行状況が表示されるので、失敗している時にわかりやすい❤️❤️
    • 現在日時を考慮した調査をしてくれる ❤️
  • 課題
    • (Google検索を使用した場合に)検索先がweb記事でなくてプラットフォームだと情報がうまく抜けてこない 💔
    • デフォルトのままだと網羅はできない(時間がない時にパッと調べたい用途) 💔
    • 取得したデータソースには問いに対する答えがあるのに、レポートには書かれないことがある 💔
    • 検索サブクエリーがいけてない時がある💔

GPT Reseacherの処理の流れ

ブログに記載のあったアーキテクチャー↓に説明を追加しました。

  1. ユーザーから問いを受け付る。
  2. 問いに対して、どのようなレポートの体系にするのか方針を決める。また、そのレポート項目を満たすための、検索クエリーをサブクエリーとして生成する。
  3. retriver(検索エンジン)でデータの取得を行う。(私はGoogle検索をエンジンに選択しました。)
  4. 取得データをextractする。
  5. 取得データをそれぞれ問いに対応する形で要約する。
  6. 要約を用いて、最終的なレポートを生成する。

(本題)それなりの品質に見せられる要因

ここからが本題です。
コードやドキュメントを読んでそれなりのレポートを安定して生成できる要因を考察しました。

レポートがそれなりの品質に見える要因

1. レポートの体系をLLMが考える

ビジネス事例にはビジネス事例のレポート体系、政治のレポートには政治のレポートの体系を抑えるので、説得力のあるレポートに感じる。

"つくば市の行政課題の調査を依頼した際のレポート指示" と "LLMを開発している日本のスタートアップを調査を依頼した際のレポート指示" の比較。(生成物なので画像を載せています。)
スクリーンショット 2023-11-22 23.46.47.png

そして、レポート体系を作るためのプロンプトを生成する際の指示は以下のようになっている。

This task involves researching a given topic, regardless of its complexity or the availability of a definitive answer. The research is conducted by a specific server, defined by its type and role, with each server requiring distinct instructions.
Agent
The server is determined by the field of the topic and the specific name of the server that could be utilized to research the topic provided. Agents are categorized by their area of expertise, and each server type is associated with a corresponding emoji.

examples:
task: "should I invest in apple stocks?"
response: 
{
    "server": "💰 Finance Agent",
    "agent_role_prompt: "You are a seasoned finance analyst AI assistant. Your primary goal is to compose comprehensive, astute, impartial, and methodically arranged financial reports based on provided data and trends."
}
task: "could reselling sneakers become profitable?"
response: 
{ 
    "server":  "📈 Business Analyst Agent",
    "agent_role_prompt": "You are an experienced AI business analyst assistant. Your main objective is to produce comprehensive, insightful, impartial, and systematically structured business reports based on provided business data, market trends, and strategic analysis."
}
task: "what are the most interesting sites in Tel Aviv?"
response:
{
    "server:  "🌍 Travel Agent",
    "agent_role_prompt": "You are a world-travelled AI tour guide assistant. Your main purpose is to draft engaging, insightful, unbiased, and well-structured travel reports on given locations, including history, attractions, and cultural insights."
}

2. レポートフォーマットに則っている

レポートにはAPAスタイルがデフォルトで指定されているのでそれっぽく見える。
"You MUST write the report in {report_format} format.\n "

安定して生成できる要因

1. plan and solve な実装でレポート項目が欠落しない

実装は plan and solve にインスピレーションを得ている。
-> https://docs.tavily.com/blog/building-gpt-researcher#moving-from-infinite-loops-to-deterministic-results
何度か実行したが、レポート項目が欠けることはなかった。

2. 複数のサブクエリーで調査を行うため

複数のサブクエリーを作成して調査を行うため、1つの検索が悪くてもどうにかなる。
ブログに記載のあったアーキテクチャー↓

3. ユーザーの問いに答えられるデータソースに絞る

ユーザーの問いに答えられるデータソースに絞れるように、以下の指示が出されている。
Only cite the most relevant results that answer the query accurately

4. おまじない

重要な状況下だとLLMは底力を発揮すると言われているが、GPT Reseacherにも以下のプロンプトが埋まっていた。
"Please do your best, this is very important to my career. "

最後に

GPT Reseacherの考察は以上です。
GPT Reseacherは雑でも良いからスピードを重視する際はかなり便利だと感じました。
今後もLLM関連の記事を書いていくので、良かったらフォローといいね👍をお願い致します。

13
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
3