Search for Efficient Large Language Models

Xuan Shen, Pu Zhao, Yifan Gong, Zhenglun Kong, Zheng Zhan, Yushu Wu, Ming Lin, Chao Wu, Xue Lin, Yanzhi Wang

Abstract

Large Language Models (LLMs) face significant deployment challenges due to their immense computational and memory requirements. This paper introduces a training-free architecture search framework designed to identify high-performing "subnets" within pre-trained LLMs. By integrating evolutionary search with a novel weight reformation algorithm, the proposed method achieves substantial model compression across the LLaMA and OPT families while maintaining high accuracy. Notably, this approach avoids the prohibitive costs of traditional retraining, requiring only a few hours on a single GPU.

Introduction

The deployment of Large Language Models (LLMs) like GPT-3 or LLaMA is often restricted by their massive resource demands. For instance, loading a 175B parameter model requires hundreds of gigabytes of VRAM, making edge deployment unfeasible. While weight pruning and quantization offer some relief, they typically optimize individual parameters rather than the structural architecture. Neural Architecture Search (NAS) could potentially discover more efficient structures, but standard NAS techniques require training numerous candidate models—a process that is economically and computationally impossible for LLMs. This research addresses this "complexity gap" by proposing a method to find optimal efficient architectures hidden within pre-trained models without extensive retraining.

Methodology

The framework utilizes a three-stage pipeline to identify and refine efficient subnets:

1. Importance-Aware Initialization

Rather than starting with a random architecture, the search begins by calculating importance scores for every row and column in the model's weight matrices. Using a Fisher-information-based metric, the most critical components are preserved to initialize the search space.

Initialization process based on weight importance.

An evolution-based algorithm explores the search space through mutation and crossover. A key innovation is the mask mutation strategy, which tracks specific channel indices to maintain structural integrity during the search process.

3. Weight Reformation

To compensate for information lost during pruning, the weights of the selected subnet are "reformed" using the Alternating Direction Method of Multipliers (ADMM). With only 128 calibration samples, the subnet learns to inherit the collective knowledge of the original model, significantly recovering performance without full fine-tuning.

Experimental Results

The framework was evaluated across the LLaMA (7B to 65B) and OPT (125M to 2.7B) families using benchmarks like WikiText2 and various common-sense reasoning tasks.

Performance and Scalability

The method demonstrates superior accuracy compared to state-of-the-art (SOTA) competitors. For LLaMA-7B at a 60% parameter ratio, the approach achieved a perplexity of 10.21, significantly lower than LLM-Pruner (38.27) and SliceGPT (279.52).

Perplexity vs. compression ratio across OPT and LLaMA model families.

As shown in the figures above, the method remains stable across scales, including the 30B and 65B LLaMA variants. The search process is highly efficient, completing for a LLaMA-7B model in approximately 5 hours on a single NVIDIA A100 GPU.

Key Insights

  • Redundancy Patterns: Analysis revealed that MLP (Multi-Layer Perceptron) modules in LLMs are significantly more redundant than Attention modules, allowing for more aggressive pruning in those layers.
  • Initialization Impact: Starting the search from an importance-based state rather than a random one dramatically accelerates convergence and improves final subnet quality.
  • Structured Efficiency: The resulting subnets are structured, meaning they provide direct hardware speedups and memory savings without requiring custom kernels.

Conclusion

This training-free architecture search framework provides a practical path for compressing LLMs. By leveraging weight reformation and evolutionary search, it achieves SOTA performance with minimal compute. Future work may involve combining this structural search with low-bit quantization to push the boundaries of model efficiency even further.

Summary updated

BibTeX
@inproceedings{shen2024search,
  author = {Xuan Shen and Pu Zhao and Yifan Gong and Zhenglun Kong and Zheng Zhan and Yushu Wu and Ming Lin and Chao Wu and Xue Lin and Yanzhi Wang},
  title = {{Search for Efficient Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=lxSmLxlVks},
}
Figure