Model Compression
Ways to make models smaller and faster: quantization, pruning, distillation, LoRA, and more.
AWQ (Activation-aware Weight Quantization)AWQ quantizes the weights of large language models to 4 or 3 bits by scaling up only the weights of input channels with large activations before rounding, which reduces the error on the important weights. It needs no backpropagation; it only measures activation magnitudes on a small amount of data.
BinaryConnectBinaryConnect is a training method that binarizes weights to +1 or −1 only during forward and backward propagation, while updates are applied to a separately stored set of real-valued weights. It replaces multiplications by weights with additions and subtractions, and on MNIST, CIFAR-10, and SVHN it matched or beat the error rates of real-valued weights.
BitNetBitNet trains large language models from scratch by replacing the linear layers of a Transformer with BitLinear, which uses 1-bit weights (+1 or −1) and 8-bit activations. At 6.7B parameters it keeps accuracy comparable to 8-bit post-training quantization, while the arithmetic energy of matrix multiplication is estimated to drop substantially.
BitNet b1.58BitNet b1.58 trains a large language model from scratch with the weights of its linear layers restricted to the three values −1, 0, and +1 (about 1.58 bits) and its activations in 8 bits. From 3B parameters upward it matches the accuracy of 16-bit LLaMA-style models, and at 3B it cuts GPU memory to 1/3.55 and generation latency to 1/2.71.
Deep CompressionDeep Compression compresses neural networks in three stages: pruning, quantization through weight sharing, and Huffman coding. It shrank AlexNet from 240MB to 6.9MB (35×) and VGG-16 from 552MB to 11.3MB (49×) without loss of accuracy.
Filter Pruning (Structured Pruning)Filter pruning is a form of structured pruning that removes entire convolutional filters, starting with those whose sum of absolute weights (L1 norm) is smallest. Because the layers themselves become thinner, inference gets faster without any sparse computation support; on CIFAR-10, VGG-16 kept its accuracy while its computation was reduced by 34%.
GPTQGPTQ is a method that quantizes the weights of a trained large language model to 3–4 bits without retraining. It quantizes the weights one column at a time and compensates the resulting error by slightly adjusting the columns that are not yet quantized. Even a 175B-parameter model can be quantized on a single GPU in about 4 hours.
Knowledge DistillationKnowledge distillation transfers knowledge from a large trained model (the teacher) to a small model (the student) by training the student to match the probability distribution the teacher produces with a temperature-scaled softmax.
LLM.int8()LLM.int8() is a method that computes the linear layers of large language models with 8-bit integers. By computing only the dimensions where a few large values (outliers) concentrate in 16 bits and the remaining 99.9%+ in 8 bits, it roughly halves memory without losing accuracy, even for 175B-parameter models.
LoRALoRA is a fine-tuning method that freezes the pretrained weights and trains only the product of two thin matrices (a low-rank matrix) added to each layer. On GPT-3 175B, it reduces the number of trainable parameters by about 10,000 times while keeping accuracy on par with training all weights, and it does not slow down inference.
Lottery Ticket HypothesisThe Lottery Ticket Hypothesis states that a large, randomly initialized network contains a small subnetwork (a winning ticket) that, when trained in isolation from its original initial values, reaches the same accuracy as the original network just as quickly. By using pruning to decide which weights to remove and resetting the remaining weights to their initial values, winning tickets 10–20% of the original size or smaller were found.
Low-Rank FactorizationLow-rank factorization is a model compression method that approximates trained weight matrices or tensors with products of thin matrices and similar forms, replacing one layer with a stack of lighter layers. Reported results include reducing the parameters of fully connected layers by 5–13 times and speeding up convolutional layers by more than 2 times.
Network SlimmingNetwork Slimming is a structured pruning method that trains with an L1 penalty on the Batch Normalization coefficient γ and removes channels whose γ is close to 0. Because it thins the layers directly, it reduced the parameters of VGGNet on CIFAR-10 by about 90% and its computation by about half without increasing the error rate.
Once-for-AllOnce-for-All trains a single network whose depth, width, kernel size, and resolution can all vary, training it just once while progressively extending from the largest configuration to smaller ones, and then extracts a subnetwork suited to each device without retraining. It cuts the per-device design cost from O(N) to O(1) and reaches 80.0% ImageNet accuracy under mobile settings.
PruningPruning is a method that removes low-importance weights or channels from a trained neural network to make the model smaller and lighter. With a little retraining after removal, many models can keep nearly the same accuracy even when their parameters are cut to a fraction, often down to about one tenth.
QLoRAQLoRA is a fine-tuning method that quantizes the weights of a large language model to 4 bits (NF4) and freezes them, then trains only small LoRA matrices added on top. It can fine-tune a 65B-parameter model on a single 48GB GPU with the same accuracy as 16-bit training.
QuantizationQuantization replaces the weights and activations of a neural network, normally 32-bit or 16-bit floating point, with integers such as 8 or 4 bits to reduce memory and computation. At 8 bits, many models can cut memory to 1/4 with almost no loss of accuracy.
SmoothQuantSmoothQuant is a method for converting both the weights and the activations of a large language model to 8-bit integers (W8A8). It flattens hard-to-quantize activation outliers by migrating them to the weights through a mathematically equivalent transformation, speeding up inference while preserving accuracy without retraining.
Speculative DecodingSpeculative decoding speeds up generation without changing the output distribution by having a small approximation model draft several tokens ahead and then verifying them all at once with a single pass of the large target model. The speedup is determined by the acceptance rate and the number of drafted tokens; T5-XXL ran 2 to 3 times faster.
TinyBERTTinyBERT compresses BERT with knowledge distillation by matching the teacher not only at the output but also at the embedding layer, the attention matrices, the hidden states of each layer, and the predictions, distilling in two stages: pre-training and task-specific learning. The 4-layer TinyBERT₄ is 7.5x smaller and 9.4x faster than BERT-base while retaining more than 96.8% of the teacher's performance on GLUE.
XNOR-NetXNOR-Net binarizes both the weights and the inputs of a convolutional neural network to +1 and −1, rescales them by the mean absolute value, and thereby approximates convolutions with XNOR and bit counting. The weight-only binarized version keeps the same accuracy as real-valued weights for AlexNet on ImageNet while reducing weight memory to about 1/32.
