Introduction
Large Language Model (LLM) inference efficiency is critical for scaling AI services. Current serving systems often struggle with the distinct resource requirements of the two primary inference phases: the compute-bound prefill phase and the memory-bound decode phase. While "hybrid batching" attempts to mix these phases, existing kernels execute them sequentially, leading to significant hardware underutilization.
POD-Attention (Prefill-Decode Overlap) is the first GPU kernel designed to concurrently execute prefill and decode tasks on the same streaming multiprocessor (SM). By intelligently co-locating these complementary workloads, POD-Attention achieves an average 28% speedup in attention computation and boosts end-to-end serving throughput by up to 22%.
The Challenge of Hybrid Batching
LLM inference is characterized by a "tale of two phases." The prefill phase processes the initial prompt, utilizing Tensor Cores for parallel computation while leaving memory bandwidth underused. Conversely, the decode phase generates tokens sequentially, saturating memory bandwidth while leaving compute units largely idle.
Modern systems use hybrid batching to improve efficiency, but standard kernels like FlashAttention are optimized for only one phase at a time. Sequential execution creates "resource holes"—periods of idle compute or memory bandwidth. Even parallel execution via standard GPU streams often fails because the hardware scheduler does not guarantee that complementary tasks will share the same SM, missing the opportunity for effective resource sharing.
POD-Attention: SM-Level Resource Orchestration
POD-Attention addresses these inefficiencies through a fused GPU kernel that manages resource allocation at the SM level. Key technical innovations include:
- SM-aware CTA Scheduling: A software-based scheduler uses the
%smidregister to track which SM a thread block (CTA) has landed on. It then consults a global counter to assign either a prefill or decode task, ensuring a balanced ratio on each SM. - Tile Size Optimization: By shrinking decode tile sizes to 16, POD-Attention minimizes redundant "zero-padded" math, freeing Tensor Cores for prefill tasks without impacting decode performance.
- Virtual Decode CTAs: To maximize concurrency, decode CTAs are split into "virtual" units that consume less shared memory, allowing more tasks to run simultaneously on a single SM.
- Prefill Split Management: The kernel limits prefill task splitting across the KV-cache dimension to prevent excessive memory contention with concurrent decode tasks.
Key Insights: Exploiting Complementary Resource Profiles
The fundamental insight behind POD-Attention is that prefill and decode tasks are "perfect roommates." One is compute-hungry, while the other is data-hungry. By forcing them to run on the same SM simultaneously, the kernel fills the utilization gaps left by specialized kernels.
The authors also identified that "CTA-parallel" fusion is superior to "warp-parallel" fusion. While warp-parallel approaches suffer from "stragglers" (where the entire block waits for the slowest task), CTA-parallel scheduling allows different blocks to start and finish independently, providing much better load balancing. Explicitly managing work assignment via software-based SM tracking is necessary to guarantee the co-location required for maximum efficiency.
Performance Evaluation
The researchers evaluated POD-Attention on NVIDIA A100 (80GB) GPUs using models such as Llama-3-8B, Llama-2-7B, and Yi-6B. Testing included real-world workloads like internal enterprise data (10.5K mean context) and the arXiv-Summarization dataset (9.5K mean context).
Key Results:
- Attention Speedup: POD-Attention improves attention mechanism speed by up to 59% (28% average) compared to independent state-of-the-art kernels.
- End-to-End Throughput: Integration with the Sarathi-Serve framework resulted in a 19% to 22% increase in total request throughput.
- Latency Reduction: The kernel significantly reduces Time-to-First-Token (TTFT) and Time-Between-Tokens (TBT). At high loads, P99 TTFT was reduced by up to 4.3x compared to the baseline.
- Energy Efficiency: By completing work faster, POD-Attention reduces energy consumption by an average of 20.5% (up to 35%).
Limitations and Future Work
While POD-Attention demonstrates significant gains on NVIDIA Ampere (A100) hardware, future work is needed to adapt the kernel for newer architectures like Hopper (H100), which feature specialized hardware like the Tensor Memory Accelerator. Additionally, the authors plan to explore automated tuning for dynamic prefill-to-decode ratios and integrate optimizations from newer kernels like FlashAttention-3.
Summary updated