Series · Folio

LLM 추론 시스템 엔지니어링

10 parts

GPU 병목에서 스케줄링·분산 서빙·용량 계획까지 이어지는 초·중급 10편

GPU Roofline과 메모리 계산에서 추론 커널, continuous batching, paged KV cache, speculative decoding, 분산 및 저정밀 추론, SLO, 용량 계획으로 이어지는 로드맵
대상
LLM과 RAG Agent를 GPU에 배포한 뒤 지연·메모리·동시성 병목을 수치로 진단하고 싶은 초·중급 개발자
읽고 나면
Roofline과 메모리 계산으로 병목을 예측하고, attention kernel·continuous batching·paged KV·speculative decoding·분산 및 저정밀 추론을 조합해 SLO 기반 capacity와 비용을 설계할 수 있음
추천 진입

№003 llm-inference-systems-engineering · 03

Transformer 추론 커널: GEMM·Attention·FlashAttention·Fusion (3/10)

Transformer 추론을 GEMM, normalization, RoPE, attention, sampling 커널로 분해합니다. Prefill·decode shape와 HBM 이동, FlashAttention·fusion·fallback을 측정해 serving 성능을 검증합니다.

#LLM #GPU #Inference #Transformer
Transformer block의 operator graph가 prefill과 decode shape에 따라 GEMM, FlashAttention, fused kernel과 fallback 경로로 나뉘고 검증 gate를 통과하는 구조
№004 llm-inference-systems-engineering · 04

Continuous Batching·Chunked Prefill: LLM Scheduler 설계 (4/10)

Scheduler가 iteration마다 decode와 prefill token을 묶는 원리를 설명합니다. Chunked prefill, admission, preemption, fairness를 TTFT·ITL budget과 연결해 continuous batching을 설계합니다.

#LLM #Inference #Scheduler #ContinuousBatching
Active decode를 iteration budget에 넣고 긴 prefill을 작은 chunk로 나누며 admission, fairness, preemption과 SLO gate로 연결하는 LLM scheduler 구조
№005 llm-inference-systems-engineering · 05

Paged KV Cache·Prefix Caching: Block·Eviction·Reuse (5/10)

KV cache를 logical block과 physical page로 나눠 할당합니다. Prefix identity, copy-on-write, refcount, eviction, offload를 연결해 RAG Agent의 cache hit와 tenant 격리를 설계합니다.

#LLM #Inference #KVCache #PagedAttention
요청의 logical KV block을 불연속 physical GPU page에 매핑하고 radix prefix tree에서 공유한 뒤 refcount, copy-on-write, eviction과 CPU·SSD tier로 관리하는 구조
№006 llm-inference-systems-engineering · 06

Speculative Decoding: Draft·Verify·Acceptance와 Serving 설계 (6/10)

Speculative decoding의 draft·target verification과 acceptance/rejection 식을 설명합니다. Draft 길이, tree 후보, KV rollback, scheduler와 품질 검증을 연결해 decode 지연을 줄이는 조건을 찾습니다.

#LLM #Inference #SpeculativeDecoding #DraftModel
Draft model이 후보 token을 제안하고 target model이 한 번에 검증한 뒤 acceptance ratio로 prefix를 채택하며 rejected suffix KV를 rollback하는 구조
№007 llm-inference-systems-engineering · 07

분산 LLM 추론: TP·PP·EP·Context Parallel·P/D 분리 (7/10)

분산 LLM 추론의 replica, tensor·pipeline·expert·context parallel과 prefill/decode 분리를 비교합니다. Weight·KV·activation·collective와 topology를 계산해 SLO goodput에 맞는 배치를 설계합니다.

#LLM #Inference #DistributedSystems #TensorParallel
Weight·layer·expert·context·request·prefill/decode를 GPU에 분할하고 collective, activation, KV transfer와 topology를 비교하는 분산 LLM 추론 구조
№008 llm-inference-systems-engineering · 08

저정밀 LLM 추론: FP8·INT8·INT4·FP4 Kernel과 Calibration (8/10)

LLM 추론의 FP8·INT8·INT4·FP4 표현, scale 단위, calibration과 outlier 처리를 비교합니다. Weight·activation·KV를 줄인 뒤 fused kernel, 실제 byte, 정확도와 SLO goodput으로 빠른 경로를 검증합니다.

#LLM #Inference #Quantization #FP8
BF16에서 W8A8·W4A16·W4A8KV4·FP8·FP4로 정밀도를 낮추며 scale, outlier, fused GEMM, 정확도와 SLO gate를 비교하는 저정밀 LLM 추론 구조
№009 llm-inference-systems-engineering · 09

LLM Serving SLO 운영: Admission Control·Fairness·Autoscaling (9/10)

LLM serving의 TTFT·ITL SLO를 goodput으로 정의하고 admission, token fairness와 overload를 설계합니다. Queue work·KV·cold-start를 반영해 replica와 prefill/decode pool을 autoscale합니다.

#LLM #Inference #Serving #SLO
LLM 요청을 SLO class와 token work로 분류하고 admission, deadline·fairness queue, prefill/decode worker, autoscaling feedback loop로 제어하는 운영 구조
№010 llm-inference-systems-engineering · 10

LLM Serving 벤치마킹과 Capacity Planning: Trace·Goodput·비용 (10/10)

LLM serving을 open-loop trace로 재현해 TTFT·ITL·goodput·비용을 측정합니다. Input/output 결합 분포와 cache를 보존해 SLO knee를 찾고 peak·failure·rollout headroom으로 GPU capacity를 계산합니다.

#LLM #Inference #Benchmarking #CapacityPlanning
Production LLM trace를 open-loop로 재생해 workload·시스템·cache 조건을 고정하고 latency, goodput, failure, 비용으로 GPU capacity와 release gate를 계산하는 구조