메뉴
HN
Hacker News • 19일 전

AMD GPU에서 vLLM 추론 디코딩 활용하기

IMP
7/10
핵심 요약

AMD Instinct MI300X/MI355X GPU와 ROCm 플랫폼에서 vLLM의 추론 디코딩(Speculative Decoding) 성능을 실험한 글입니다. 초안-검증(draft-and-verify) 방식으로 원본 모델의 출력을 유지하면서 한 번의 검증으로 여러 토큰을 커밋해 처리량을 높일 수 있으며, 그 효과는 초안 생성 방식(MTP, EAGLE-3, DFlash, DSpark 등), 제안 길이, 모델 계열, 워크로드에 따라 달라졌습니다. LLM 서빙 최적화에 실용적인 참고 자료입니다.

번역된 본문

목차

TL;DR: 추론 디코딩(Speculative Decoding)을 통해 vLLM은 단 한 번의 타깃 모델 패스에서 여러 초안(draft) 토큰을 검증할 수 있습니다. 실험 결과, 출력 토큰 처리량에 미치는 효과는 초안 생성 방식과 제안 길이에 따라 달랐으며, 모델 계열, 초안 체크포인트, 워크로드, 수용(acceptance) 동작에도 영향을 받았습니다.

소개 대규모 언어 모델(LLM)은 다양한 애플리케이션을 지원하지만, 대규모로 서빙하려면 신중한 최적화가 필요합니다. 표준 자기회귀(autoregressive) 디코딩은 대부분의 LLM 서빙 시스템이 사용하는 기준 방식입니다. 모델이 토큰 하나를 생성하고 이를 시퀀스에 추가한 뒤, 업데이트된 시퀀스로 다음 토큰을 생성합니다. 이 과정은 단순하고 안정적이지만, 출력 토큰이 엄격한 왼쪽에서 오른쪽 순서로 생성되어야 하기 때문에 서빙 루프는 한 번에 커밋된 토큰 하나씩만 진행됩니다.

추론 디코딩[1]은 이 기준 위에 초안-검증(draft-and-verify) 메커니즘을 더한 것입니다. 가벼운 초안(draft) 컴포넌트가 미래의 후보 토큰을 제안하고, 타깃 모델이 이들을 커밋하기 전에 검증합니다. 여러 초안 토큰이 수용되면, 타깃 모델의 출력 동작을 유지하면서도 단 한 번의 검증 단계로 여러 출력 토큰을 커밋할 수 있습니다.

이 글은 vLLM에서 추론 디코딩이 어떻게 작동하는지 살펴보고, 저희 테스트 환경에서의 측정 결과를 공유합니다. 먼저 자기회귀 디코딩 기준 방식과 초안-검증 과정을 살펴봅니다. 그다음 다섯 가지 초안 생성 방식을 검토합니다: 네이티브 MTP, Gemma 4 MTP, EAGLE-3, DFlash, DSpark입니다. 이 방법들은 초안 컴포넌트가 타깃 모델로부터 정보를 받는 방식, 그리고 후보 토큰을 순차적으로(자기회귀 방식으로) 생성하는지, 병렬로 생성하는지, 아니면 하이브리드 방식으로 생성하는지에 따라 다릅니다. 마지막으로 테스트 환경에서 이 방법들을 활성화하는 방법을 보여주고, AMD Instinct™ MI300X 및 MI355X GPU에서 ROCm™ 오픈 소프트웨어 플랫폼을 사용한 실험 측정 결과를 보고하며, 실무 튜닝과 관측 가능성(observability) 관련 고려사항을 논의합니다.

자기회귀 디코딩 기준 방식 표준 자기회귀 디코딩에서는 각 디코딩 단계가 새 토큰 하나를 생성하고 커밋합니다. 예를 들어, 출력 토큰 네 개를 생성하려면 네 번의 순차적 디코딩 단계가 필요합니다:

1단계: 컨텍스트 → 모델 → T1 2단계: 컨텍스트 + T1 → 모델 → T2 3단계: 컨텍스트 + T1 T2 → 모델 → T3 4단계: 컨텍스트 + T1 T2 T3 → 모델 → T4

각 단계 후 생성된 토큰은 시퀀스에 추가되어 다음 단계의 입력 일부가 됩니다. 이는 디코딩 루프를 단순하게 만들지만, 모든 출력 토큰마다 한 번의 모델 디코딩 단계가 필요합니다. 긴 생성 작업 중에는 이 토큰별 루프가 지연 시간을 지배하고 서빙 처리량을 제한할 수 있습니다.

따라서 추론 디코딩의 핵심 질문은 다음과 같습니다: 원본 모델의 출력 동작을 유지하면서 한 번에 토큰 하나씩만 진행되는 생성 빈도를 줄일 수 있을까? 추론 디코딩은 제안(proposal)과 검증(verification)을 분리하여 이를 해결합니다. 초안 컴포넌트가 먼저 여러 미래 후보 토큰을 제안하고, 타깃 모델 역할을 하는 원본 모델이 커밋 전에 이들을 검증합니다.

추론 디코딩의 핵심 아이디어 추론 디코딩은 원본 모델을 대체하지 않습니다. 대신 최종 출력을 담당하는 타깃 모델로 원본 모델을 유지하고, 그 앞에 더 빠른 제안 단계를 추가합니다. 과정은 두 부분으로 구성됩니다:

초안(Draft): 여러 미래 후보 토큰을 제안합니다. 검증(Verify): 타깃 모델을 사용해 후보를 확인합니다.

그림 1에 나타난 것처럼 각 추론 디코딩 라운드 동안 가벼운 초안 컴포넌트가 하나 이상의 미래 토큰을 제안합니다. 이 토큰들은 후보일 뿐이며 즉시 커밋되지 않습니다. 그런 다음 타깃 모델이 한 번의 검증 패스로 후보 토큰 시퀀스를 평가합니다. 검증은 왼쪽에서 오른쪽으로 진행되며, 각 초안 토큰은 해당 위치에서 타깃 모델의 결과를 사용해 검사됩니다. 수용된 토큰은 출력 시퀀스에 커밋됩니다. (원문이 여기서 중단됨)

원문 보기
원문 보기 (영어)
Table of Contents TL;DR: Speculative decoding allows vLLM to verify multiple drafted tokens in a single target-model pass. In our experiments, its effect on output-token throughput varied across drafting methods and proposal lengths, and also depended on the model family, draft checkpoint, workload, and acceptance behavior. Introduction Large language models support a wide range of applications, but serving them at scale requires careful optimization. Standard autoregressive decoding is the baseline used by most LLM serving systems: the model generates one token, appends it to the sequence, and then uses the updated sequence to generate the next token. This process is simple and reliable, but the serving loop still advances one committed token at a time because output tokens must be produced in strict left-to-right order. Speculative decoding [1] builds on this baseline through a draft-and-verify mechanism. A lightweight draft component proposes candidate future tokens, and the target model verifies those candidates before they are committed. When several draft tokens are accepted, the system can commit multiple output tokens from a single target-model verification step while preserving the target model's output behavior. This post explores how speculative decoding works in vLLM and shares measurements from our test environment. We first review the autoregressive decoding baseline and the draft-and-verify process. We then examine five speculative-drafting approaches: native MTP, Gemma 4 MTP, EAGLE-3, DFlash, and DSpark. These methods differ in how the draft component receives information from the target model and whether candidate tokens are generated sequentially, autoregressively, in parallel, or through a hybrid approach. Finally, we show how to enable the methods tested in our environment, report measurements from our experiments on AMD Instinct™ MI300X and MI355X GPUs using the ROCm™ open software platform, and discuss practical tuning and observability considerations. The autoregressive decoding baseline In standard autoregressive decoding, each decode step produces and commits one new token. For example, generating four output tokens requires four sequential decode steps: Step 1: context → model → T1 Step 2: context + T1 → model → T2 Step 3: context + T1 T2 → model → T3 Step 4: context + T1 T2 T3 → model → T4 After each step, the generated token is appended to the sequence and becomes part of the input for the next step. This makes the decoding loop straightforward, but it also requires one model decode step for every output token. During long generations, this token-by-token loop can dominate latency and limit serving throughput. The key question behind speculative decoding is therefore: Can we preserve the output behavior of the original model while reducing how often generation advances by only one token at a time? Speculative decoding addresses this by separating proposal from verification. A draft component first proposes several candidate future tokens. The original model, acting as the target model, then verifies those candidates before they are committed. Core idea of speculative decoding Speculative decoding does not replace the original model. Instead, it keeps the original model as the target model, which remains responsible for the final output, and adds a faster proposal stage in front of it. The process has two parts: Draft: propose several candidate future tokens. Verify: use the target model to check those candidates. During each speculative decoding round, as illustrated in Figure 1, a lightweight draft component proposes one or more future tokens. These tokens are only candidates and are not committed immediately. The target model then evaluates the candidate token sequence in one verification pass. Verification proceeds from left to right. Each draft token is checked using the target model's result at the corresponding position. Accepted tokens are committed to the output sequence. When a draft token is rejected, later candidates from the same proposal are no longer accepted. If a draft token is rejected, the target model provides the next token. The remaining draft tokens are discarded, and generation continues from the updated sequence. Conceptually, standard autoregressive decoding advances like this: target model → T1 target model → T2 target model → T3 target model → T4 Speculative decoding instead allows several candidate positions to be evaluated together: draft proposes T1 T2 T3 T4 model verifies ✓ ✓ ✗ stop commit T1 T2 replacement token - This can reduce the number of target-model decoding rounds when multiple candidates are accepted. When the draft component produces tokens that the target model accepts, several output tokens can be committed from one target-model verification step. When a proposal is rejected, the target-side result determines how generation continues. A simple accept/reject example Figure 2 gives an example of one speculative decoding round. Green boxes are draft tokens that survive verification, the red box marks the first rejected draft token, and the gray box is a later draft token that is discarded. The blue token in the output comes from the target model, not from the draft proposal. Suppose the current prompt is: The weather today is The draft component proposes several future tokens: sunny and warm outside The target model verifies the draft tokens from left to right: draft proposes sunny and warm outside model verifies ✓ ✓ ✗ stop commit sunny and clear - The first two draft tokens, sunny and and , are accepted. At the third position, the draft proposes warm , but the target model selects clear . The remaining candidate, outside , is discarded because it follows the first rejected position. The next decoding round therefore continues from: The weather today is sunny and clear How the drafting methods work Although all speculative decoding methods follow the same overall draft-and-verify process, they differ in how the draft component is designed and how it works with the target model. The main differences are: The type of information received from the target model. How this information is incorporated into the drafting process. Whether candidate tokens are generated sequentially or in parallel. Based on these differences, the drafting methods discussed in this post can be grouped into three broad categories: native MTP modules, separate MTP drafters, and dedicated target-conditioned draft networks. Native MTP modules: built directly into the target-model architecture; use a model-native auxiliary prediction path; generate candidate tokens sequentially. Separate MTP drafters: use a separate checkpoint paired with a specific target model; use target-model activations and shared KV-cache information during inference; generate candidate tokens sequentially. Dedicated target-conditioned draft networks: use separate speculator models trained for a specific target model, including EAGLE-3, DFlash, and DSpark. EAGLE-3 drafts autoregressively from target-model hidden states, DFlash drafts parallel blocks from target-model hidden states, and DSpark adds lightweight causal correction and confidence-based prefix selection. These categories describe the draft component architecture, not the target-model family. A target model may support native MTP while also having separately trained EAGLE-3, DFlash, or DSpark draft models. The draft component does not operate entirely on its own. Depending on the method, the draft component may receive: A hidden representation from the target model. Hidden states from several selected target layers. The target model's KV cache. Features produced by combining multiple target-model representations. The following sections explain how each method uses this information and how it generates candidate tokens. Native MTP Multi-Token Prediction, or MTP, refers to a family of model-native mechanisms for predicting tokens beyond the immediate next token. In vLL