NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Model Compression and Efficient Inference for Large Language Models: A Survey

Wenxiao Wang, Wei Chen, Yicong Luo, Yongliu Long, Zhengkai Lin, Liye Zhang, Binbin Lin, Deng Cai, Xiaofei HearXiv 2024 · DOI

TL;DR

This survey provides a comprehensive overview of algorithmic approaches for compressing and efficiently inferring Large Language Models (LLMs). It addresses the critical challenge of deploying LLMs on resource-constrained devices by categorizing and detailing methods like quantization, pruning, distillation, and architectural modifications, highlighting unique considerations for LLMs compared to smaller models.

What Problem Does This Paper Address?

The paper tackles the significant hurdle of deploying Large Language Models (LLMs) on resource-constrained devices. While LLMs like ChatGPT and LLaMA have demonstrated remarkable capabilities, their immense memory and computational demands during inference make them impractical for many applications. This survey aims to bridge this gap by systematically reviewing algorithmic techniques that can compress LLMs and enable efficient inference, making them accessible for broader deployment. A key challenge highlighted is the prohibitive cost of fine-tuning LLMs after compression, driving research towards tuning-free methods and techniques that preserve LLMs' generalizability across diverse tasks.

Methods

The paper surveys established and emerging algorithmic methods for LLM compression and efficient inference, categorizing them as follows:

  • Quantization: This involves reducing the precision of model weights and activations (e.g., from 32-bit floats to 4-bit integers) to decrease memory footprint and potentially speed up computation. The survey discusses various techniques like uniform/non-uniform quantization, clipping ranges, static/dynamic quantization, and the trade-offs between Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT).
  • Pruning: This technique removes redundant weights, neurons, or even entire structures (like attention heads) from the model to reduce its size and computational cost. The paper distinguishes between unstructured (individual weights) and structured pruning (network components) and discusses metrics for identifying importance.
  • Distillation: This method trains a smaller "student" model to mimic the behavior of a larger, pre-trained "teacher" LLM. The survey covers different forms of distillation, including logit-based, feature-based, and relation-based, and discusses its application in both pre-training and fine-tuning phases.
  • Compact Architecture Design: This focuses on optimizing the core components of LLMs, particularly the attention mechanism, to reduce computational and memory complexity. Techniques include sparse attention (e.g., windowed, strided), linear attention approximations, and efficient implementations like FlashAttention.
  • Dynamic Networks: These models adapt their computation based on the input, activating only a subset of the network for each inference. The survey covers approaches like early exit, cascade inference, and Mixture-of-Experts (MoE), where different "experts" handle different parts of the input.

Additionally, the paper introduces mature frameworks that support these compression and acceleration algorithms, facilitating model deployment.

Datasets

Not explicitly detailed as a primary focus, but the paper references common benchmarks used for evaluating LLM performance and compression techniques, including:

  • Wikitext-2: A standard dataset for language modeling evaluation.
  • C4 (Colossal Clean Crawled Corpus): A large-scale dataset derived from Common Crawl, widely used for pre-training and evaluating LLMs.

The paper also mentions the use of "calibration sets" for methods like quantization and pruning, which are typically subsets of training data used to derive optimal parameters without full retraining.

Key Insights and Ideas

  • LLMs have unique compression challenges: Unlike smaller models, LLMs' massive scale makes fine-tuning prohibitively expensive, pushing research towards tuning-free compression methods. Their emphasis on versatility and generalization also requires compression techniques to preserve these qualities.
  • The "medium" vs. "real" LLM distinction is useful: The authors differentiate models with <1B parameters ("medium") from those with >1B ("real" LLMs), noting that medium models are less affected by the extreme costs of fine-tuning and exhibit fewer emergent abilities, making them more amenable to traditional compression methods.
  • Quantization is a primary lever for memory reduction: Reducing bit precision (e.g., to INT4) offers significant memory savings, crucial for deployment on resource-constrained devices.
  • Pruning's effectiveness is challenged by fine-tuning costs: While effective for smaller models, the high cost of fine-tuning LLMs after pruning limits its practical application, leading to research in one-shot pruning and parameter-efficient fine-tuning.
  • Efficient attention is key to handling long sequences: Optimizing the self-attention mechanism is critical for LLMs to process longer contexts without prohibitive computational costs.
  • Mixture-of-Experts (MoE) offers a path to scale with efficiency: MoE architectures allow models to grow in capacity by selectively activating experts, potentially leading to faster inference than dense models of comparable size.

Key Results

The paper is a survey, so it doesn't present novel experimental results but rather synthesizes findings from existing research. It highlights that:

  • Various quantization methods can achieve significant compression (e.g., 3-bit or 4-bit weights) with minimal perplexity degradation on LLMs.
  • Pruning methods can achieve high sparsity ratios (e.g., 50%) with modest performance compromise, especially when fine-tuning is avoided.
  • Efficient attention mechanisms can reduce the quadratic complexity of self-attention to linear or near-linear, enabling processing of longer sequences.
  • Frameworks like DeepSpeed Inference and Power-Infer demonstrate substantial speedups (e.g., 7.3x latency reduction, 1.5x throughput increase) and enable LLMs to run on consumer hardware.

Limitations and Future Work

  • Prohibitive fine-tuning costs: The high cost of fine-tuning LLMs remains a significant challenge for many compression techniques, especially pruning and QAT. Future work should focus on more efficient fine-tuning or tuning-free methods.
  • Preserving generalization: LLMs' versatility is a key characteristic. Compression methods must be carefully evaluated to ensure they don't degrade this generalization capability.
  • Hardware-specific optimizations: While algorithmic approaches are surveyed, the paper notes that practical efficiency often depends on hardware characteristics and specialized kernels. Future work could explore tighter co-design of algorithms and hardware.
  • Emergent abilities: Understanding how compression affects LLMs' emergent abilities (e.g., multi-step reasoning) requires further investigation.
  • Framework integration: Developing more mature frameworks that seamlessly integrate various compression techniques and support efficient deployment on diverse hardware (including edge devices) is an ongoing need.

Summary updated

BibTeX
@misc{wang2024model,
  author = {Wenxiao Wang and Wei Chen and Yicong Luo and Yongliu Long and Zhengkai Lin and Liye Zhang and Binbin Lin and Deng Cai and Xiaofei He},
  title = {{Model Compression and Efficient Inference for Large Language Models: A Survey}},
  year = {2024},
  eprint = {2402.09748},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.09748},
}
Figure