Ragged Paged Attention: A High-Performance and Flexible LLM Inference Kernel for TPU

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Jiang, Jevin, Chen, Ying, Hechtman, Blake A., Zhang, Fenghui, Mu, Yarong
Formato: Preprint
Publicado: 2026
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866914481996562432
author Jiang, Jevin
Chen, Ying
Hechtman, Blake A.
Zhang, Fenghui
Mu, Yarong
author_facet Jiang, Jevin
Chen, Ying
Hechtman, Blake A.
Zhang, Fenghui
Mu, Yarong
contents Large Language Model (LLM) deployment is increasingly shifting to cost-efficient accelerators like Google's Tensor Processing Units (TPUs), prioritizing both performance and total cost of ownership (TCO). However, existing LLM inference kernels and serving systems remain largely GPU-centric, and there is no well-established approach for efficiently mapping LLM workloads onto TPU architectures--particularly under the dynamic and ragged execution patterns common in modern serving. In this paper, we present Ragged Paged Attention (RPA), a high-performance and flexible attention kernel for TPUs, implemented using Pallas and Mosaic. RPA addresses these challenges through three key techniques: (1) fine-grained tiling to enable efficient dynamic slicing over ragged memory, (2) a custom software pipeline that fuses KV cache updates with attention computation, and (3) a distribution-aware compilation strategy that generates specialized kernels for decode, prefill, and mixed workloads. Evaluated on Llama 3 8B on TPU7x, RPA achieves up to 86% memory bandwidth utilization (MBU) in decode and 73% model FLOPs utilization (MFU) in prefill. Integrated as the primary TPU backend in vLLM and SGLang, RPA provides a production-grade foundation for efficient TPU inference and offers practical insights into kernel design.
format Preprint
id arxiv_https___arxiv_org_abs_2604_15464
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Ragged Paged Attention: A High-Performance and Flexible LLM Inference Kernel for TPU
Jiang, Jevin
Chen, Ying
Hechtman, Blake A.
Zhang, Fenghui
Mu, Yarong
Performance
Artificial Intelligence
Machine Learning
Large Language Model (LLM) deployment is increasingly shifting to cost-efficient accelerators like Google's Tensor Processing Units (TPUs), prioritizing both performance and total cost of ownership (TCO). However, existing LLM inference kernels and serving systems remain largely GPU-centric, and there is no well-established approach for efficiently mapping LLM workloads onto TPU architectures--particularly under the dynamic and ragged execution patterns common in modern serving. In this paper, we present Ragged Paged Attention (RPA), a high-performance and flexible attention kernel for TPUs, implemented using Pallas and Mosaic. RPA addresses these challenges through three key techniques: (1) fine-grained tiling to enable efficient dynamic slicing over ragged memory, (2) a custom software pipeline that fuses KV cache updates with attention computation, and (3) a distribution-aware compilation strategy that generates specialized kernels for decode, prefill, and mixed workloads. Evaluated on Llama 3 8B on TPU7x, RPA achieves up to 86% memory bandwidth utilization (MBU) in decode and 73% model FLOPs utilization (MFU) in prefill. Integrated as the primary TPU backend in vLLM and SGLang, RPA provides a production-grade foundation for efficient TPU inference and offers practical insights into kernel design.
title Ragged Paged Attention: A High-Performance and Flexible LLM Inference Kernel for TPU
topic Performance
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2604.15464