Skip to Content
AI 시스템 성능 엔지니어링 (Korean Edition)
book

AI 시스템 성능 엔지니어링 (Korean Edition)

by Chris Fregly
November 2025
Beginner to intermediate
1060 pages
20h 15m
Korean
O'Reilly Media, Inc.
Content preview from AI 시스템 성능 엔지니어링 (Korean Edition)

제17장. 추론을 위한 분산 프리필 및 디코딩확장

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

이전 장에서 언급했듯이, LLM 추론은 두 가지 별개의 단계로 나눌 수 있습니다: 사전 채우기( ) 단계와 디코딩(decode) 단계입니다. 사전 채우기 단계는 입력 prompt를 처리하여 해당 prompt에 대한 LLM의 내부 키-값(KV) 캐시를 생성하는 반면, 디코딩 단계는 캐시된 값들을 사용하여 출력 토큰을 하나씩(또는 추측적 디코딩의 경우 한 번에 몇 개씩) 생성합니다.

이 두 단계는 근본적으로 다른 성능 특성을 가집니다. 프리필 단계는 컴퓨팅 바운디드하며, 수천 개의 토큰에 대한 병렬 행렬 연산을 다수 수행하여 상당한 양의 FLOPS를 소모합니다. 반면 디코딩 단계는 메모리 I/O 바운디드하며, 각 토큰 생성을 위해 대규모 KV 캐시를 읽고 새 값을 쓰며 메모리 대역폭에 부담을 줍니다. 간단히 말해 프리필은 높은 처리량의 병렬 작업 부하인 반면, 디코딩은 순차적이며 지연 시간에 민감한 작업 부하입니다.

초기 LLM 서비스 시스템은 두 단계를 동일한 하드웨어 상의 단일 통합 파이프라인으로 처리했습니다. 따라서 일반적으로 요청 배칭을 통해 처리량을 우선시함으로써 프리필 단계를 중시했습니다. 그러나 대화형 애플리케이션이 증가함에 따라, 첫 번째 토큰까지의 시간(TTFT, 모든 토큰에 대한 프리필 지연) 및 출력 토큰당 시간(TPOT, 토큰당 디코드 지연)과 같은 실시간 성능( ) 지표가 순수 처리량만큼 중요해졌습니다. 단일 GPU 기반 추론 엔진이 두 단계를 동시에 처리할 때 TTFT와 TPOT를 동시에 최적화하는 것은 어렵습니다.

많은 요청을 배치하면 처리량은 향상되지만, 모든 요청이 가장 느린 프리필을 기다려야 하므로 TTFT는 악화됩니다. 또한 디코딩 단계가 새 prompt 프리필 뒤에 백로그가 쌓이게 되어 TPOT에도 영향을 미칩니다.

단일형 추론 시스템은 첫 번째 토큰까지의 시간(TTFT)을 개선(단축)하는 대신 후속 토큰 생성이 느려지는 대가를 치르거나, 토큰당 처리량(TPOT)을 개선(증가)하는 대신 새 요청이 높은 초기 지연 시간을 겪게 되는 선택을 해야 합니다. 극단적인 경우, 하나의 긴 prompt가 GPU를 완전히 점유하여 다른 사용자의 모든 프롬프트 프리필 작업을 차단할 수 있습니다. 또한 디코딩이 시작되면, 한 번에 하나의 토큰만 처리하는 방식은 각 토큰 생성 사이에 GPU 코어를 유휴 상태로 남겨둡니다.

이러한 문제를 해결하기 위해 연구진과 엔지니어 는 두 단계를 분리하는 방법을 모색했습니다. 핵심 통찰은 프리필과 디코딩이 반드시 동일한 하드웨어, 심지어 동일한 유형의 하드웨어에서 실행될 필요가 없다는 점입니다.

프리필과 디코딩 단계를 분리한다는 것은 각 단계의 요구사항에 특화된 서로 다른 리소스에 할당하는 것을 의미합니다. 이 아이디어는 DistServe에 관한 논문에서 시스템에 의해 최초로 제안되었으며, 단계 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

PostgreSQL로 데이터 및 AI 플랫폼 구축하기 (Korean Edition)

PostgreSQL로 데이터 및 AI 플랫폼 구축하기 (Korean Edition)

Tom Taulli, Benjamin Anderson, Jozef de Vries
도메인 중심 혁신 (Korean Edition)

도메인 중심 혁신 (Korean Edition)

Carola Lilienthal, Henning Schwentner
AI 에이전트를 위한 메모리 관리

AI 에이전트를 위한 메모리 관리

Benjamin Labaschin, Jim Allen Wallace, Andrew Brookins, Manvinder Singh

Publisher Resources

ISBN: 0642572281533