Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
サーバーレス環境における生成AI活用の可能性
Search
S.Akiyama
January 22, 2025
Technology
3
380
サーバーレス環境における生成AI活用の可能性
2024 にアップデートのあった Lambda SnapStart の紹介、ならびに生成 AI ユースケースへの実際の適用についてポイントを紹介します
S.Akiyama
January 22, 2025
Tweet
Share
Other Decks in Technology
See All in Technology
経験がないことを言い訳にしない、 AI時代の他領域への染み出し方
parayama0625
0
290
【CEDEC2025】ブランド力アップのためのコンテンツマーケティング~ゲーム会社における情報資産の活かし方~
cygames
PRO
0
200
マルチモーダル基盤モデルに基づく動画と音の解析技術
lycorptech_jp
PRO
4
400
東京海上日動におけるセキュアな開発プロセスの取り組み
miyabit
0
220
人に寄り添うAIエージェントとアーキテクチャ #BetAIDay
layerx
PRO
8
1.4k
2025-07-25 NOT A HOTEL TECH TALK ━ スマートホーム開発の最前線 ━ SOFTWARE
wakinchan
0
200
経理出身PdMがAIプロダクト開発を_ハンズオンで学んだ話.pdf
shunsukenarita
1
280
地域コミュニティへの「感謝」と「恩返し」 / 20250726jawsug-tochigi
kasacchiful
0
120
AWS表彰プログラムとキャリアについて
naoki_0531
1
150
データ基盤の管理者からGoogle Cloud全体の管理者になっていた話
zozotech
PRO
0
120
相互運用可能な学修歴クレデンシャルに向けた標準技術と国際動向
fujie
0
160
AI エンジニアの立場からみた、AI コーディング時代の開発の品質向上の取り組みと妄想
soh9834
8
630
Featured
See All Featured
Become a Pro
speakerdeck
PRO
29
5.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Code Review Best Practice
trishagee
69
19k
BBQ
matthewcrist
89
9.8k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
530
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Why Our Code Smells
bkeepers
PRO
337
57k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
Rails Girls Zürich Keynote
gr2m
95
14k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Transcript
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. サーバーレス環境における ⽣成AI活⽤の可能性 秋⼭ 周平 (Shuhei Akiyama) Solutions Architect 2024/01/22 Serverless Meetup Tokyo #20 1
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ⾃⼰紹介 Shuhei Akiyama Amazon Web Services Japan Solutions Architect ゲーム業界のお客様を中⼼にご⽀援しています 以前は AWS Support に所属していました 思い⼊れのある AWS サービスや OSS (AWS Lambda はこれから…!) Amazon GameLift Amazon Cognito Cloudscape Design System 2
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. アジェンダ 1. AWS Lambda SnapStart 概要 2. ⽣成AIユースケースに対する AWS Lambda SnapStart の活⽤例 1. ⽣成AI ユースケースと課題の説明 2. AWS Lambda SnapStart を適⽤した効果の紹介 3
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart 概要 4
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart の概要 5 通常の Lambda 関数の起動 関数の実⾏ 初期化フェーズ 呼び出し フェーズ 関数の実⾏ (実⾏環境の再利⽤) 呼び出し フェーズ 初期化フェーズ 呼び出し フェーズ 呼び出し フェーズ 最⼤10秒 AWS re:Invent 2022 - AWS Lambda SnapStart: Fast cold starts for your Java functions (SVS320) https://www.youtube.com/watch?v=ZbnAithBNYY
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart の概要 6 初期化フェーズ Snapshot 保存 関数のバージョン発⾏ 関数の実⾏ リストア 呼び出し フェーズ 関数の実⾏ (実⾏環境の再利⽤) 呼び出し フェーズ リストア 呼び出し フェーズ 呼び出し フェーズ 通常の Lambda 関数の起動 関数の実⾏ 初期化フェーズ 呼び出し フェーズ 関数の実⾏ (実⾏環境の再利⽤) 呼び出し フェーズ 初期化フェーズ 呼び出し フェーズ 呼び出し フェーズ SnapStart 活⽤時のフロー 最⼤10秒 最⼤900秒
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart で追加で発⽣するコスト 7 • Snapshot 保持期間 (GB-秒) § Snapshot サイズに依存 • リストアした Snapshot サイズの合計 (GB ~ リストアを利⽤する回数) § 起動回数と起動に対するリストアの割合に依存
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart が Python および .NET に対応 (2024 update) • ユースケース § Python において依存関係のロードやフレームワークの使⽤に時間がかかる場合 § .NET や Java など実⾏環境の準備に時間がかかる場合 8 ランタイムごとの ColdStart にかかる時間についての参考情報 (AWS re:Invent 2023 で紹介) https://maxday.github.io/lambda-perf/ https://www.youtube.com/watch?v=bGMEPI-va-Q
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ⽣成AIユースケースに対する AWS Lambda SnapStart の活⽤例 9
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. FAISS (Facebook AI Similarity Search) Vector Engine OSS ⼀般的な RAG 構成 • ⾼機能(⾼可⽤性、⾼耐久性、⾼スケーラビリティ) • 最⼩料⾦が⾼め Serverless RAG • 限定された機能 • 最⼩料⾦が低く費⽤はほぼ使⽤量に⽐例 10 現 在 S ER VER L ES S R AG と い う ソ リ ュ ー シ ョ ン を 開 発 し て い ま す (公 開 準 備 中 ) ⽣成 AI ユースケースの紹介 Amazon S3 Vector Data (file) User Amazon Bedrock 常駐する 外部 DB Amazon Aurora Amazon Kendra Amazon OpenSearch Lambda Function 検索 プロンプト拡張 回答⽣成 User Amazon Bedrock Lambda Function 検索 プロンプト拡張 回答⽣成
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ⽣成 AI ユースケースの紹介 11 質問/応答 User ベクトル データ取得 RAG 関数 回答⽣成 実⾏環境⽣成 初期化フェーズ S3 から /tmp へ ベクトルデータの ダウンロード /tmp からメモリへ のベクトルデータの ロード Faiss ライブラリ のロード 呼び出しフェーズ メモリ上ベクトル 空間に対する ベクトル検索 検索結果を使い Bedrock で質問に対 する回答を⽣成
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ⽣成 AI ユースケースの紹介 12 質問/応答 User ベクトル データ取得 RAG 関数 回答⽣成 実⾏環境⽣成 初期化フェーズ S3 から /tmp へ ベクトルデータの ダウンロード /tmp からメモリへ のベクトルデータの ロード Faiss ライブラリ のロード 呼び出しフェーズ メモリ上ベクトル 空間に対する ベクトル検索 検索結果を使い Bedrock で質問に対 する回答を⽣成 Cold Start 時間が⻑い (4 ~ 10 sec) 検索と外部 API 呼び出しのみ SnapStart との相性が良いと予想
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. AWS Lambda SnapStart の有効化に伴う実作業 Lambda Container からの移⾏ 現在 Lambda Container に対応し ていないため、移⾏にあたって Layer を作成 Lambda Layer サイズクォータの回避 Gen-AI 関連の Python ライブラリ は組み合わせると Layer サイズの 上限に抵触する可能性がある 効果測定 の難しさ Duration CloudWatch Metrics は Cold Start 時間を含まない ColdStart を意図的に起こす⼯夫 (Appendix) 13 SnapStart の有効化 は Config を有効化しバージョンを発⾏するだけ https://aws.amazon.com/jp/blogs/news/aws-lambda-snapstart-for-python-and-net-functions-is-now- generally-available/ > Python 関数の場合、 ~ 依存関係のロード (LangChain、Numpy、Pandas、DuckDB など) やフレームワーク の使⽤ (Flask や Django など) が含まれます。
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. Demo 14
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. Demo 16
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. 性能評価 – Vectorサイズと ColdStart の関係 17 Vector 数 (百万) Init Duration Duration 293 8147.1864 3402.666 117 5913.4612 2751.9588 80 5643.5648 2585.2688 32 4681.4212 2795.372 20 4550.5572 3388.9044 4.5 4322.1192 2457.5632 0 2000 4000 6000 8000 10000 0 50 100 150 200 250 300 350 時間(秒) ベクトル数(百万) 初期化フェーズ(SnapStart 無効) リストア(SnapStart 有効) Vector 数 (百万) Restore Duration Duration 293 1210.6816 3522.088 117 940.8468 2801.1768 80 1019.6988 3315.0096 32 785.336 2958.0572 20 739.2616 3879.9724 4.5 726.58843 2839.4548 SnapStart なし SnapStart 有効化
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. 性能評価 – Vectorサイズと関数全体の実⾏時間の関係 18 0 5000 10000 15000 50 100 150 200 250 300 350 時間(秒) ベクトル数(百万) SnapStart 無効 SnapStart有効 SnapStart なし SnapStart 有効化 Vector 数 (百万) Init Duration Duration 293 8147.1864 3402.666 117 5913.4612 2751.9588 80 5643.5648 2585.2688 32 4681.4212 2795.372 20 4550.5572 3388.9044 4.5 4322.1192 2457.5632 Vector 数 (百万) Restore Duration Duration 293 1210.6816 3522.088 117 940.8468 2801.1768 80 1019.6988 3315.0096 32 785.336 2958.0572 20 739.2616 3879.9724 4.5 726.58843 2839.4548
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. コスト評価 19 Lambda (2GB RAM) Costs (USD) 3 sec / invoke 0.0001 / invoke 30,000 requests 3 / month Bedrock Costs (USD) 400 Input tokens 0.0001 / invoke 200 Output tokens 0.00025 / invoke 30,000 requests 10.5 / month Lambda SnapStart Costs (USD) Cache (※1) 8.05 / month Restore (10%) 0.83 USD / month ⽉当たり合計リクエスト量 30000 requests / month 20 User RAG 50 times per day ※1. ただし、「スナップショットのキャッシュ」は GB~秒単位の課⾦のため、関数バージョン1つであれば、 最⼤でも 40 USD / monthであることに留意。⼀⽅ Restore はアクセス頻度に⼤きく左右される点に注意 ColdStart / Restore 発⽣分(10%) 3000 requests / month
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. Thank you! 20
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. Appendix:性能評価の様⼦ 21 Amazon S3 output bucket Amazon CloudWatch Logs Insights Lambda function Logs Lambda function Logs Lambda function Logs Lambda function Logs
© 2025, Amazon Web Services, Inc. or its affiliates. All
rights reserved. Appendix:性能評価の様⼦ 22