정의

LLM 추론에서 latency와 cost는 t_compute(연산 시간)와 t_memory(메모리 접근 시간) 중 큰 값에 의해 결정되며, 이 두 시간의 균형은 batch size, model sparsity, KV cache 길이, 하드웨어 대역폭 간의 관계로 설명된다.

핵심 속성

  • t_compute: B × N_active ÷ FLOPs — batch size(B)와 활성 파라미터 수(N_active)에 비례, GPU 연산 성능(FLOPs)에 반비례.
  • t_memory: (N_total × byte_per_param + KV_cache_size) ÷ memory_bandwidth — 전체 파라미터 로딩 시간과 KV cache 접근 시간의 합. memory bandwidth에 의해 지배됨.
  • drain time: HBM 전체 용량을 대역폭으로 나눈 시간(최신 GPU 기준 ~20ms). 이 시간이 한 inference cycle의 기본 단위가 됨.
  • optimal batch: FLOPs/memory_bandwidth 비율(약 300)과 sparsity의 곱으로 추정. 예: sparsity=1/8 → B≈2400.
  • KV cache bottleneck: context length가 200K를 넘으면 t_memory가 t_compute를 초과, memory-bound 상태로 전환됨.

관계

인용

“compute와 memory가 균형을 이루는 지점으로 batch size를 설정하는 것이 throughput을 maximize하는 핵심이다.”

출처

클리핑 · youtu.be