0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SageMaker Multi-Model Endpoints(MME)における並列推論について

Posted at

小規模なLLMを1つのコスト効率よく動かすにはどうすればいいのか気になったのでメモ

SageMakerではMulti-Model Endpoints(MME)が用意されており、このMMEにはNVIDIAのTriton Inference Server が活用されております。
by Run multiple deep learning models on GPU with Amazon SageMaker multi-m...

なお、SageMaker Multi-Container Endpoints(MCE)はGPUインスタンスを選ぶことができません。(2025/06/23現在)

Triton Inference Serverの機能、「Concurrent model execution」を利用することで同一モデルの複数インスタンスをGPU上に並列に立ち上げることができます。
Triton Inference Serverがモデルをロード・実行する際に必要な設定情報を記述するファイル config.pbtxtinstance_group を設定することで実現できます

例)
instance_group [
  {
    count: 2. # GPU 0上に2インスタンス
    kind: KIND_GPU
    gpus: [0]  
  },
  {
    count: 3
    kind: KIND_GPU
    gpus: [1, 2]  # GPU 1と2上に3インスタンスずつ
  }
]

また、同時に「Dynamic Batching」を利用することで複数の推論を1つのバッチに統合してスループットを向上させることができます。
Triton Inference Serverがモデルをロード・実行する際に必要な設定情報を記述するファイル config.pbtxtdynamic_batching を設定することで実現できます

例)
dynamic_batching {
max_queue_delay_microseconds: 100   # 100ms毎にバッチ処理
}

Dynamic Batchingを利用した例
dynamic_batching (1).png
by https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/tutorials/Conceptual_Guide/Part_2-improving_resource_utilization/README.html#what-is-dynamic-batching

Dynamic BatchingとConcurrent model executionを組み合わせた例
multi_instance (1).png
by https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/tutorials/Conceptual_Guide/Part_2-improving_resource_utilization/README.html#concurrent-model-execution

以下パフォーマンス測定では、何もしていない状態と比べ4倍近くスループットが上昇しレイテンシも約70%改善しておりGPUをより効果的に利用しています

このことから、必要なGPUリソースが少ないモデルを推論するときは、モデルの必要なサイズに合わせるのではなくDynamic BatchingとConcurrent model executionを加味したインスタンス選定をすることでよりコスト効率の高い環境を用意することができます。

Qiita上の私の記事・コメントは個人的な意見に基づくものであり、所属する組織、団体とは一切関係ありません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?