"매 GPU 의 공동 구매". 매 single request 의 즉시 응답 X — 매 batch 의 throughput 의 maximize. 매 LLM 의 dynamic / continuous batching 의 5-20× throughput. 매 cost / latency trade-off 의 가장 큰 lever.
📖 핵심
매 inference type
종류
Latency
Throughput
Cost
사례
Online (sync)
<100ms
매 low
매 high
매 chat, 매 search
Batch (offline)
minute~hour
매 max
매 lowest
매 daily summary, 매 fraud scan
Async / queue
second~min
매 mid
매 mid
매 image gen, 매 transcribe
매 batching 의 종류
Static batching (전통)
매 batch size 의 fix.
매 batch 의 fill 의 wait → 매 latency variable.
Dynamic batching (Triton)
매 max wait time 의 limit.
매 incoming request 의 group.
✅ 매 latency / throughput balance.
Continuous batching (vLLM, TensorRT-LLM)
매 LLM 의 specific.
매 sequence 의 finish 의 다른 sequence 의 immediately fill.
매 GPU 의 idle 매 minimize.
매 5-20× throughput.
PagedAttention (vLLM)
매 KV cache 의 page table.
매 memory fragmentation 의 minimize.
매 long context + batch 의 enable.
매 batch size 의 effect
Throughput: 매 batch ↑ → 매 GPU util ↑.
Latency (per request): 매 wait ↑.
Memory: 매 batch ↑ → 매 OOM risk.
Sweet spot: 매 GPU memory + latency SLA 의 fit.
매 batch inference 의 적용
Embedding generation: 매 100M doc 의 batch.
Summarization: 매 daily news.
Fraud detection: 매 transaction 의 nightly.
Recommendation: 매 user-item score 의 precompute.
Image classification (archive): 매 medical image.
Translation (corpus): 매 doc bulk.
Hybrid (modern LLM serving)
매 online (chat) + 매 batch (precompute) 의 mix.
매 priority queue 의 latency-sensitive 의 first.
매 streaming 의 progressive output.
매 monitoring
Throughput: token/s, request/s.
Latency: p50, p95, p99, TTFT (time to first token).
GPU util: 매 70-90% target.
Batch size 의 distribution.
Queue depth.
💻 패턴
vLLM offline batch
fromvllmimportLLM,SamplingParamsllm=LLM(model='meta-llama/Llama-3-8B-Instruct')sampling=SamplingParams(temperature=0.7,max_tokens=512)prompts=[...]# 매 10Koutputs=llm.generate(prompts,sampling)# 매 continuous batching 의 self-managed
# 매 batch job 의 spot instance OK# 매 1 hour SLA → 매 spot interrupt OKconfig={'instance_type':'g5.2xlarge','pricing':'spot',# ~70% cheaper'max_runtime_min':60,'retry_on_interrupt':True,}
🤔 결정 기준
상황
Strategy
Chat / search
Continuous batching (vLLM)
Daily summary
Offline batch + spot
Embedding 100M doc
Ray + GPU batch
Image generation
Async queue + webhook
Fraud nightly
Batch + cheap GPU
RT API + bulk
Hybrid (priority queue)
기본값: vLLM (LLM) / Triton (general) / Ray (distributed).