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

Amazon Bedrock を用いた生成 AI 活用時のコスト最適化

Avatar for kazuya iwami kazuya iwami
January 31, 2025
6

Amazon Bedrock を用いた生成 AI 活用時のコスト最適化

生成 AI の実活用が普及する中、大規模な本番活用を検討した際に、 よりコスト効率の良いモデルやアプローチのニーズが高まっています。

AWS re:Invent 2024 では、国内でも人気の高い Anthropic の Claude に加えて、 新たに Amazon Nova や Amazon Bedrock Marketplace 上の 100 以上のモデルが利用可能になりました。

またそれらのモデルを効率よく利用するため、Prompt Caching や Prompt Routing、 Model Distillation など、発展的な機能も登場しました。

本セッションではそれらの新機能がどのような状況で活用できるのか、 各機能の全体像をお伝えします (L200)

Avatar for kazuya iwami

kazuya iwami

January 31, 2025
Tweet

Transcript

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

    rights reserved. ⽯⾒ 和也 アマゾン ウェブ サービス ジャパン合同会社 シニア ソリューションアーキテクト Amazon Bedrock を⽤いた⽣成 AI 活⽤時のコスト最適化
  2. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⽯⾒ 和也 シニア ソリューションアーキテクト - アマゾン ウェブ サービス ジャパン合同会社 • Digital Native なビジネスをされているお客様の IT 戦略策定から実装⽀援まで • ⼈材、不動産、E コマース、ゲーム、ニュースなどの業界 • 機械学習分野については業種横断で⽀援 • AWS 初学者育成プログラム 「AWS JumpStart」の企画運営 Technical Interests • システムアーキテクチャ全般 • 分散システム
  3. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 本⽇お話する内容 ⽣成 AI の実活⽤が普及する中、⼤規模な本番活⽤を検討した際に、 よりコスト効率の良いモデルやアプローチのニーズが⾼まっています。 AWS re:Invent 2024 では、国内でも⼈気の⾼い Anthropic の Claude に加えて、 新たに Amazon Nova や Amazon Bedrock Marketplace 上の 100 以上のモデルが 利⽤可能になりました。 またそれらのモデルを効率よく利⽤するため、Prompt Caching や Prompt Routing、 Model Distillation など、発展的な機能も登場しました。 本セッションではそれらの新機能がどのような状況で活⽤できるのか、 各機能の 全体像をお伝えします (L200)
  4. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 2023 PoC の年 私達のビジネスに何をもたらすのか︖ Foundation Model とは何か︖ ⽣成 AI とは何か︖ Prompt engineer になる必要があるのか︖ 安全か︖ どのようにモデルを選択するのか︖ 何から始めるのか︖ どのモデルを試すとよいのか︖ LLM とは何か︖
  5. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 2024 本番稼働の年 プロジェクトでは何を優先すべきか︖ より早く動かすには︖ よりリアルにするためには︖ コスト削減の⽅法は︖ どうすれば規模を拡⼤できるか どのモデルを利⽤すべきか︖ リスクをどう管理するか︖ 独⾃モデルを学習すべきなのか︖ どのカスタマイズ⼿法を取るべきか
  6. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 2025 ビジネス価値 の年 どのように Agent を活⽤するか︖ どのように複数モデルを扱うシステムを構築するか︖ どのようにビジネス全体を変⾰していくか より活⽤を展開していくには︖ どのような規制や法律を意識しておくべきか︖ マルチモーダルとは何か︖ ドメイン特化モデルとは何か︖ 社員全員が AI を活⽤するためには︖
  7. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Generative AI for millions: Amazon's Rufus and review highlights (AMZ301) Amazon における Review Highlights の事例
  8. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⼤規模な活⽤におけるコスト感の例 200⽂字相当の説明⽂の商品を 1 億件 解析・分類するために掛かる料⾦は︖ e.g. 1億件の商品を持つ E コマースサイト、1 億件の案件を保有する⼈材紹介企業等 Claude 3.5 Haiku (軽量モデル): 約 500 万円 Claude 3.5 Sonnet (⾼性能モデル): 約 7000 千万円 200⽂字相当のコメントを 1 秒に 1 件 レビューする際の料⾦は︖ e.g. ◯◯万⼈のユーザーを持つ動画配信サイト、SNS Claude 3.5 Haiku: 約 15 万円 / ⽉ Claude 3.5 Sonnet: 約 200 万円 / ⽉
  9. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. アジェンダ • Amazon Bedrock でのコスト最適化のアプローチ • モデル選定 • 推論⽅法 • Fine-tuning • キャッシュ • Amazon Bedrock のコストモニタリング • 番外編: 独⾃でモデルをホスティングする場合のコスト最適化
  10. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock での コスト最適化のアプローチ
  11. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Amazon Bedrock Intelligent Prompt Routing • On-demand • Provisioned Throughput • Amazon Bedrock Batch Inference • Prompt Caching • Fine-tuning • Amazon Bedrock Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  12. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  13. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock で利⽤可能なモデルの選択肢 AMAZON NOVA JAMBA CLAUDE COMMAND EMBED RERANK LLAMA LUMA RAY 2 STABLE DIFFUSION STABLE IMAGE MISTRAL MIXTRAL MALIBU POINT Coming soon Amazon
  14. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. モデル選定時のよくあるトレードオフ 解きたいタスク での性能 レイテンシー コスト
  15. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Anthropic Claude 3.5 Haiku が 20% 安価に Claude 3.5 Sonnet Claude 3.5 Haiku Claude 3 Opus Use case Most intelligent, built for high-volume use cases Fastest performance at the lowest cost Second-most intelligent overall; most intelligent in Claude 3 family Context 200K 200K 200K Vision ✓ ✓ ✓ Cost* Input: Output: $0.003 $0.015 $0.0008 $0.004 $0.015 $0.075 *Per 1K tokens
  16. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 最先端の知性と業界をリードする価格性能を提供する最先端の基盤モデル Amazon Nova Amazon Nova Reel Amazon Nova Canvas Creative Content Generation Models Amazon Nova Lite Amazon Nova Premier CO MING SO O N Amazon Nova Pro Amazon Nova Micro 画像⽣成 動画⽣成 Understanding Models
  17. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Nova Amazon Nova Micro Amazon Nova Lite Amazon Nova Pro Amazon Nova Premier GA 128K 200+ languages Text input; text output Yes GA 300K 200+ languages Text, image, video input; text output Yes GA 300K (5M coming soon) 200+ languages Yes Coming soon Coming soon Coming soon Coming soon Coming soon Availability ⼊⼒トークン⻑ 対応⾔語 ⼊⼒可能データ 形式 Fine-tuning ⾼度な知能 低コスト&レイテンシー
  18. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Nova の価格⾯での優位性 https://artificialanalysis.ai/ ※ ⾔語やタスクによって性能は前後することに留意
  19. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock Marketplace Amazon Bedrock Marketplace を利⽤することで、30 以上の Provider の 100 を 超える基盤モデルを利⽤可能になる 特定のドメイン、⾔語、またはタスク向けに最適化された専⾨モデルを、 Amazon Bedrock の単⼀のインターフェイスで楽に利⽤できるのが利点 利⽤時は裏で Amazon SageMaker のインスタンスが常時起動するため、 料⾦モデルは注意 PREFERRED NETWORKS KARAKURI CYBERAGENT STOCKMARK https://aws.amazon.com/jp/blogs/news/meet-foundation-model-on-amazon-bedrock-marketplace/
  20. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock Intelligent Prompt Routing (プレビュー) レスポンスの品質とコストの最適な組み合わせを提供すると予測されるモデルを 動的に選択する機能 精度を損なうことなくコストを最⼤ 30 % 削減できる。 ただし、現時点では英語のみ対応 おはよう︕ AWS の構成を レビューして
  21. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. それぞれのプロンプトに適したモデルを選択 プロンプト モデルの 選択肢 ルーティング 基準 プロンプト エンコーダー 性能予測 判断の最適化 それぞれの プロンプトに 適したモデル
  22. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  23. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  24. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock での推論⽅法 • On-demand • 従量課⾦で利⽤でき、コミットは不要 • クロスリージョン推論機能もサポート • Provisioned Throughput • 1 分あたりに処理できる input / output トークン数を固定費⽤で予約するモデル • コミットなし( 1 時間ごと課⾦)か、1 or 6 ヶ⽉の割引付きのコミットメントが選択できる • 安定したスループットが求められる本番システムや、カスタムモデルを利⽤する際に最適 • ⼤規模で安定した利⽤が⾒込まれる際に検討 • Batch Inference • ⾮同期に⼤量のリクエストをまとめて処理できるモデル • 基本的には 24 時間以内に処理が完了する • On-demand より 50 % 安価に推論が可能
  25. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Batch Inference によるコスト最適化 Amazon Bedrock のバッチ推論機能を利⽤すると、通常 24 時間以内に オンデマンドの料⾦の 50 % で処理できる 利⽤例︓ • パーソナライズされたメール⽂⾯を定期的に作成 • RAG などの⽤途に埋め込みベクトルを⼀括作成 https://aws.amazon.com/jp/about-aws/whats-new/2024/08/amazon-bedrock-fms-batch-inference-50-price/ Amazon Bedrock 処理したい⼊⼒プロンプト群 を含めた jsonl ファイル 推論結果 ⾮同期でまとめて処理
  26. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  27. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  28. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Fine-tuning とは何か︖ ⼤規模コーパス Pre-training 基盤モデル Fine-tuning Fine-tuning 後の タスク特化モデル タスク特有のデータ Fine-tuning の詳細は、この後の T4-4「⽣成 AI をビジネスに活かすファインチューニングの実践⽅法」 で詳細に説明します
  29. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Fine-tuning はコスト最適化に寄与しうるのか 軽量な基盤モデル単体では精度が不⼗分な場合でも、タスク特有のデータで Fine-tuning することで、⼗分な精度の軽量なタスク特化モデルが作れうる ただし、Fine-tuning でカスタマイズされたモデルは、Provisioned Throuput や Custom Model Import で独⾃の推論リソースを確保する必要がある そのため、常時⼤規模なスループットが必要なユースケースで、更にコストを 最適化したいケースで特に有効であるという点は注意が必要
  30. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock は Claude 3 Haiku の Fine tuning に対応 Model Output layer Input layer Claude 3 Haiku Model Fine-tuned Claude 3 Haiku Model Inference Inference Updated weights Labelled data Amazon Bedrock はお客様が Claude を Fine-tuning できる唯⼀の マネージドサービスです
  31. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. プロンプト レスポンス Distilled model (蒸留モデル) ⾼度なモデル (教師) 軽量モデル (⽣徒) を Fine tuning する Model Distillation (プレビュー) 教師モデルに近い精度で、より安く⾼速でコスト効率の⾼いモデルを作成できる RAG などのユースケースでは、最⼤ 75 % 安価な蒸留モデルを作ることも Fine-tuning ⽤データを ⾼度なモデルを使って合成
  32. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  33. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  34. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock Prompt Caching (プレビュー) • 複数の API コール間で繰り返しのコンテキストをキャッシュ • ⻑⽂のドキュメントをコンテキストに含めて検索・質問するケース • 会話チャットボットで詳細な設定、会話例をコンテキストに含める必要があるケース • ⼤量のコードをコンテキストに含めて開発アシスタントとして利⽤するケース • プロンプト全体を安全にキャッシュ • 対応モデルにおいて、コストを最⼤ 90 %、レイテンシーを最⼤ 85 %削減
  35. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でのコスト最適化のアプローチ モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地
  36. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. コストモニタリング • コスト配分タグの利⽤ • Langfuse を利⽤したコストモニタリング 改善するにはまず計測から
  37. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Bedrock でコスト配分タグが利⽤可能に Amazon Bedrock の API を呼び出すタイミングで付与した タグ の情報を⽤いて コスト管理が可能に (AWS Budgets, AWS Cost Explorer, Amazon CloudWatch 等)
  38. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Langfuse を利⽤したコストモニタリング LangSmith や Langfuse といった LLMOps ツールを⽤いると、処理ごとや、モデル ごとのコスト管理も可能 https://langfuse.com/
  39. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 番外編︓ 独⾃でモデルをホスティングする場合
  40. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 独⾃でモデルをホスティングする場合 Fine-tuning した軽量な LLM Amazon EC2 Amazon SageMaker ⾼性能な LLM 様々な ML モデル
  41. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon.com での⼤規模⽣成 AI 活⽤事例 Review Highlights Rufus re:Invent 2024: Generative AI for millions: Amazon's Rufus and review highlights
  42. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Review Highlights での⼯夫例 re:Invent 2024: Generative AI for millions: Amazon's Rufus and review highlights
  43. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Rufus での⼯夫例 re:Invent 2024: Generative AI for millions: Amazon's Rufus and review highlights
  44. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. まとめ︓Amazon Bedrock でのコスト最適化 モデル選定 推論⽅法 Fine-tuning キャッシュ • Anthropic Claude • Amazon Nova • Amazon Bedrock Marketplace • Intelligent Prompt Routing • On-demand • Provisioned Throughput • Batch Inference • Prompt Caching • Fine-tuning • Model Distillation 90% 75% 50% 90% アプローチごとのコスト削減余地 ※ 更に⼤規模な活⽤を検討する場合は EC2 や SageMaker での独⾃ホスティングも検討