SlideShare a Scribd company logo
6
Most read
9
Most read
19
Most read
Toolformer: Language Models Can Teach Themselves to Use Tools
岡田 領 / Ryo Okada
書誌情報
• Arxiv 2023/2
• LLMが必要に応じて必要なAPIを呼び出し利用する手法
• LLM自身の文脈理解能力を利用して,ツール(API)をいつ,どう使うのか,
自己教師づけし,データセットを作成し,finetuneする
大規模言語モデルの限界
• ChatGPTなどのLLMの弱点
• 最近の出来事などの最新情報にアクセスできな
い
• 事実を幻視(hallucinate)する傾向(身体的経験
がないので)
• 低情報の言語に弱くなる
• 正確な計算を行うための数学スキル欠如
• 時間経過の概念に無意識
Toolformerの概要
• 言語モデルが必要に応じて,必要な
外部APIをコールし,結果を利用す
る
• QA,Wikipedia検索,計算機,翻
訳...
• LLMの文脈理解能力を利用し,API
利用に特化したデータセットを作成
.そのデータセットでLLMを
finetuneする.
• 6.7Bの訓練済みGPT-Jを利用し,ゼ
ロショットの高精度を達成
全体の流れ(データセット作成)
• サンプルテキスト:Pittsburgh is also known as the Steel City
• Xを順番に入力:”Pittsburgh is also known as”でAPIコール位置と判断
• API callの候補を出力:”What other name is Pittsburgh know by?”
• API実行.結果をフィルタリング:”the Steel City”
• 最終的なAPI callと結果をデータセットに組み込み
Sampling API Calls
• 説明,例示つきプロンプト(右)と
xを順番にLLMに入力
• LLMは次トークンがAPI call開始位置
<API>かどうかの予測確率を出力
• Joe Biden was born in <API>
• 予測確率が閾値以上のtop k個の位置
をAPI位置として採用.
• k個の位置全てにおいて,LLMからそ
れぞれm個のAPI call候補をサンプリ
ング,API実行
Inputにx,Ouput: 以降にx1~iのトー
クンを順番に足していく
Filtering the Model
• API実行結果のフィルタリング
• API call位置iから後続の単語の予測確率
の重みつきcross entropy lossを計算
• 重みはAPI call位置から遠くなるほど小
(5つ先で0の値)
• API callなしと比べて, API call ciと結果
riをLLMに入力することで lossが小さく
なることを期待.
Fine-tuning the Model
• 全てのAPIに対して前述の作業が終わった
後,結果(APIコールと実行結果)をデー
タセットC*に組み込み,マージする.
• C*でLLMをfinetuning.
• C*にはモデルが将来のトークンを予測す
る上で役に立つ位置に適切なAPIが挿入さ
れている.結果,モデルは自身のフィー
ドバックからいつ,どのようなAPIを呼ぶ
かを学習する.
Inference
• モデルがAPI callに対する応答を期待
することを示す「→」を生成したら,
デコード中断
• API callを実行し,レスポンスを
</API>を挿入して,後続のデコード
を継続
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
使用したAPI
• 使用したAPIの選定基準
• 入出力がテキスト形式
• 意図した使い方のデモが得られるもの
実験
• Finetuneに用いたデータセット
• CCNet(webクロール)
• モデル
• GPT-J:通常のGPT-J
• GPT-J + CC:CのデータセットでfinetuningしたGPT-J
• Toolformer:API call用に拡張したデータセットC*でfinetuneしたGPT-J
• Toolformer (disabled):API callのデコードを無効にしたToolformer
• いずれのタスクもゼロショット
LAMA(Language Model Analysis)
• 日付や場所などが欠落している文章を埋めるタスク
計算
• 電卓APIを利用しているToolformerが圧倒的
Question Answering
Temporal Datasets
• “Cristiano Ronaldo plays for ___”(時間変化する事実)
• “What day of the week was it 30 days ago?”:(今日の日付がわかる必要)
• ただし,カレンダーAPIで今日の日付を取得し,その日付でQA APIをコールするのが理想
だが,1例に対して1APIコールしか許可していない(無限ループを避けるため
Scaling Law
• GPT-2(124M, 355M, 775M, 1.6B)でも検証
• 大きいモデルほど有用(APIコールの使い方を学習している)
Limitations
• 連鎖的なAPIの呼び出しはできない
• あるAPIの結果を利用して,別のAPIをコールする,など
• APIをインタラクティブには使えない
• 検索エンジンの大量の結果をブラウズして,その結果から検索クエリを絞
り込むなど.
• API callの判定が文章によってはセンシティブ
• Toolformer自体はAPI call先のコストは全く気にしないやり方
• Call先でLLMが動いていたり
Toolformer zero
• React app implementing OpenAI and Google APIs to re-create behavior
of the toolformer paper.
まとめ
• LLMの能力でアノテーションして,API callを実現する
• 6.7BパラメータのGPT-Jモデルのゼロショット性能を大幅に向上(検証したタ
スクではより大きなGPT-3モデルをも凌駕する性能
• プロンプトエンジニアリングが巧み
• API連携は単に能力拡張だけでなく,特定のデータ基盤から情報とってくるシ
ナリオなど実用面でかなり有用に感じる

More Related Content

PPTX
【DL輪読会】Hyena Hierarchy: Towards Larger Convolutional Language Models
PDF
【DL輪読会】GPT-4Technical Report
PDF
【DL輪読会】Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Mo...
PPTX
[DL輪読会]Pay Attention to MLPs (gMLP)
PPTX
【DL輪読会】Scaling Laws for Neural Language Models
PPTX
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
PPTX
【DL輪読会】Flow Matching for Generative Modeling
PDF
【DL輪読会】Foundation Models for Decision Making: Problems, Methods, and Opportun...
【DL輪読会】Hyena Hierarchy: Towards Larger Convolutional Language Models
【DL輪読会】GPT-4Technical Report
【DL輪読会】Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Mo...
[DL輪読会]Pay Attention to MLPs (gMLP)
【DL輪読会】Scaling Laws for Neural Language Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Flow Matching for Generative Modeling
【DL輪読会】Foundation Models for Decision Making: Problems, Methods, and Opportun...

What's hot (20)

PDF
Transformer メタサーベイ
PPTX
[DL輪読会]When Does Label Smoothing Help?
PPTX
[DL輪読会]Set Transformer: A Framework for Attention-based Permutation-Invariant...
PPTX
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
PDF
POMDP下での強化学習の基礎と応用
PDF
ゼロから始める転移学習
PDF
Attentionの基礎からTransformerの入門まで
PPTX
【DL輪読会】The Forward-Forward Algorithm: Some Preliminary
PDF
【メタサーベイ】基盤モデル / Foundation Models
PDF
SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向
PDF
機械学習モデルの判断根拠の説明
PPTX
PyTorchLightning ベース Hydra+MLFlow+Optuna による機械学習開発環境の構築
PPTX
Transformerを雰囲気で理解する
PDF
最適化超入門
PDF
BlackBox モデルの説明性・解釈性技術の実装
PDF
[DL輪読会]Understanding Black-box Predictions via Influence Functions
PDF
[DL輪読会]Learning Transferable Visual Models From Natural Language Supervision
PDF
Transformerを多層にする際の勾配消失問題と解決法について
PDF
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
PPTX
【DL輪読会】Flamingo: a Visual Language Model for Few-Shot Learning 画像×言語の大規模基盤モ...
Transformer メタサーベイ
[DL輪読会]When Does Label Smoothing Help?
[DL輪読会]Set Transformer: A Framework for Attention-based Permutation-Invariant...
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
POMDP下での強化学習の基礎と応用
ゼロから始める転移学習
Attentionの基礎からTransformerの入門まで
【DL輪読会】The Forward-Forward Algorithm: Some Preliminary
【メタサーベイ】基盤モデル / Foundation Models
SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向
機械学習モデルの判断根拠の説明
PyTorchLightning ベース Hydra+MLFlow+Optuna による機械学習開発環境の構築
Transformerを雰囲気で理解する
最適化超入門
BlackBox モデルの説明性・解釈性技術の実装
[DL輪読会]Understanding Black-box Predictions via Influence Functions
[DL輪読会]Learning Transferable Visual Models From Natural Language Supervision
Transformerを多層にする際の勾配消失問題と解決法について
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
【DL輪読会】Flamingo: a Visual Language Model for Few-Shot Learning 画像×言語の大規模基盤モ...
Ad

Similar to 【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools (20)

PDF
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
PPTX
【DL輪読会】大量API・ツールの扱いに特化したLLM
PDF
機械学習応用アーキテクチャ・デザインパターン概観
PDF
MLflowによる機械学習モデルのライフサイクルの管理
PPTX
Amazon SageMaker Foundation Modelsで事前学習済みモデルを利用する
PDF
広告文生成タスクの規定とベンチマーク構築
PPTX
【第3回】生成AIなんでもLT会 2024_0304なんでも生成AI_sergicalsix.pptx
PDF
ChatGPTの仕組みの解説と実務でのLLMの適用の紹介_latest.pdf
PDF
W&B webinar finetuning_配布用.pdf
PDF
【論文レベルで理解しよう!】​ 大規模言語モデル(LLM)編​
PDF
機械学習デザインパターン Machine Learning Design Patterns
PDF
DLゼミ: Llama 2: Open Foundation and Fine-Tuned Chat Models
PDF
機械学習型サービス運用時の課題と実践的手法
PPTX
MLOps NYC 2019 and Strata Data Conference NY 2019 report nttdata
PPTX
先駆者に学ぶ MLOpsの実際
PPTX
ChatGPT Impact - その社会的/ビジネス価値を考える -
PDF
機械学習工学と機械学習応用システムの開発@SmartSEセミナー(2021/3/30)
PDF
MAごころを、君に - #7 ChatGPT勉強会(2023-03-28)
PPTX
「機械学習とは?」から始める Deep learning実践入門
PPTX
MLflowで学ぶMLOpsことはじめ
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
【DL輪読会】大量API・ツールの扱いに特化したLLM
機械学習応用アーキテクチャ・デザインパターン概観
MLflowによる機械学習モデルのライフサイクルの管理
Amazon SageMaker Foundation Modelsで事前学習済みモデルを利用する
広告文生成タスクの規定とベンチマーク構築
【第3回】生成AIなんでもLT会 2024_0304なんでも生成AI_sergicalsix.pptx
ChatGPTの仕組みの解説と実務でのLLMの適用の紹介_latest.pdf
W&B webinar finetuning_配布用.pdf
【論文レベルで理解しよう!】​ 大規模言語モデル(LLM)編​
機械学習デザインパターン Machine Learning Design Patterns
DLゼミ: Llama 2: Open Foundation and Fine-Tuned Chat Models
機械学習型サービス運用時の課題と実践的手法
MLOps NYC 2019 and Strata Data Conference NY 2019 report nttdata
先駆者に学ぶ MLOpsの実際
ChatGPT Impact - その社会的/ビジネス価値を考える -
機械学習工学と機械学習応用システムの開発@SmartSEセミナー(2021/3/30)
MAごころを、君に - #7 ChatGPT勉強会(2023-03-28)
「機械学習とは?」から始める Deep learning実践入門
MLflowで学ぶMLOpsことはじめ
Ad

More from Deep Learning JP (20)

PPTX
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
PPTX
【DL輪読会】事前学習用データセットについて
PPTX
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
PPTX
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
PPTX
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
PPTX
【DL輪読会】マルチモーダル LLM
PPTX
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
PDF
【DL輪読会】Can Neural Network Memorization Be Localized?
PPTX
【DL輪読会】Hopfield network 関連研究について
PPTX
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
PDF
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
PDF
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
PPTX
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
PDF
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
PPTX
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
PDF
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
PDF
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
PPTX
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
PPTX
【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...
PDF
【DL輪読会】Deep Transformers without Shortcuts: Modifying Self-attention for Fait...
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
【DL輪読会】事前学習用データセットについて
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
【DL輪読会】マルチモーダル LLM
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
【DL輪読会】Can Neural Network Memorization Be Localized?
【DL輪読会】Hopfield network 関連研究について
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...
【DL輪読会】Deep Transformers without Shortcuts: Modifying Self-attention for Fait...

【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools