Disaggregated prefill and decode for LLM inference on SageMaker HyperPod
Disaggregated Prefill and Decode (DPD) separates compute-bound prefilling and memory-bound decoding onto distinct GPU pools to eliminate interference between long-context processing and token generation. Implementation leverages Amazon SageMaker HyperPod, vLLM, and LMCache over Elastic Fabric Adapter (EFA) with RDMA to achieve negligible KV cache transfer latency (single-digit milliseconds). An intelligent router dynamically routes requests based on prompt length, sending short prompts directly
Analysis
TL;DR
- Disaggregated Prefill and Decode (DPD) separates compute-bound prefilling and memory-bound decoding onto distinct GPU pools to eliminate interference between long-context processing and token generation.
- Implementation leverages Amazon SageMaker HyperPod, vLLM, and LMCache over Elastic Fabric Adapter (EFA) with RDMA to achieve negligible KV cache transfer latency (single-digit milliseconds).
- An intelligent router dynamically routes requests based on prompt length, sending short prompts directly to decoders while directing long-context prompts through prefillers to optimize Time To First Token (TTFT) and Inter-Token Latency (ITL).
- The architecture supports advanced caching strategies, including L1 CPU caching for recurring prefixes, significantly reducing redundant computation and improving throughput for high-concurrency streaming workloads.
Why It Matters
This approach addresses a critical scalability bottleneck in large language model inference, where colocated prefill and decode phases cause latency spikes for concurrent users when handling long prompts. By decoupling these phases, organizations can independently optimize resources for different workload characteristics, ensuring consistent performance for enterprise applications like RAG systems and agentic pipelines that require low-latency, high-throughput streaming responses.
Technical Details
- Architecture Components: The solution comprises an intelligent router, prefiller pods, and decoder pods, orchestrated by the HyperPod Inference Operator. The router uses configurable token thresholds to determine routing paths, supporting strategies like
prefixaware,kvaware,session, androundrobinto maximize cache locality. - KV Cache Transfer Stack: Data movement utilizes a four-layer stack: LMCache PD (backend orchestration), NIXL (unified memory abstraction),
libfabric(kernel-bypass provider), and AWS EFA (network interface). This enables GPU-Direct RDMA, keeping the host CPU out of the data path and minimizing transfer overhead. - Optimization Mechanisms: Prefillers employ layer-by-layer KV cache pushing with compute-transfer overlap to saturate GPUs. An L1 CPU cache within LMCache stores recurring prefixes (e.g., system prompts), allowing immediate retrieval without GPU recomputation. Decoders reserve specific GPU memory buffers (
PD_BUFFER_SIZE) and utilize full CUDA graphs to start generation instantly upon transfer completion. - Performance Metrics: On
ml.p5.48xlargeinstances with 3,200 Gbps EFA, transferring an 8,000-token KV cache for models like Llama 3.3 70B takes single-digit milliseconds, making the network cost negligible compared to prefill compute time.
Industry Insight
- Workload-Specific Deployment: Organizations should adopt DPD primarily for high-concurrency, long-context streaming workloads (e.g., RAG, chat assistants). For batch processing or short-prompt scenarios, colocated deployments remain more cost-effective due to the fixed overhead of cross-GPU KV transfers.
- Infrastructure Requirements: Successful implementation requires infrastructure capable of high-bandwidth, low-latency interconnects (like EFA/RDMA). Teams must ensure their cloud environments support RDMA-capable networking to realize the performance benefits of disaggregation.
- Operational Complexity vs. Gain: While DPD introduces architectural complexity via additional components (router, separate pods), it simplifies operational tuning by allowing independent scaling of prefill and decode resources. This decoupling provides more reliable tail latency control compared to traditional chunked prefill methods.
Disclaimer: The above content is generated by AI and is for reference only.