Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Shrestha, Susav, Settlemyer, Brad, Dryden, Nikoli, Reddy, Narasimha
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866909898934059008
author Shrestha, Susav
Settlemyer, Brad
Dryden, Nikoli
Reddy, Narasimha
author_facet Shrestha, Susav
Settlemyer, Brad
Dryden, Nikoli
Reddy, Narasimha
contents Accelerating large language model (LLM) inference is critical for real-world deployments requiring high throughput and low latency. Contextual sparsity, where each token dynamically activates only a small subset of the model parameters, shows promise but does not scale to large batch sizes due to union of active neurons quickly approaching dense computation. We introduce Polar Sparsity, highlighting a key shift in sparsity importance from MLP to Attention layers as we scale batch size and sequence length. While MLP layers become more compute-efficient under batching, their sparsity vanishes. In contrast, attention becomes increasingly more expensive at scale, while their head sparsity remains stable and batch-invariant. We develop Selective Head Attention with hardware-efficient, sparsity-aware GPU kernels, delivering up to \(2.2\times\) end-to-end speedups for models like OPT, LLaMA-2 \& 3, Qwen, Mistral across various batch sizes and sequence lengths without compromising accuracy. To our knowledge, this is the first work to demonstrate that contextual sparsity can scale effectively to large batch sizes, delivering substantial inference acceleration with minimal changes, making Polar Sparsity practical for large-scale, high-throughput LLM deployment systems. Our code is available at: https://github.com/susavlsh10/Polar-Sparsity.
format Preprint
id arxiv_https___arxiv_org_abs_2505_14884
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity
Shrestha, Susav
Settlemyer, Brad
Dryden, Nikoli
Reddy, Narasimha
Machine Learning
Artificial Intelligence
Accelerating large language model (LLM) inference is critical for real-world deployments requiring high throughput and low latency. Contextual sparsity, where each token dynamically activates only a small subset of the model parameters, shows promise but does not scale to large batch sizes due to union of active neurons quickly approaching dense computation. We introduce Polar Sparsity, highlighting a key shift in sparsity importance from MLP to Attention layers as we scale batch size and sequence length. While MLP layers become more compute-efficient under batching, their sparsity vanishes. In contrast, attention becomes increasingly more expensive at scale, while their head sparsity remains stable and batch-invariant. We develop Selective Head Attention with hardware-efficient, sparsity-aware GPU kernels, delivering up to \(2.2\times\) end-to-end speedups for models like OPT, LLaMA-2 \& 3, Qwen, Mistral across various batch sizes and sequence lengths without compromising accuracy. To our knowledge, this is the first work to demonstrate that contextual sparsity can scale effectively to large batch sizes, delivering substantial inference acceleration with minimal changes, making Polar Sparsity practical for large-scale, high-throughput LLM deployment systems. Our code is available at: https://github.com/susavlsh10/Polar-Sparsity.
title Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2505.14884