PowerInfer: Fast Large Language Model Serving with a Consumer-grade GPU

Yixin Song, Zeyu Mi, Haotong Xie, Haibo Chen · DOI

Introduction

The primary barrier to running massive Large Language Models (LLMs), such as OPT-175B, on local hardware is the "memory wall." These models require hundreds of gigabytes of video memory (VRAM) to store their weights, far exceeding the 24GB found on flagship consumer GPUs like the NVIDIA RTX 4090.

Existing solutions typically rely on quantization or layer offloading. However, layer offloading creates a massive bottleneck because moving data across the PCIe bus is slow, and CPUs generally lack the parallel processing power of GPUs. PowerInfer addresses this by identifying a "locality mismatch": current systems treat all neurons in a layer equally, even though most neurons remain inactive during any given inference step.

Exploiting the Power-Law of Activation

PowerInfer is built on the discovery that neuron activation is highly skewed. In models like OPT-30B, a tiny fraction of neurons is responsible for the vast majority of activations. This creates a natural "working set" of "hot" neurons that can fit into limited consumer VRAM, while the remaining "cold" neurons are managed differently.

Neuron-level sparsity and sparse operators in the MLP block.

Methodology: Neuron-Aware Offloading

PowerInfer introduces a GPU-CPU hybrid inference engine that operates at the neuron level rather than the layer level. Its core components include:

  • Neuron-aware Offloading: Through offline profiling on datasets like Wikipedia and C4, the system identifies hot neurons to be preloaded into GPU VRAM, while cold neurons remain in system RAM.
  • Adaptive Sparsity Predictors: Small, layer-specific predictors forecast which neurons will be activated for a specific input, allowing the engine to skip the computation of inactive neurons entirely.
  • Neuron-aware Sparse Operators: Instead of using general sparse libraries, PowerInfer uses custom operators that interact directly with individual rows and columns, avoiding the overhead of matrix format conversion.

GPU-CPU Hybrid Inference

A key insight of the researchers is that for neurons stored in system RAM, it is faster to compute them directly on the CPU using vector extensions (like AVX2) than to transfer the weights to the GPU and back. This bypasses the PCIe bottleneck for "cold" neurons.

Comparison between standard GPU-centric offloading and PowerInfer's GPU-CPU hybrid approach.

An Integer Linear Programming (ILP) solver determines the optimal placement of neurons, balancing the GPU's memory capacity against the communication costs of the PCIe bus.

Key Results

The system was evaluated using real-world prompts from Alpaca and ChatGPT datasets, with accuracy verified on benchmarks like MMLU and GSM8K.

  • Massive Speedups: On an RTX 4090, PowerInfer outperformed llama.cpp by up to 11.69x.
  • Closing the Enterprise Gap: For the OPT-30B model, a single consumer RTX 4090 achieved 82% of the token generation rate of a server-grade NVIDIA A100.
  • Accuracy Preservation: Despite skipping over 90% of neurons in some layers, model accuracy remained virtually identical to the original dense models (less than 0.1% change in perplexity).

Limitations and Future Work

PowerInfer is most effective on ReLU-based models, which exhibit high natural sparsity. While it provides gains for SwiGLU models (like LLaMA 2), the sparsity is lower (~50%), leading to more modest speedups. Future directions include integrating speculative decoding and optimizing the "prefill" phase for long prompts.

Summary updated

BibTeX
@inproceedings{song2024powerinfer,
  author = {Yixin Song and Zeyu Mi and Haotong Xie and Haibo Chen},
  title = {{PowerInfer: Fast Large Language Model Serving with a Consumer-grade GPU}},
  booktitle = {SOSP},
  year = {2024},
  doi = {10.1145/3694715.3695964},
}
Figure