Endor: Hardware-Friendly Sparse Format for Offloaded LLM Inference

Donghyeon Joo, Ramyad Hadidi, Soheil Feizi, Bahar AsgariarXiv 2024 · DOI

Abstract

Large Language Model (LLM) inference is increasingly constrained by GPU memory limits, forcing a reliance on offloading weights to slower system RAM or SSDs. This offloading introduces a massive data transfer bottleneck where PCIe bandwidth, rather than GPU compute, dictates performance. We introduce Endor, a novel sparse memory format designed specifically for hardware-efficient offloading. By utilizing a simple bitmap to represent unstructured sparsity, Endor significantly reduces the volume of data transferred across the PCIe bus while ensuring minimal decompression overhead on the GPU. Our results demonstrate that Endor achieves up to a 2.37× speedup for models like Llama2-70B, effectively bridging the gap between storage and computation in resource-constrained environments.

Introduction: The Data Transfer Bottleneck

Modern LLMs, such as the 70-billion parameter Llama2, require approximately 140GB of memory for 16-bit weights, far exceeding the 16GB-24GB VRAM typical of consumer-grade GPUs. To run these models, practitioners employ offloading, where weights reside in system DRAM or SSDs and are streamed to the GPU for each layer's computation.

Analysis of offloaded inference reveals a "peculiar situation": because PCIe bandwidth (e.g., 11 GB/s for CPU-GPU or 2.5 GB/s for SSD-CPU) is orders of magnitude lower than GPU memory bandwidth and compute throughput, the system spends nearly 100% of its time waiting for data. In this regime, the actual computation time is negligible, making data transfer the primary target for optimization.

The Endor Sparse Format

To address this bottleneck, we propose Endor, a sparse format optimized for the hardware constraints of offloaded inference. Unlike structured pruning, which can degrade model accuracy, Endor supports flexible unstructured pruning (e.g., 50% sparsity via Wanda or SparseGPT).

The core of Endor is its simplicity. Instead of using complex indexing structures like Compressed Sparse Row (CSR), which add significant metadata overhead, Endor stores non-zero values alongside a compact bitmap. In this bitmap, a single bit indicates whether a weight is zero or non-zero.

Illustration of the Endor bitmap format for sparse weight representation.

This format is "hardware-friendly" because the decompression process—inflating the sparse weights back into a dense matrix for computation—is highly parallelizable and can be executed almost instantly on the GPU. This ensures that the time saved during transfer is not lost to processing overhead.

Performance Evaluation

We evaluated Endor using OPT-66B and Llama2-70B models. A critical insight from our experiments is the trade-off between compression ratio and decompression speed. While standard compression algorithms like ZSTD offer high ratios, their decompression overhead on the CPU or GPU is too high for real-time inference.

Comparison of execution time components across different compression and transfer methods.

As shown in the figure above, Endor significantly reduces the SSD-to-CPU and CPU-to-GPU transfer times compared to the dense baseline. Crucially, its decompression time is minimal compared to ZSTD, allowing for a net performance gain. When combined with NVIDIA GPUDirect Storage to bypass the CPU, Endor achieves a 2.37× speedup for Llama2-70B.

Furthermore, Endor preserves model accuracy. On the WikiText validation set, Llama2-70B at 50% sparsity with Endor maintained a perplexity of 3.97, significantly outperforming structured 2:4 sparsity (5.20). Endor is also orthogonal to quantization; combining it with INT8 quantization yields cumulative speedups and memory savings.

Conclusion

Endor demonstrates that in offloaded LLM inference, reducing data volume through simple, hardware-aligned compression is more effective than complex algorithmic optimizations. By slashing the PCIe transfer bottleneck, Endor enables high-performance inference of massive models on modest hardware. Future work will explore multi-SSD parallelism and native GPU support for unstructured sparse computation to further enhance these gains.

Summary updated

Abstract

The increasing size of large language models (LLMs) challenges their usage on resource-constrained platforms. For example, memory on modern GPUs is insufficient to hold LLMs that are hundreds of Gigabytes in size. Offloading is a popular method to escape this constraint by storing weights of an LLM model to host CPU memory and SSD, then loading each weight to GPU before every use. In our case study of offloaded inference, we found that due to the low bandwidth between storage devices and GPU, the latency of transferring large model weights from its offloaded location to GPU memory becomes the critical bottleneck with actual compute taking nearly 0% of runtime. To effectively reduce the weight transfer latency, we propose a novel sparse format that compresses the unstructured sparse pattern of pruned LLM weights to non-zero values with high compression ratio and low decompression overhead. Endor achieves this by expressing the positions of non-zero elements with a bitmap. Compared to offloaded inference using the popular Huggingface Accelerate, applying Endor accelerates OPT-66B by 1.70x and Llama2-70B by 1.78x. When direct weight transfer from SSD to GPU is leveraged, Endor achieves 2.25x speedup on OPT-66B and 2.37x speedup on Llama2-70B.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
OPT-66B · text-generation single passEndor offloaded inferenceexecution time35.8sText Generation · params=66B · device-mapping=layers 0–4 GPU, 5–12 CPU, 13–63 storage · inference-mode=offloaded single pass
Source quote
L163: For a single pass through OPT-66B, dense offloaded inference takes 54s while Endor offloaded inference takes 35.8s, an overall 1.51× speedup. Figure~\ref{fig:fig6} breaks down the speedup into each device-mapped layers. In CPU-mapped layers, the reduced overhead of CPU to GPU weight transfer is more than enough to compensate for the added Endor decompression overhead for a 1.30× speedup.
LLaMA2-70B · offloaded inferenceEndor with direct SSD-to-GPU weight transferspeedup2.37 ×Text Generation · params=70B · comparison=Huggingface Accelerate offloaded inference · weight-transfer=direct SSD-to-GPU
Source quote
L5: To effectively reduce the weight transfer latency, we propose a novel sparse format that compresses the unstructured sparse pattern of pruned LLM weights to non-zero values with high compression ratio and low decompression overhead. Endor achieves this by expressing the positions of non-zero elements with a bitmap. Compared to offloaded inference using the popular Huggingface Accelerate, applying Endor accelerates OPT-66B by 1.70× and Llama2-70B by 1.78×. When direct weight transfer from SSD to GPU is leveraged, Endor achieves 2.25× speedup on OPT-66B and 2.37× speedup on Llama2-70B.
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
OPT-66B · text-generation single passDense offloaded inference baselineexecution time54sText Generation · params=66B · device-mapping=layers 0–4 GPU, 5–12 CPU, 13–63 storage · inference-mode=offloaded single pass
Source quote
L163: For a single pass through OPT-66B, dense offloaded inference takes 54s while Endor offloaded inference takes 35.8s, an overall 1.51× speedup. Figure~\ref{fig:fig6} breaks down the speedup into each device-mapped layers. In CPU-mapped layers, the reduced overhead of CPU to GPU weight transfer is more than enough to compensate for the added Endor decompression overhead for a 1.30× speedup.
WikiTextDense OPT-66B model baselineperplexity9.33Language Modeling · split: val · params=66B · model=OPT-66B
Source quote
L185: Because Endor sparse format retains the exact non-zero values and the positions of the pruned weight matrix, it preserves the performance of the utilized pruning method. For our workload OPT-66B pruned with SparseGPT~\cite{sparsegpt}, we measured 9.34 perplexity on the WikiText~\cite{wikitext} validation set, which was very close to 9.33 perplexity measure with the dense model. When 2:4 structured sparsity is enforced, we measure the deteriorated perplexity of 10.07, highlighting the value of compressing unstructured sparsity.
BibTeX
@misc{joo2024endor,
  author = {Donghyeon Joo and Ramyad Hadidi and Soheil Feizi and Bahar Asgari},
  title = {{Endor: Hardware-Friendly Sparse Format for Offloaded LLM Inference}},
  year = {2024},
  eprint = {2406.11674},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.11674},
}
Figure