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

生成系 AI の活用を AWS のサービスで加速するアイディア / Accelerate GenAI on AWS

生成系 AI の活用を AWS のサービスで加速するアイディア / Accelerate GenAI on AWS

Yoshitaka Haribara

May 30, 2023
Tweet

More Decks by Yoshitaka Haribara

Other Decks in Technology

Transcript

  1. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. © 2023, Amazon Web Services, Inc. or its affiliates. 生成系 AI の活用を AWS のサービスで加速するアイディア 針原 佳貴 (Twitter: @_hariby) サ ー ビ ス に 蓄 積 さ れ た デ ー タ と 生 成 系 A I で 、 新 し い 体 験 を 創 る 方 法 シニア 機械学習 スタートアップ ソリューションアーキテクト アマゾン ウェブ サービス ジャパン
  2. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 針原 佳貴 (Yoshitaka Haribara, Ph.D.) • 2018 年 AWS 入社 • スタートアップ担当 ソリューションアーキテクト • 最近はミドル・レイターステージの スタートアップを中心に担当 • 機械学習や量子コンピューティングなど Deep Tech 分野を軸足 S r . S tar tup ML / Quan tum S olution s Ar c h ite c t
  3. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. Agenda AWS における⽣成系 AI ⽣成系 AI の利⽤⽅法 ⽣成系 AI ソリューション
  4. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. © 2023, Amazon Web Services, Inc. or its affiliates. AWS における生成系 AI 5
  5. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. AWS で⽣成系 AI を構築するには 12
  6. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 13 Amazon Bedrock 基盤モデルを使用した 生成系 AI アプリケーションを 構築およびスケーリングする最も簡単な方法 Limited Preview
  7. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. なぜ基盤モデルか? 14 テキスト生成 要約 情報抽出 Q&A チャットボット 事前学習 (Pretrain) 適応 タスク ラベル付け されていない データ 基盤モデル (FM) テキスト生成 要約 情報抽出 Q&A チャットボット 学習 デプロイ タスク ML models … … … … ラベル付き データ … … … …
  8. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Bedrock は幅広い基盤モデルをサポート 16 Titan Text Titan Embeddings Amazon Titan AI21 Labs, Anthropic, Stability AI (スタートアップ) による基盤モデル Jurassic-2 Claude Stable Diffusion
  9. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Titan Text ⾃然⾔語処理 (NLP) Titan Embeddings 検索と パーソナライゼーション Amazon Titan A m a z o n が 責 任 を も っ て 開 発 し た ⾼ 性 能 な 基 盤 モ デ ル 17 利点 • Amazon における 20 年以上の 機械学習の経験に基づき構築 • Amazon Titan Text FM を使⽤して、 要約やテキスト⽣成などの⾔語タスクを⾃動化 • Amazon Titan Embeddings FM で 検索精度の向上や、パーソナライズされた レコメンデーションを改善 • 不適切・有害なコンテンツを削減し、 責任ある AI の利⽤をサポート 17
  10. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⾃社データを使⽤して基盤モデルを独⾃にカスタマイズ 19 少数のラベル付データ 特定タスクでの精度を最⼤化 Fine-tune ⽬的 必要なデータ
  11. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 20 Amazon EC2 Trn1n and Amazon EC2 Inf2 クラウド上の学習・推論を 最も良いパーフォマンス/価格で実現する 目的特化の ML アクセラレータ NEW
  12. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⽣成系 AI のための⽬的特化型アクセラレータ (専⽤チップ) AWS Inferentia 最も低い推論コストで 深層学習モデルを クラウドにデプロイ 最大 70% 低い 推論コスト 同等な Amazon EC2 インスタンスと比較 AWS Trainium コスト効率・パフォーマンス が最も良い LLM と拡散モデルの学習 学習コストを 最大 50% 節約 同等な Amazon EC2 インスタンスと比較 AWS Inferentia2 LLM と拡散モデルの推論 において、最も低いコストで 高いパフォーマンス 40% 高い 価格性能比 同等な Amazon EC2 インスタンスと比較 21
  13. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. EC2 Trn1.32xlarge インスタンスで GPT ベースの日本語 モデルを事前学習しました。学習は 28 日以内に完了し、 以前の GPU ベースのインフラストラクチャよりもコスト を 33% 削減しました。 Yohei Kobashi 氏 株式会社わたしは 最高技術責任者 22
  14. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon CodeWhisperer A I が コ ー デ ィ ン グ の 相 棒 と な り 、 ア プ リ ケ ー シ ョ ン を 素 早 く 構 築 23 コード生成 AND Go, Rust, PHP, Ruby, Kotlin, C, C++, Shell scripting, SQL, and Scala AND JupyterLab, CLion, GoLand, WebStorm, Rider, PhpStorm, RubyMine, and DataGrip
  15. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. © 2023, Amazon Web Services, Inc. or its affiliates. ⽣成系 AI の利⽤⽅法 24
  16. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. SageMaker JumpStart での基盤モデルの利⽤ 25 Amazon SageMaker JumpStart 公開済み・プロプライエタリな 基盤モデルの実験・ カスタマイズと、⽣成系 AI アプリケーションへの組み込み デプロイ ⽣成系 AI ユースケー スに応じてモデルを デプロイ・推論 ブラウズ 公開済み・ プロプライエタリな 基盤モデルを探索 実験 デプロイ⽤のモデルを 選定する前に、 基盤モデルで実験 カスタマイズ 選択した基盤モデルを いちから学習せずに 独⾃データセットで カスタマイズ
  17. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. SageMaker JumpStart で基盤モデルを使う3つの方法 26 SageMaker Studio 簡単デプロイ SageMaker Notebooks AWS Management Console プレビュー
  18. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. カスタマイズ: In-context learning と Fine-tuning In-context (zero/few-shot) learning • ゼロまたはいくつかの例示のみで、 モデルのパラメータ更新を伴わない • プロンプトを工夫することにより 様々なタスクに対応 Fine-tuning モデルの パラメータ更新を 行う Figure 2.1 in [Brown et al., 2020]
  19. © 2023, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved. 画像⽣成の例: Stable Diffusion 2 画 像 ⽣ 成 、 変 換 、 超 解 像 29 画像変換 4x 超解像 (Upscaling) Stable Diffusion 2.0 で⽣成
  21. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Fine-tuning: Stable Diffusion 自分で用意した画像を用いて、Stable Diffusion を fine-tuning 30 https://github.com/aws/amazon-sagemaker- examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_to_image/Amazon_JumpStart_Text_To_Image.ipynb
  22. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. テキスト⽣成の例: Jurassic-2 31 求める品質とコスト・レイテンシ要件に応じて 適切なモデルを選択 Jurassic-2 は Large, Grande, Jumbo の3サイズと、 対話モデルの Grande Instruct, Jumbo Instruct https://www.ai21.com/blog/introducing-j2
  23. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Hugging Face Hub (Model Hub) • 12万 (2万5千 Transformers) モデルが公開されるプラットフォーム § Amazon SageMaker へ簡単デプロイ • ⽇本語 LLM もいくつか公開されている § Rinna – GPT-NeoX Instruction, GPT-NeoX, GPT-2, GPT, Stable Diffusion, HuBERT, RoBERTa, etc. § ABEJA – GPT-NeoX, GPT-2 § CyberAgent – OpenCALM , RoBERTa § Retrieva – T5 (Small - XL) 32
  24. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Hugging Face Hub からも SageMaker へ簡単デプロイ 33
  25. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Hugging Face Hub からも SageMaker へ簡単デプロイ 34
  26. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 典型的なアーキテクチャ: 複数 LLM を呼び分け 36 Amazon SageMaker Studio Notebook (開発・検証) LLM SageMaker JumpStart でモデルデプロイ User 2. 推論リクエスト 3. 回答の⽣成 AWS Cloud Lambda function Queue LLM API AWS Lambda 1. プロンプト 4. 回答
  27. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. LangChain を AWS 上で試してみる • SageMaker Studio § Data Science 2.0 Kernel (Python 3.8), PyTorch 2.0.0 (Python 3.9), PyTorch 1.13 (Python 3.8) など • LLM § SageMaker JumpStart でデプロイ § OpenAI API (API Key などは、AWS Secrets Manager に格納) • QuickStart § https://python.langchain.com/en/latest/getting_started/getting_started.html § https://python.langchain.com/en/latest/modules/models/llms/integrations/sagemaker.h tml 37
  28. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. © 2023, Amazon Web Services, Inc. or its affiliates. ⽣成系 AI ソリューション 38
  29. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 典型的なアーキテクチャ: RAG 39 Amazon Kendra Amazon OpenSearch Service OR 検索サービス 2. クエリ 3. 検索結果 Amazon SageMaker Studio Notebook (開発・検証) LLM SageMaker JumpStart でモデルデプロイ User 4. プロンプト + 検索結果 5. 回答結果の⽣成 1. プロンプト 6. 回答 AWS Cloud AWS Lambda
  30. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. Retrieval Augmented Generation (RAG) 社 内 ド キ ュ メ ン ト に 対 す る 検 索 結 果 に 基 づ き L L M が 回 答 を ⽣ 成 40 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/
  31. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 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/ 41
  32. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 本日紹介した内容に関連するブログ • AWS で生成系 AI を使用した構築のための新ツールを発表 § 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/ 42
  33. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 過去の Generative AI イベント • JAWS-UG AI/ML #16: Generative AI § https://www.youtube.com/watch?v=PkZenNAXtYs § EC2 Trn1n/Inf2 の紹介と CodeWhisperer (デモあり) • 【開催報告 & 資料公開】 Generative AI(生成系 AI)へのアプローチ – 今、見直される AI 活用と変革を迎える生成系 AI 戦略 § https://aws.amazon.com/jp/blogs/news/aws-aiml-generative-ai-strategy/ § RAG, コールセンター要約 (日本語) ソリューションデモあり 43
  34. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 📣 AWS Dev Day 6/22 - 23 © 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. 45
  35. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. 📣 Builders Online 2023/7/13 T2-2 はじめての生成系 AI 入門 〜AWS クラウドにおける生成系 AI 活用法〜 (Level 100) | 30 min 生成系 AI の急速な進化により、実ビジネスにおける AI 活用の幅が より大きく広がってきています。画像生成 AI や文書生成 AI など、 一般でも使われるようになってきた生成系 AI とは何なのか、その実 態を解説した上で、多数ある生成系 AI を AWS 上で簡単に利用する 方法や、自社データの利活用に応用する方法などをご紹介します。 46
  36. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. まとめ AWS の生成系 AI サービスを紹介しました。 Next Step のアイディア • SageMaker JumpStart で基盤モデルを試してみる • ブログ等を参考にソリューションをデプロイしてみる • AWS CodeWhisperer でのプログラミングも試してみる • AWS Dev Day, Builders Online イベントに参加してみる 47
  37. GENERATIVE AI WEBINAR SERIES © 2023, Amazon Web Services, Inc.

    or its affiliates. © 2023, Amazon Web Services, Inc. or its affiliates. Thank you! Yoshitaka Haribara @_hariby Takahiro Kubo @icoxfog417