LLMServingSim: A HW/SW Co-Simulation Infrastructure for LLM Inference Serving at Scale

Jaehong Cho, Minsu Kim, Hyunmin Choi, Guseul Heo, Jongse Park

TL;DR

Researchers have developed LLMServingSim, a novel co-simulation infrastructure that accurately models both hardware and software for large language model (LLM) inference serving. This tool significantly speeds up simulation times by exploiting LLM-specific redundancies, enabling more efficient exploration of complex, heterogeneous LLM serving systems.

What Problem Does This Paper Address?

Deploying LLMs at scale for real-world applications requires highly efficient inference serving systems. While there's been a surge in research on LLM algorithms and specialized hardware accelerators (like NPUs and PIM), a critical bottleneck exists: the lack of accurate and efficient simulation tools. Existing simulators struggle to model the dynamic, iterative nature of LLM inference and are often too slow for exploring complex, heterogeneous system designs at scale. This gap hinders researchers from effectively evaluating new hardware-software co-design proposals for LLM serving.

Methods

LLMServingSim tackles this challenge by introducing several key innovations:

  • Iteration-Level Simulation: Instead of simulating every single operation, LLMServingSim simulates LLM inference at the iteration level (token generation). This approach accounts for the dynamic changes in workload inherent to LLM's autoregressive nature.
  • Computation Reuse: LLMServingSim leverages the inherent redundancy in LLM architectures, specifically within the repeated transformer blocks. It compiles and simulates a single transformer block and then reuses this for subsequent blocks, drastically reducing compilation and simulation time. It also separates attention and non-attention layers for further optimization.
  • KV Cache-Aware Memory Modeling: LLMs heavily rely on KV caches, which consume significant memory. LLMServingSim incorporates a sophisticated memory management scheme, inspired by vLLM's paged attention, to accurately model KV cache behavior and memory fragmentation.
  • Flexible Heterogeneous System Support: The infrastructure is designed to be pluggable, allowing users to integrate various accelerator compilers and simulators (e.g., NPUs, PIMs, GPUs). This enables the simulation of complex, heterogeneous systems with different processor types and interconnects.
  • Operator Mapping and Scheduling: LLMServingSim provides mechanisms for intelligently mapping LLM operators to different accelerators based on their characteristics (compute-bound vs. memory-bound) and for scheduling these operations across heterogeneous components.

Datasets

The paper mentions using the following datasets for generating request traces:

  • ShareGPT [62]
  • Alpaca [69]

Key Insights and Ideas

  • LLM Inference is Fundamentally Different from Training: The iterative, dynamic nature of LLM inference (token-by-token generation) requires simulation approaches distinct from those used for training, which often involves many identical iterations.
  • Exploiting LLM Architecture is Key to Speed: The repeated structure of transformer blocks in LLMs is a prime target for optimization. LLMServingSim's success hinges on effectively reusing computations from these blocks.
  • Memory Management is Crucial for LLM Serving: The KV cache is a significant factor in LLM inference performance and memory footprint. Accurate modeling of this component is essential for realistic simulations.
  • Heterogeneity is the Future: Modern LLM serving systems are increasingly incorporating diverse accelerators. A simulator must be flexible enough to model these complex, multi-vendor environments.

Key Results

  • High Accuracy: LLMServingSim achieves simulation results closely mirroring real GPU-based LLM serving systems, with an error rate of less than 14.7%.
  • Significant Speedup: Compared to existing accelerator simulators (mNPUsim, GeneSys, NeuPIMs), LLMServingSim offers a substantial speedup, ranging from 34.7x to 490.98x for single-iteration simulations.
  • Scalability: The simulator demonstrates good scalability, handling large models (up to 175B parameters) and a large number of NPUs (up to 2048) within feasible simulation times.
  • Validation: The simulator's accuracy was validated against both homogeneous (GPU-based vLLM) and heterogeneous (NPU-PIM) systems.

Limitations and Future Work

  • Focus on Decoder-Based Architectures: Currently, LLMServingSim primarily focuses on traditional decoder-based LLM architectures. While the authors believe it can support newer variants (like MoE, RAG) with modifications, this is an area for future development.
  • Extending Accelerator Support: The framework is designed for pluggability, suggesting future work could involve integrating a wider range of accelerators and memory technologies (e.g., HDDs, SSDs, computational storage).
  • Exploring New Model Variants: The authors explicitly mention the need to support emerging LLM architectures and lightweight techniques like quantization and pruning, which have different computational characteristics.
  • Advanced Scheduling Strategies: While LLMServingSim incorporates iteration-level scheduling, future work could explore more advanced strategies for heterogeneous environments.

Summary updated

Abstract

Recently, there has been an extensive research effort in building efficient large language model (LLM) inference serving systems. These efforts not only include innovations in the algorithm and software domains but also constitute developments of various hardware acceleration techniques. Nevertheless, there is a lack of simulation infrastructure capable of accurately modeling versatile hardware-software behaviors in LLM serving systems without extensively extending the simulation time.This paper aims to develop an effective simulation tool, called LLMServingSim, to support future research in LLM serving systems. In designing LLMServingSim, we focus on two limitations of existing simulators: (1) they lack consideration of the dynamic workload variations of LLM inference serving due to its autoregressive nature, and (2) they incur repetitive simulations without leveraging algorithmic redundancies in LLMs. To address these limitations, LLMServingSim simulates the LLM serving in the granularity of iterations, leveraging the computation redundancies across decoder blocks and reusing the simulation results from previous iterations. Additionally, LLMServingSim provides a flexible framework that allows users to plug in any accelerator compiler-and-simulation stacks for exploring various system designs with heterogeneous processors. Our experiments demonstrate that LLMServingSim produces simulation results closely following the performance behaviors of real GPU-based LLM serving system with less than 14.7% error rate, while offering 91.5× faster simulation speed compared to existing accelerator simulators.
BibTeX
@misc{cho2024llmservingsim,
  author = {Jaehong Cho and Minsu Kim and Hyunmin Choi and Guseul Heo and Jongse Park},
  title = {{LLMServingSim: A HW/SW Co-Simulation Infrastructure for LLM Inference Serving at Scale}},
  year = {2024},
  eprint = {2408.05499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.05499},
}
Figure