Skip to main content
QUICK REVIEW

[Paper Review] CompactifAI: Extreme Compression of Large Language Models using Quantum-Inspired Tensor Networks

Andrei Tomut, Saeed S. Jahromi|arXiv (Cornell University)|Jan 25, 2024
Topic ModelingComputer Science8 citations
TL;DR

CompactifAI uses quantum-inspired tensor networks (MPOs) to tensorize LLM weights, achieving substantial compression (30% size) with ~90% of original accuracy after brief retraining on LlaMA-2 7B. It can complement other compression methods and speeds up distributed training.

ABSTRACT

Large Language Models (LLMs) such as ChatGPT and LlaMA are advancing rapidly in generative Artificial Intelligence (AI), but their immense size poses significant challenges, such as huge training and inference costs, substantial energy demands, and limitations for on-site deployment. Traditional compression methods such as pruning, distillation, and low-rank approximation focus on reducing the effective number of neurons in the network, while quantization focuses on reducing the numerical precision of individual weights to reduce the model size while keeping the number of neurons fixed. While these compression methods have been relatively successful in practice, there is no compelling reason to believe that truncating the number of neurons is an optimal strategy. In this context, this paper introduces CompactifAI, an innovative LLM compression approach using quantum-inspired Tensor Networks that focuses on the model's correlation space instead, allowing for a more controlled, refined and interpretable model compression. Our method is versatile and can be implemented with - or on top of - other compression techniques. As a benchmark, we demonstrate that a combination of CompactifAI with quantization allows to reduce a 93% the memory size of LlaMA 7B, reducing also 70% the number of parameters, accelerating 50% the training and 25% the inference times of the model, and just with a small accuracy drop of 2% - 3%, going much beyond of what is achievable today by other compression techniques. Our methods also allow to perform a refined layer sensitivity profiling, showing that deeper layers tend to be more suitable for tensor network compression, which is compatible with recent observations on the ineffectiveness of those layers for LLM performance. Our results imply that standard LLMs are, in fact, heavily overparametrized, and do not need to be large at all.

Motivation & Objective

  • Motivate greener, more efficient LLM deployment by reducing model size without brute-force neuron truncation.
  • Introduce tensor-network-based compression to target correlation space rather than neuron count.
  • Demonstrate compatibility with other compression techniques and effectiveness in distributed training.

Proposed method

  • Tensorize selected Self-Attention and MLP weight matrices into Matrix Product Operators (MPOs) with bond dimension chi.
  • Determine MPO via sequential SVDs retaining top chi singular values to truncate correlations.
  • Retrain the tensorized model briefly to recover accuracy, leveraging reduced CPU-GPU transfer times in distributed settings.
  • Benchmark on LlaMA-2 7B, using chi ≈ 100 in SA and MLP layers with float16 to achieve compression.
  • Combine with mild quantization (float32 to float16) for additional size reduction.
  • Assess text summarization performance using Rouge metrics on XSum and Gigaword datasets.

Experimental results

Research questions

  • RQ1Can quantum-inspired tensor networks efficiently compress LLMs by truncating correlation space without drastically compromising accuracy?
  • RQ2What is the impact of MPO-based compression and subsequent retraining on model size, training speed, and downstream task performance?
  • RQ3How does CompactifAI interact with other compression techniques such as quantization?
  • RQ4Is the approach viable for distributed, multi-GPU training in practical settings?

Key findings

  • Compresses LlaMA-2 7B from 7B parameters to about 2B parameters (30% of original size in float16).
  • Memory footprint reduces to 3.7 GB (float16) after compression and modest quantization.
  • Retraining the compressed model yields ~90% of the original Rouge-based summarization accuracy on XSum and Gigaword.
  • Training/retraining time for the compressed model is about half that of the uncompressed model in distributed multi-GPU setup.
  • Mild quantization (float32 to float16) provides an additional ~2x compression, bringing final size to ~15% of the original 7B model in float32.
  • The method is GPU-compatible and demonstrated on a single AWS machine with 8 NVIDIA A100 GPUs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.