메뉴
HN
Hacker News • 24일 전

LLM 추론의 효율적 프론티어

IMP
7/10
핵심 요약

AI 업계에서 비용과 성능의 트레이드오프를 나타내는 '효율적 프론티어' 개념을 LLM 추론 엔지니어링에 적용한 글입니다. 지연시간과 처리량 간 균형을 잡는 기법(배치 크기, 병렬화 전략 등)과 프론티어 자체를 확장하는 기법을 구분해 설명하며, 실무 배포 최적화에 유용한 가이드입니다.

번역된 본문

AI 업계에서 우리는 경제학자들에게 '효율적 프론티어(efficient frontier)'라는 용어를 빌려왔습니다. 이는 주로 모델의 비용과 성능 간 트레이드오프를 관리하는 것을 이야기할 때 사용합니다. 주어진 비용이나 크기에서 가장 높은 수준의 지능을 제공하는 모델을 '프론티어 모델'이라고 부릅니다.

효율적 프론티어는 자원이 제한된 환경에서 두 가치 있는 결과 사이의 트레이드오프를 고려할 때 최적 조합들의 범위를 보여줍니다.

추론 엔지니어링에도 효율적 프론티어가 존재합니다. 대부분 지연시간(latency)과 처리량(throughput, 비용을 결정) 간의 트레이드오프로 표현되지만, 품질을 처리량과 맞바꾸거나(양자화, 증류, 프루닝을 통해) 지능을 속도와 맞바꾸는(추론 수준 조정) 것도 가능합니다.

추론 엔지니어가 사용할 수 있는 기법에는 두 가지 유형이 있습니다:

  1. 두 요인 간 트레이드오프를 통해 배포를 효율적 프론티어 위에서 이동시키는 기법
  2. 주어진 배포의 프론티어 전체를 밀어내어, 가장 유익한 결과에 배분할 수 있는 전반적인 효율성을 높이는 기법

두 유형 모두 가치가 있습니다. 트레이드오프를 통해 프론티어 위의 어떤 지점이든 목표로 삼을 수 있는 것이 유용합니다. 사용자별 속도를 포기하면 배치 워크로드를 위한 고처리량, 저비용 파이프라인을 구축할 수 있습니다. 지연시간에 민감한 사용자가 높은 지불 의사를 가진 경우라면 처리량을 희생해 속도를 높이는 것이 합리적입니다. 그리고 물론 프론티어 전체를 밀어내는 것은 매우 유용합니다. 효율성을 더 확보하면 그 이득을 더 낮은 지연시간, 더 높은 처리량, 또는 둘의 조합에 배분할 수 있습니다.

본 글은 어떤 추론 엔지니어링 기법이 프론티어 위의 한 지점을 목표로 삼게 해주는지, 그리고 어떤 기법이 프론티어 전체를 확장시키는지 상세히 다룹니다. 이 글에서는 GLM-5.3이나 Kimi K3 같은 LLM을 에이전틱 코딩 용도로 실행하며 KV 캐시 재사용과 최적의 KV 인지 라우팅이 활성화되어 있다고 가정합니다.

트레이드오프를 관리하는 기법들

프로덕션에서 특정 목표를 달성하는 것은 종종 새로운 접근법을 발견하는 것보다 트래픽의 특성에 맞는 올바른 구성 조합을 찾는 것에 더 가깝습니다. 트레이드오프 관리 기법을 사용하면 효율적 프론티어 위에서 원하는 결과를 목표로 삼을 수 있습니다.

실제로 효율적 프론티어는 매우 들쭉날쭉합니다. 결과들 사이의 부드럽고 연속적인 선이 아니라, 작은 변화가 큰 영향을 미칠 수 있습니다. 이러한 분기점은 직관적이지 않은 경우가 많아 실험적 스윕(sweep)을 통해 발견해야 합니다.

배치 크기

지연시간과 처리량 간의 가장 명확한 트레이드오프는 배치 크기에서 나옵니다. 배치는 동시에 처리되는 요청의 수입니다. 토큰 수준의 연속 배칭(continuous batching) 덕분에 배치 시작을 기다리는 지연은 없지만, 설정된 배치 크기가 사용자별 지연시간과 전체 처리량을 결정합니다. 배치 크기가 작으면 사용자별 지연시간은 훌륭하지만 GPU당 생성되는 총 토큰 수가 적어 토큰당 비용이 상당히 높아집니다. 배치 크기를 늘리면 반대 효과가 나타납니다: 사용자별 지연시간은 나빠지지만 전체 처리량이 좋아져 비용이 낮아집니다.

병렬화 전략

오늘날의 LLM은 수천억에서 수조 개의 파라미터를 가지므로 여러 GPU에 분산되어야 합니다. GPU 간에 모델을 분할(병렬화)하는 방식은 지연시간 또는 처리량을 높일 수 있습니다.

병렬화는 대형 모델을 여러 GPU에 분산합니다. 지연시간에 민감한 배포에서는 텐서 병렬성(Tensor Parallelism, TP)을 높이는 데 집중하세요. TP는 비싼 all-to-all 통신이 필요하지만, 이러한 연산이 고대역폭 NVLink 상호연결에서는 빠르게 수행되므로 지연시간을 낮추는 데 효과적입니다.

전문가 병렬성(Expert Parallelism, EP)은 지연시간과 처리량 모두에 도움이 될 수 있습니다. 낮은 수준의 EP는 더 나은 지연시간과 관련되는 경우가 많고, GPU 전체 랙에 걸친 넓은 EP는 일반적으로 더 높은 처리량을 지원합니다.

처리량 개선을 위한 또 다른 병렬화 기법은 어텐션 데이터 병렬성(Attention Data Parallelism, ADP)입니다. 이 기법은 어텐션 레이어를 복제하여

원문 보기
원문 보기 (영어)
In the AI industry, we borrowed the term “efficient frontier” from economists. We use it to talk about managing tradeoffs, most often the tradeoff between cost and capabilities for models. A model is a “frontier model” if it offers the highest degree of intelligence at a given cost or size. ✕ An efficient frontier shows the range of optimal combinations when trading off between two valuable outcomes in a resource-constrained environment. We also have efficient frontiers in inference engineering. Most often, this is expressed as a tradeoff between latency and throughput (which determines cost), though we can also exchange quality for throughput (via quantization, distillation, and pruning) or intelligence for speed (in the form of reasoning level). There are two types of techniques available to inference engineers: Techniques which make a tradeoff between two factors to move a deployment along an efficient frontier. Techniques which push out the entire frontier for a given deployment, creating more overall efficiency which can be allocated to whatever outcome is most beneficial. Both types of techniques are valuable. It’s useful to be able to target any point along an efficient frontier by making tradeoffs. Giving up per-user speed makes it possible to build high-throughput, low-cost pipelines for batch workloads. Sacrificing throughput to improve speed makes sense when latency-sensitive users have a high willingness to pay. And of course, it’s incredibly useful to push out the entire frontier. Unlocking more efficiency creates gains that can be allocated to lower latency, higher throughput, or a combination of the two. This article details which inference engineering techniques let you target a point on the frontier, and which techniques push the entire frontier out. For this article, we’ll assume we’re running an LLM like GLM-5.3 or Kimi K3 for agentic coding with KV cache reuse enabled and optimal KV-aware routing. Techniques that manage tradeoffs Hitting a certain target in production is often less about discovering some novel approach and more about finding the right set of configurations given the nature of the traffic. ✕ Techniques for managing tradeoffs let you target an outcome along an efficient frontier. In practice, the efficient frontier is very jagged. Rather than a smooth, continuous line between outcomes, small changes can have big impacts. These cutoff points are often unintuitive and must be discovered empirically through sweeps. Batch sizing The most obvious tradeoff between latency and throughput comes from batch sizing. A batch is the number of requests that are processed concurrently. While token-level continuous batching means that there isn’t any latency from waiting for batches to start, the configured batch size determines the per-user latency and the overall throughput. With small batch sizes, per-user latency is excellent, but few total tokens are generated per GPU. This means the cost per token is quite high. Increasing batch size has the opposite effect: worse per-user latencies, better overall throughput for lower cost. Parallelism strategy Today’s LLMs measure in the hundreds of billions or trillions of parameters and must be spread across multiple GPUs. The way in which they are shared, or parallelized, across GPUs can boost either latency or throughput. ✕ Parallelism splits large models across multiple GPUs. For latency-sensitive deployments, focus on increasing Tensor Parallelism (TP). While TP has expensive all-to-all communication, it is effective for lowering latencies as these operations are fast over high-bandwidth NVLink interconnects. Expert Parallelism (EP) can help with both latency and throughput. A lower degree of EP is often associated with better latencies, while wide EP, including EP across a full rack of GPUs, generally supports higher throughput. Another parallelism technique for improving throughput is Attention Data Parallelism (ADP). This technique replicates attention layers for parallel computation, which boosts system throughput at the expense of per-request speed. Quantization Quantization, or running a model with a lower level of precision in weights, activations, and/or KV cache values, improves both latency and throughput. A quantized model pushes out the efficient frontier on serving tradeoffs. However, quantization introduces a new set of tradeoffs between quality and serving efficiency. This is a particularly jagged frontier, where a large degree of improvement to serving efficiency is possible with little-to-no reduction in model quality, especially when using microscaling floating-point number formats like MXFP4 and NVFP4. Techniques that move the frontier These techniques are the ones that make the headlines. Improving overall performance is the most fun part of inference engineering. ✕ Techniques for pushing out the frontier create universal gains. The best part is that these techniques often compound. For example, doubling performance from better hardware while also doubling performance from better software means a four times improvement in overall serving, which can be allocated across latency and throughput. Kernel optimization and runtime improvements A CUDA kernel is a low-level function that executes a single piece of the inference process, like a matrix multiplication. Improving the performance of individual kernels, as well as the end-to-end performance of a forward pass in the inference engine, means fewer resources are needed to generate each token. These efficiency gains compound throughout the stack and push the frontier of performance. For more on kernel-level performance, read this excellent writeup by Baseten intern Brian Li . Speculative decoding Speculative decoding is the process of guessing which tokens a model might generate, then validating those guesses. When speculative decoding was new, this posed a tradeoff between latency and throughput: speculation was expensive, sequence lengths were short, and acceptance rates were low, meaning speculative decoding was only feasible at small batch sizes. Today, techniques like EAGLE-3 , DSpark, and DFlash still compete with the main model loop for resources, somewhat limiting maximum batch sizes. However, thanks to the strong performance of these techniques, especially on code generation where output token sequences are relatively predictable, they yield efficiency gains from skipped forward passes in addition to the raw reduction in latency in the form of more tokens per second per user. Disaggregation P/D disaggregation, or separating prefill and decode onto dedicated workers, is a strategy for optimizing high-volume deployments of LLMs. Running prefill and decode independently means that workers can be optimized for the unique characteristics of each phase of inference, and that the ratio between prefill and decode workers can be adjusted to match the input and output sequence lengths and cache hit rates from incoming traffic. ✕ In practice, disaggregation is often most useful for increasing throughput while keeping latencies the same or slightly better. This article provided a basic overview of techniques for managing tradeoffs versus techniques for improving systemwide performance. For more detail on every technique mentioned in this article, read my free book Inference Engineering . Subscribe to our newsletter Stay up to date on model performance, inference infrastructure, and more. ‌