LLM 추론 입문: Prefill·Decode·KV Cache·Temperature 이해하기 (9/10)
프롬프트가 token이 된 뒤 prefill과 autoregressive decode를 거치는 과정을 설명하고, KV cache·TTFT·token latency·temperature·top-p가 RAG의 context 비용과 답변 안정성에 미치는 영향을 정리합니다.
Tag index
프롬프트가 token이 된 뒤 prefill과 autoregressive decode를 거치는 과정을 설명하고, KV cache·TTFT·token latency·temperature·top-p가 RAG의 context 비용과 답변 안정성에 미치는 영향을 정리합니다.
LLM 추론을 queue·prefill·decode로 분해하고 TTFT·ITL·goodput을 계산하며 PagedAttention, continuous batching, prefix cache, speculative decoding, P/D 분리와 SLO를 설계합니다.
LLM 양자화를 weight-only, weight·activation, KV cache로 나누고 scale·zero point·granularity를 계산하며 GPTQ, AWQ, SmoothQuant, FP8, KIVI의 memory·kernel·품질을 설계합니다.
Speculative decoding의 draft·target verification과 acceptance/rejection 식을 설명합니다. Draft 길이, tree 후보, KV rollback, scheduler와 품질 검증을 연결해 decode 지연을 줄이는 조건을 찾습니다.
KV cache를 logical block과 physical page로 나눠 할당합니다. Prefix identity, copy-on-write, refcount, eviction, offload를 연결해 RAG Agent의 cache hit와 tenant 격리를 설계합니다.
현대 decoder-only LLM block을 pre-norm·RMSNorm, RoPE, SwiGLU, MHA·MQA·GQA, KV cache, dense·MoE로 분해하고 각 구조가 학습 안정성, 메모리, 통신, latency에 미치는 영향을 계산합니다.
LLM 추론 GPU 메모리를 weight, runtime buffer, KV cache, allocator와 headroom으로 나눠 계산합니다. GQA·TP·prefix cache·동시성을 반영해 OOM 전 admission capacity를 설계합니다.