背景
プライベート大規模モデルシステムにおいて、Embeddingモデル、Rerankerモデル、LLMをローカルにデプロイし、高並列バッチ処理を実現しました。
設定 (config.py)
複数のサービス(Embeddingモデル、Rerankerモデル、LLMなど)をローカルにデプロイした場合、ユーザーがこれらのマイクロサービスにリクエストを送る際に、どのように config.py を使ってリソーススケジューリング戦略を実現すれば良いでしょうか?
区別
| サービス | 特徴 | パラメータ調整戦略 |
|---|---|---|
| embedding | 高スループット、軽量計算 | 大きなバッチ + 多数ワーカー |
| reranker | 中程度の計算負荷 | 中サイズのバッチ |
| LLM | 超重量級計算 | 小バッチ + レート制限 |
設定パラメータ
以下はローカルモデルの設定パラメータの例です:
LLM_SERVICE_CONFIG = {
"llm_model_name": "xxx",
"batch_size": 4,
"batch_timeout": 0.05,
"max_queue_size": 50,
"worker_count": 1,
"queue_timeout": 0.2,
"inference_timeout": 2.0,
"total_timeout": 3.0,
"rate_limit": 10,
"enable_cache": False,
}
エンタープライズアーキテクチャ (config.yaml)
分離設計(Model Layer / Service Layer の分割)
models:
embedding_v1:
type: embedding
model_name: "xxxxxemdeddingModelxxx"
device: "cpu"
reranker_v1:
type: reranker
model_name: "xxxxrerankerxxxx"
llm_v1:
type: llm
model_name: "xxx"
services:
embedding_service:
model: embedding_v1
runtime:
batch_size: 64
batch_timeout: 0.01
max_queue_size: 500
worker_count: 4
queue_timeout: 0.05
inference_timeout: 0.3
total_timeout: 0.5
rate_limit: 100
enable_cache: true
reranker_service:
model: reranker_v1
runtime:
batch_size: 16
batch_timeout: 0.02
max_queue_size: 200
worker_count: 2
queue_timeout: 0.1
inference_timeout: 0.5
total_timeout: 0.8
rate_limit: 50
enable_cache: false
llm_service:
model: llm_v1
runtime:
batch_size: 4
batch_timeout: 0.05
max_queue_size: 50
worker_count: 1
queue_timeout: 0.2
inference_timeout: 2.0
total_timeout: 3.0
rate_limit: 10
enable_cache: false