Upgrade to Pro — share decks privately, control downloads, hide ads and more …

大規模言語モデル (LLM) の進化: GPT 以降の最新動向 / AWS Dev Day 2023 - Evolution of LLM since GPT

大規模言語モデル (LLM) の進化: GPT 以降の最新動向 / AWS Dev Day 2023 - Evolution of LLM since GPT

このセッションでは、最新の大規模言語モデル (LLM) とその技術的進歩を紹介し、自然言語処理タスクやクリエイティブなテキスト生成、コード生成などの実践的なデモンストレーションを通じて、LLM の多様な応用例を探ります。また、スタートアップや大企業での活用事例や学術研究での成果を紹介し、LLM の未来に関するチャレンジや機会についても議論します。このセッションを通じて、開発者やアーキテクトは LLM の最新動向を理解し、その応用や技術的な発展に対する洞察を深めることができます。

https://aws.amazon.com/jp/events/devday/japan/

Yoshitaka Haribara

June 23, 2023
Tweet

More Decks by Yoshitaka Haribara

Other Decks in Technology

Transcript

  1. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. ⼤規模⾔語モデル (LLM) の進化: GPT 以降の最新動向 Yoshitaka Haribara, Ph.D. F - 1 Sr. Startup ML Solutions Architect AWS Japan G.K.
  2. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 本セッションをご覧頂きありがとうございます。スライド閲覧にあたり 以下の注意事項を理解した上で読み進めて頂くようお願いします: 1. 作成時期: 本スライドは 2023/6/23 開催の AWS Dev Day 2023 登壇資料のため、それ以前の情報に基づき作成されています 2. 対象者: 流⾏りの技術トレンドを⼀歩踏み込んで理解したい AWS Dev Day 参加者層 (アプリケーション開発者) 向けです 3. 内容: LLM の技術的背景を理解するセッションであり、機械学習の 前提知識が必要な内容も含まれます。Generative AI, LLM の全体像 については AWS Dev Day General Session 2 でも触れています はじめに
  3. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Agenda • ⼤規模⾔語モデル (LLM) の創発的な能⼒ § LLM の進化: 特に GPT, GPT-2, GPT-3 § 新たな能⼒の獲得: zero/few-shot in-context learning や Chain-of-thought • ⼈間の意図に沿った対話の実現 § Instruction fine-tuning § Reinforcement Learning from Human Feedback (RLHF) • LLM の活⽤に向けたモデル選択の指針 § ベンチマーク、オープンソースの⽇本語 LLM
  4. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Generative AI
  5. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. コード⽣成: Amazon CodeWhisperer
  6. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. ⼤規模⾔語モデルの創発的な能⼒
  7. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⾔語モデル (Language Model, LM) • ⾔語モデリングとは、与えられた⽂章の次にくる単語を予測するタスク § 「学⽣が本を___」 – ⾷べた Ø 開いた – 泣いた – 焼いた • 逐次的に次の単語を予測することで、⽂章を⽣成 • ⾔語モデリングを⾏うものを⾔語モデル (LM) と呼ぶ § 伝統的には n-gram, RNN, LSTM § GPT に代表されるような、 Transformer をベースとした Decoder モデルが現在の主流。⼤規模化の流れ… Transformer Decoder
  8. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⼤規模⾔語モデル (Large Language Model, LLM) https://www.economist.com/interactive/briefing/2022/06/11/huge-foundation-models-are-turbo-charging-ai-progress [Sevilla et al., 2022] Log (FLOPS) GPT-2 (1.5B) GPT-3 (175B) PaLM (540B)
  9. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 3種類のアーキテクチャとモデルの例 Encoder (例: BERT) • 双⽅向の self-attention • ⽂章分類や⽂章校正など • 逐語的な予測に向かない Decoder (例: GPT) • 最近の⾔語モデルは Transformer Decoder が主流 • ⽂章⽣成がしやすい Encoder-Decoder (例: T5) • 両⽅のパーツを組合せ • 翻訳などテキストから テキストへの変換
  10. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⾔語モデルの事前学習 (Pre-training) • ⾔語モデリング § 次にくる単語を予測 – 確率分布 𝑝! 𝑤" 𝑤#:"%#) をモデリング § ⾃⼰教師あり学習 (self-supervised learning) – ⼈間がラベルをつける必要がないので、学習データは⼤量にある • ⾔語モデリングによる事前学習 [Dai and Le, 2015] § ⼤量のテキストデータを⼊⼒し、ニューラル ネットワークが⾔語モデリングを⾏うよう学習 § ニューラルネットワークのパラメータ (重み) を保存 Decoder (Transformer, LSTM, ++)
  11. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 事前学習 (Pre-training) と Fine-tuning 19 ⼤量のテキストデータ テキスト⽣成 要約 情報抽出 Q&A チャットbot LLM (Transformer, LSTM, ++) 幅広いタスク 事前学習 (Pre-training) タスク適応 (fine-tuning, in-context learning)
  12. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. LMM のスケーリングにおける「べき乗則」 • 計算量 (FLOPS) ∝ parameters * tokens § モデルの学習コスト 𝐶 (FLOPS) はパラメータ数 𝑁 とトークン数 𝐷 に⽐例 𝐶 = 6𝑁𝐷 • べき乗則 § モデルの性能は、トークン数とパラメータ数を増やせば向上 Figure 1 in [Kaplan et al., 2020]
  13. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. モデルサイズとデータの⼤規模化 • モデルサイズ (パラメータ数) とデータ量 (トークン数) の⼤規模化。 あるいは、⼗分なデータ量に対して最適なモデルサイズ [Hoffmann et al., 2022] Model Parameters Tokens (Data size) GPT [Radford et al., 2018] 117M 3B tokens (4.6 GB) GPT-2 [Radford et al., 2019] 1.5B 28B tokens (40 GB) LaMDA [Thoppilan et al., 2022] 137B 168B tokens GPT-3 [Brown et al., 2020] 175B 400B tokens (600+ GB) Jurassic [Lieber et al., 2021] 178B 300B tokens Gopher [Rae et al., 2021] 280B 300B tokens MT-NLG 530B [Smith et al., 2022] 530B 270B tokens PaLM [Chowdhery et al., 2022] 540B 780B tokens GPT-4 [OpenAI, 2023] ?? ?? Chinchilla [Hoffmann et al., 2022] 70B 1.4T tokens
  14. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. LLM の「創発的」な能⼒ • LLM のパラメータ数・学習データ量を増やすと、 あるところを境に、突然新しい能⼒を獲得する [Wei et al., 2022] § このことを創発的 (emergent) という Figure 2 and Table 1 in [Wei et al., 2022]
  15. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. GPT OpenAI により提案された Generative Pretrained Transformer (GPT) • GPT (117M パラメータ [Radford et al., 2018]) § Transformer decoder 12層 § BooksCorpus (7千冊以上の本、テキスト 4.6 GB) で学習 § LLM の事前学習が、⾃然⾔語理解 (常識推論、質問応答、含意関係認識など) の 幅広いタスクに有効だと⽰した 例: 包含 [START] 男が⽞関にいる [DELIM] その⼈はドアの近くにいる [EXTRACT]
  16. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. GPT-2 • GPT-2 (1.5B パラメータ) § GPT と同じアーキテクチャで⼤規模化 (117M → 1.5B) § より⼤きなデータで学習: 4.6 GB → インターネットのテキスト 40 GB (WebText) – ソーシャルニュースサイト Reddit からの外部リンクのうち、 3+ upvote をスクレイピング (⼈間による品質担保の代替) [Radford et al., 2019]
  17. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Zero-shot Learning • GPT-2 の特徴のひとつは Zero-shot learning* [Radford et al., 2019] § 例⽰なし、重みのアップデートなしに、様々なタスクをこなせる § 正しい系列予測問題を指定 (例: 質問応答) – ⽂: ⼤⾕ 翔平 は… Q: ⼤⾕ 翔平 はどこで⽣まれた︖ A: … § 系列の⽣起確率を⽐較 (例: Winograd Schema Challenge [Levesque et al., 2011, 柴⽥ら 2015]) – ボブ は ジャック にオムレツを作った。彼 は作り⽅を知っていたからだ。 – 「彼」 = ボブ or ジャック︖ • ≡ P(“ボブ は作り⽅を知っていた”) ≧ P(“ジャック は作り⽅を知っていた”) ? * “Zero-shot learning” や後に紹介する “Few-shot learning” は元々画像認識の分野で、 対象となるデータがない・少ない場合に学習させる⼿法を指す⾔葉として⽤いられていた [Palatucci et al., 2009]
  18. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Zero-shot Learning • GPT-2 は⾔語モデルのベンチマークで、 タスクごとのファインチューニングなしに SOTA を超える Table 3 in [Radford et al., 2019] – LAMBADA (language modeling w/ long discourse dependencies) ベンチマーク Example (5), Figure 1 in [Paperno et al., 2016] • Context: 彼は⾸を振り、⼀歩下がって両⼿を挙げ、タバコを失くさないよう笑おうとした。「はい、 どうぞ」とジュリアは安⼼させるような声で⾔った。「すでに友達にフォーカスを合わせているから、 あとはシャッターを切るだけ」 • Target sentence: 彼は⽺のように頷き、タバコを捨て、______ を取った。 • Target word: カメラ
  19. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. GPT-3 • GPT-3 (175B パラメータ [Brown et al., 2020]) § パラメータ数増加 (1.5B → 175B) § データサイズ増加 (40 GB → 600 GB 以上)
  20. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Few-shot Learning • いくつかの例⽰をした上でタスクを指定すると、GPT-3 がタスクに対し て fine-tuning された BERT Large より⾼い性能を⽰す [Brown et al., 2020] § 重みの更新を伴わないという意味で In-context learning (ICL)* とも Figure 2.1 and Figure 3.8 in [Brown et al., 2020] *Few-shot Learning はパラメータ更新を含む⽤法もあるが、ここではパラメータ更新を伴わない。
  21. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 従来の Fine-tuning との違い In-context (few-shot) learning • いくつかの例⽰のみで、 モデルのパラメータ更新を伴わない • プロンプトを⼯夫することにより 様々なタスクに対応 • プロンプトエンジニアリングの台頭 Fine-tuning モデルの パラメータ更新を ⾏う Figure 2.1 in [Brown et al., 2020]
  22. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Chain-of-Thought (CoT) • 答えだけでなく考え⽅を伝えると、 簡単な算術問題が解ける [Wei et al., 2022] Figure 1 in [Wei et al., 2022]
  23. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Zero-shot の Chain-of-Thought (CoT) • “Let’s think step by step.” と⾔うだけでも性能が上がる [Kojima et al., 2022] Table 2 in [Kojima et al., 2022] ← Zero-shot から⼤幅な改善 ただし Few-shot (⼿動) CoT ほどではない
  24. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Agenda • ⼤規模⾔語モデル (LLM) の創発的な能⼒ § LLM の進化: 特に GPT, GPT-2, GPT-3 § 新たな能⼒の獲得: zero/few-shot in-context learning や Chain-of-thought • ⼈間の意図に沿った対話の実現 § Instruction fine-tuning § Reinforcement Learning from Human Feedback (RLHF) • LLM の活⽤に向けたモデル選択の指針 § ベンチマーク、オープンソースの⽇本語 LLM
  25. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. ⼈間の意図に沿った対話の実現
  26. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⾔語モデルで⾃然な対話を実現するには︖ • ユーザーの意図にアラインさせる Fine-tuning [Ouyang et al., 2022] https://openai.com/research/instruction-following Prompt Completion 6歳の⼦供に⽉⾯着陸を数⾏で説明してください。 GPT-3 6歳児に重⼒理論を説明する。 6歳の⼦供に相対性理論を数⾏で説明する。 6歳児にビッグバン理論を説明する。 6歳児に進化論を説明する。 InstructGPT ⼈々は⽉に⾏き、⾒たものを写真に撮って地球に送り、 私たち全員がそれを⾒ることができるようにしたのです。
  27. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Instruction fine-tuning (Instruction tuning) • Flan: テンプレート化された⼤量のタスク (指⽰と回答のペア) により LLM の更なる性能向上 [Chung et al., 2022] § T5, PaLM を 1.3k タスクで instruction fine-tuning Figure 1 in [Chung et al., 2022] を改変 次の質問に答えてください。 窒素の沸点は︖ −195.79 °C 以下の問題を step-by-step で 考えて。⾷堂にりんごが23個。 20個をランチに使って6個追加 で買うと、いくつ残る︖ ⾷堂には元々23個リンゴが あり、20個をランチに。 23 – 20 = 3 個。追加で6つ リンゴを買うと 3 + 6 = 9
  28. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Parameter-efficient fine-tuning (PEFT) • Fine-tuning において、すべてのパラメータを更新せず、 ⼀部あるいは新規かつ少数の重みのみを変更 • Low-rank adaptation (LoRA) では、重み⾏列の更新差分を低ランク近似 して fine-tuning [Hu et al., 2021] § QLoRA: 量⼦化で更なるメモリ削減 [Dettmers et al., 2023] (Transformer, LSTM, ++) 𝑊 ∈ ℝ!×! 𝐴 ∈ ℝ#×! 𝐵 ∈ ℝ!×# 各重み⾏列 に対して 重み⾏列 低ランク近似 ∆𝑊 = 𝐵𝐴
  29. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Instruction fine-tuning の限界︖ • 学習⽤タスクのデータセットを集めるのが⾼コスト • オープンエンドなタスクでは、⽣成された回答に対する正解がない § 「⽝と、ペットのバッタについての話を書いてください」 • ⾔語モデルは、トークンごとのミスへ平等にペナルティーをかける • Instruction fine-tuning を⾏なったモデルでも、⼈間の嗜好を満たす ように作られているわけではない。それを明⽰的に⾏う⽅法はあるか︖
  30. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Reinforcement Learning from Human Feedback (RLHF) ⼈間の嗜好に対して LLM を強化学習で最適化 • 強化学習 (Reinforcement Learning) は、環境の中での エージェントのアクションにより、得られる報酬を最⼤化 するよう学習させる枠組み [Williams, 1992; Sutton and Barto, 1998] § ゲーム [Mnih et al., 2013], 囲碁 [Silver et al., 2016] などへの応⽤ § ⾔語モデルへの適⽤は⽐較的最近の流れ [Ziegler et al., 2019; Stiennon et al., 2020; Ouyang et al., 2022] – 技術的な難易度が⾼いが、強化学習での進歩 (例: PPO [Schulman et al., 2017]) が ⼤規模なニューラルネットワークに有効だと分かってきた エージェント 環境 状態・報酬 アクション
  31. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Instruction fine-tuning + RLHF [Ouyang et al., 2022] Figure 2 in [Ouyang et al., 2022] を改変 ⽐較データを収集し、 報酬モデルを学習 強化学習で報酬モデルに 対してポリシーを最適化 デモデータを収集し、 ポリシーを教師あり学習 Supervised fine-tuning (SFT) Reward model (RM) training Proximal policy optimization (PPO) プロンプト データセットから サンプル取得 ラベラーが 期待される 出⼒を作成 このデータを⽤い GPT-3 を 教師あり学習で ファイン チューニング (supervised fine- tuning) プロンプトから いくつかの出⼒を サンプリング その出⼒に ラベラーが ランキングを付ける このデータを 報酬モデルの 学習に利⽤ データセットから 新しいプロンプト を取得 ポリシーが 出⼒を⽣成 報酬モデルで その出⼒による 報酬を計算 報酬に基づき PPO による ポリシーの アップデート
  32. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Agenda • ⼤規模⾔語モデル (LLM) の創発的な能⼒ § LLM の進化: 特に GPT, GPT-2, GPT-3 § 新たな能⼒の獲得: zero/few-shot in-context learning や Chain-of-thought • ⼈間の意図に沿った対話の実現 § Instruction fine-tuning § Reinforcement Learning from Human Feedback (RLHF) • LLM の活⽤に向けたモデル選択の指針 § ベンチマーク、オープンソースの⽇本語 LLM
  33. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. LLM の活⽤に向けたモデル選択の指針
  34. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock (limited preview) • 基盤モデルを使⽤した⽣成系 AI アプリケーションを構築するための マネージドサービス • 様々な基盤モデルをサポート、セキュアに利⽤可能 49 Titan Text Titan Embeddings Amazon Titan AI21 Labs, Anthropic, Stability AI (スタートアップ) による基盤モデル Jurassic-2 Claude Stable Diffusion
  35. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. オープンソースのモデル SageMaker JumpStart で利⽤可能な基盤モデル 51 モデル Cohere generate medium, light タスク テキスト⽣成 情報抽出 質問応答 要約 モデル Stable Diffusion, Upscaling タスク テキスト⼊⼒ から画像⽣成 既存画像の 解像度向上 Features Stable Diffusion 2.1 モデルのファイン チューニング モデル Falcon 40B/7B, Flan-T5 models, Flan-UL2, OpenLLaMA, GPT-J 6B, GPT-NeoXT- Chat-Base-20B, GPT2, DistilGPT2, Bloom/BloomZ タスク 機械翻訳 質問応答 要約 アノテーション データ⽣成 モデル AlexaTM 20B タスク 機械翻訳 質問応答 要約 アノテーション データ⽣成 モデル Jurassic-2 Ultra, Mid, Light タスク テキスト⽣成 質問応答 テキスト分類 チャット 要約 情報抽出 モデル Lyra-Fr 10B タスク テキスト⽣成 キーワード抽出 質問応答 要約 センチメント 分析 プロプライエタリなモデル
  36. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. モデル選択の指針 • モデルの提供形態・ライセンス § プロプライエタリ or オープンソース – オープンソースライセンスの確認: MIT, Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0), Apache 2.0 など、特に商⽤利⽤可能か • モデルのサイズ (パラメータ数) と⼊⼒⻑ (context length) § どの GPU ・チップで推論するか – NVIDIA A10G (EC2 G5), NVIDIA T4 (EC2 G4dn) など – カスタムシリコン AWS Inferentia2 (EC2 Inf2) も検討 • コストと性能のトレードオフ https://www.ai21.com/blog/simplifying-our-jurassic-2-offering
  37. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Holistic Evaluation of Language Models (HELM) • 幅広いシナリオ、 複数メトリクスでの測定、 標準化に重点を置き、 透明性を⾼めた ⾔語モデルの全体評価 • 例: Core scenarios Accuracy https://crfm.stanford.edu/helm/ S t a n f o r d C e n t e r f o r R e s e a r c h o n F o u n d a t i o n M o d e l s ( C R F M )
  38. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. LMSYS Org 3つの指標で評価 • Chatbot Arena Elo • チェスやスポーツなどの対戦型競技で⽤いられる イロレーティング (Elo rating) による相対評価。 “Chatbot Arena” UI で投票 • MT-Bench score [Zheng et al., 2023] • MMLU [Hendrycks et al., 2021] https://lmsys.org/blog/2023-06-22-leaderboard/ U C B e r k e l e y w t h U C S D & C M U Table 1. LLM Leaderboard (Timeframe: April 24 - June 19, 2023). The latest and detailed version here.
  39. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. オープンソースの⽇本語 LLM • Rinna § GPT-NeoX (3.6B Pre-trained, Instruction “SFT v2”, RLHF “PPO”), GPT-2, GPT, etc. – License: MIT • CyberAgent § OpenCALM (Small, Medium, Large, 1.4B “1B”, 2.7B “3B”, 6.8B “7B”) – License: CC BY-SA 4.0 • ABEJA § GPT-NeoX (2.7B), GPT-2 – License: MIT • Retrieva § T5 (Small - XL) – License: CC BY-SA 4.0 • 関連情報 § よく使われるデータセット – Common Crawl • mC4 (ja): 160B tokens • CC-100 (ja): 10B tokens – Wikipedia (ja): 0.5B tokens § Stability AI による⽇本語 LLM 評価 – https://github.com/Stability-AI/lm-evaluation- harness/tree/jp-stable H u g g i n g F a c e H u b
  40. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. LLM のリスク • LLM は幅広い業界へのインパクトを与える [Eloundou et al., 2023] ⼀⽅で、以下のようなリスクを内包することに注意 • 幻覚 (Hallucination) § LLM は尤もらしいウソ (事実と異なる、⽂脈と無関係) を⽣成することがある [Ji et al., 2022] • 著作権侵害 (Copyright Violation) § LLM による⽣成物に既存の著作物との類似性や依拠性が認められれば、著作権 侵害となる可能性がある [AIと著作権の関係等について] § 以下も参照 AWS Dev Day セッション F-5: 「⽣成系 AI 」と「ソフトウェアライセンス」の今
  41. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. まとめ • ⼤規模⾔語モデル (LLM) の創発的な能⼒ § LLM の進化: 特に GPT, GPT-2, GPT-3 § 新たな能⼒の獲得: zero/few-shot in-context learning や Chain-of-thought • ⼈間の意図に沿った対話の実現 § Instruction fine-tuning § Reinforcement Learning from Human Feedback (RLHF) • LLM の活⽤に向けたモデル選択の指針 § ベンチマーク、オープンソースの⽇本語 LLM → 参考資料や on AWS で動くコンテンツは末尾にまとめてあります
  42. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Thank you! © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Yoshitaka Haribara @_hariby
  43. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 参考資料
  44. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. References • Stanford CS224N: Natural Language Processing with Deep Learning https://web.stanford.edu/class/cs224n/ • Lecture 9. Pretraining (by John Hewitt) [slides] • Lecture 11. Prompting, Reinforcement Learning from Human Feedback (by Jesse Mu) [slides] • Hugging Face Blog: Illustrating Reinforcement Learning from Human Feedback (RLHF) https://huggingface.co/blog/rlhf
  45. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Further reading • 「⼤規模⾔語モデルの驚異と脅威」 • by 岡崎 直観 • https://speakerdeck.com/chokkan/20230327_riken_llm • 「⼤規模⾔語モデルは新たな知能か ―― ChatGPTが変えた世界」 • by 岡野原 ⼤輔 • https://www.amazon.co.jp/dp/4000297198 • 「BERTによる⾃然⾔語処理⼊⾨ ―Transformersを使った実践プログラミング―」 • by ストックマーク株式会社 • https://www.amazon.co.jp/dp/4274702405/ • https://github.com/stockmarkteam/bert-book
  46. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Appendix: On AWS で動くコンテンツ
  47. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での実装例 (Amazon EC2 Trn1) • Fine-tune T5 model on Trn1 § https://awsdocs-neuron.readthedocs- hosted.com/en/latest/frameworks/torch/torch- neuronx/tutorials/training/finetune_t5.html • Megatron-LM GPT (GPT-3 6.7B) Pretraining Tutorial § https://awsdocs-neuron.readthedocs- hosted.com/en/latest/frameworks/torch/torch- neuronx/tutorials/training/megatron_lm_gpt.html • Launch a GPT-3 pretraining job using neuronx-nemo-megatron § https://github.com/aws-neuron/aws-neuron-parallelcluster- samples/blob/master/examples/jobs/neuronx-nemo-megatron-gpt-job.md
  48. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での実装例 (Self-managed) • Training a 1 Trillion Parameter Model With PyTorch Fully Sharded Data Parallel (FSDP) on AWS ParallelCluster § https://medium.com/pytorch/training-a-1-trillion-parameter-model-with- pytorch-fully-sharded-data-parallel-on-aws-3ac13aa96cff • Distributed training with Amazon EKS and Torch Distributed Elastic § https://aws.amazon.com/blogs/machine-learning/distributed-training-with- amazon-eks-and-torch-distributed-elastic/
  49. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での実装例 (Amazon SageMaker) • Deploy Falcon-40B with large model inference DLCs on Amazon SageMaker § https://aws.amazon.com/blogs/machine-learning/deploy-falcon-40b-with- large-model-inference-dlcs-on-amazon-sagemaker/ • Run text generation with Bloom and GPT models on Amazon SageMaker JumpStart § https://aws.amazon.com/blogs/machine-learning/run-text-generation-with- gpt-and-bloom-models-on-amazon-sagemaker-jumpstart/ • Amazon SageMaker でファインチューニング (⽇本語 LLM あり) § https://github.com/aws-samples/aws-ml-jp/tree/main/tasks/generative- ai/text-to-text/fine-tuning/instruction-tuning
  50. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での実装例 (Amazon SageMaker) • Train EleutherAI GPT-J with PyTorch 1.8.1 and Pipeline Parallelism Using the SageMaker Model Parallelism Library § https://github.com/aws/amazon-sagemaker- examples/blob/main/training/distributed_training/pytorch/model_parallel/gp t-j/01_train_gptj_smp_notebook.ipynb • Train and Deploy GPT-J-6B model using Tensor Parallelism approach within SageMaker Model Parallel Library § https://github.com/aws/amazon-sagemaker- examples/blob/main/training/distributed_training/pytorch/model_parallel/gp t-j/11_train_gptj_smp_tensor_parallel_notebook.ipynb
  51. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での実装例 (Amazon SageMaker) • Train GPT-2 with PyTorch 1.12 and Tensor Parallelism Using the SageMaker Model Parallelism Library § https://github.com/aws/amazon-sagemaker- examples/blob/main/training/distributed_training/pytorch/model_parallel/gp t2/smp-train-gpt-simple.ipynb • Build flexible and scalable distributed training architectures using Kubeflow on AWS and Amazon SageMaker § https://aws.amazon.com/blogs/machine-learning/build-flexible-and-scalable- distributed-training-architectures-using-kubeflow-on-aws-and-amazon- sagemaker/
  52. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Retrieval Augmented Generation (RAG) • ⾼精度な⽣成系 AI アプリケーションを Amazon Kendra、LangChain、⼤規模⾔語モデルを使って作る § https://aws.amazon.com/jp/blogs/news/quickly-build-high-accuracy- generative-ai-applications-on-enterprise-data-using-amazon-kendra- langchain-and-large-language-models/ • Build a powerful question answering bot with Amazon SageMaker, Amazon OpenSearch Service, Streamlit, and LangChain § https://aws.amazon.com/blogs/machine-learning/build-a-powerful-question- answering-bot-with-amazon-sagemaker-amazon-opensearch-service- streamlit-and-langchain/ 73
  53. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. ブログ・イベント・公開事例
  54. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Generative AI 関連ブログ • AWS で⽣成系 AI を使⽤した構築のための新ツールを発表 § Amazon Bedrock, Amazon EC2 Trn1n/Inf2, Amazon CodeWhisperer § https://aws.amazon.com/jp/blogs/news/announcing-new-tools-for-building- with-generative-ai-on-aws/ • たった数枚の画像で Stable Diffusion をファインチューニングできる 効率的な Amazon SageMaker JumpStart の使い⽅ § https://aws.amazon.com/jp/blogs/news/fine-tune-text-to-image-stable- diffusion-models-with-amazon-sagemaker-jumpstart/ • ⽇本語⼤規模⾔語モデル OpenCALM の知識でクイズ王に挑戦する § https://aws.amazon.com/jp/blogs/news/open-calm-and-openai-chatgpt- accuracy-on-jaqket-experiment-in-amazon-sagemaker/ 75
  55. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock • AWS re:Inforce 2023 – Securely build generative AI apps & control data with Amazon Bedrock § https://www.youtube.com/watch?v=5EDOTtYmkmI
  56. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Generative AI イベント • JAWS-UG AI/ML #16: Generative AI § https://www.youtube.com/watch?v=PkZenNAXtYs • Generative AI(⽣成系 AI)へのアプローチ – 今、⾒直される AI 活⽤と変⾰を迎える⽣成系 AI 戦略 § https://aws.amazon.com/jp/blogs/news/aws-aiml-generative-ai-strategy/ • サービスに蓄積されたデータと⽣成系 AI で、新しい体験を創る⽅法 § https://www.youtube.com/watch?v=YHljCU6xwdU • 2023年 7⽉ 13⽇ (⽊) 開催予定 AWS Builders Online Series § https://aws.amazon.com/jp/events/builders-online-series/ 77
  57. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での基盤モデル構築 (公開事例) • Technology Innovation Institute trains the state-of-the-art Falcon LLM 40B foundation model on Amazon SageMaker § https://aws.amazon.com/blogs/machine-learning/technology-innovation- institute-trains-the-state-of-the-art-falcon-llm-40b-foundation-model-on- amazon-sagemaker/ • AWS re:Invent 2022 - How Stable Diffusion was built: Tips & tricks to train large AI models § https://www.youtube.com/watch?v=7I854do63Lg • Stability AI builds foundation models on Amazon SageMaker § https://aws.amazon.com/blogs/machine-learning/stability-ai-builds- foundation-models-on-amazon-sagemaker/
  58. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS 上での基盤モデル構築 (公開事例) • AI21 Labs が Amazon EC2 P4d インスタンス、PyTorch を使⽤して、 1,780 億のパラメータを備えた⾔語モデルをトレーニング § https://aws.amazon.com/jp/solutions/case-studies/AI21-case-study-p4d/ • 株式会社リコー ⽇本語に特化した 60 億パラメータ規模の GPT モデルの構築と評価 § https://www.anlp.jp/proceedings/annual_meeting/2023/pdf_dir/H9-4.pdf • Watashiha, K.K. (Trn1 のお客様事例) § https://aws.amazon.com/ec2/instance-types/trn1/
  59. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Thank you! © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Yoshitaka Haribara @_hariby