PB-LLM: Partially Binarized Large Language Models

Yuzhang Shang, Zhihang Yuan, Qiang Wu, Zhen Dong

TL;DR

Network binarization (compressing weights to just 1-bit) typically causes large language models (LLMs) to completely collapse. This paper introduces PB-LLM (Partially-Binarized LLM), a novel strategy that achieves extreme low-bit compression by keeping a small fraction of "salient weights" in higher precision while binarizing the rest to 1-bit. This approach successfully preserves the linguistic reasoning capabilities of LLMs at ultra-low bitwidths under both post-training and training-aware settings.

What Problem Does This Paper Address?

Large Language Models (LLMs) have achieved remarkable success, but their massive size presents a massive deployment hurdle. For example, a LLaMA-65B model requires at least 130GB of memory just for inference, far exceeding the capacity of consumer-grade GPUs.

While weight quantization is a popular remedy, state-of-the-art methods suffer a severe drop in quality when pushing below 4 bits. Pushing all the way to 1-bit (network binarization) would drastically reduce storage and accelerate inference via efficient bitwise operations. However, the authors show that naively applying existing binarization algorithms to LLMs causes catastrophic performance failure, rendering the models worse than random guessing. This paper addresses the challenge of making ultra-low-bit binarization viable for LLMs without destroying their reasoning capabilities.

Methods

The core innovation of PB-LLM is partial binarization. The authors discover that a tiny fraction of weights dictate the model's stability. Instead of binarizing the entire matrix, PB-LLM filters out these "salient weights" and stores them in higher precision (e.g., 8-bit), while the remaining "un-salient" weights are compressed to 1-bit.

The authors explore this methodology across two distinct paradigms:

  1. Post-Training Quantization (PB-GPTQ): Extending the concepts of GPTQ, this method iteratively binarizes un-salient weights and quantizes salient weights column-by-column. It uses Hessian-matrix guidance to calculate error compensation, updating the remaining unquantized weights to minimize overall layer-wise error.
  2. Quantization-Aware Training (PB-LLM QAT): During fine-tuning, the identified salient weights are frozen to stabilize optimization. Crucially, instead of using expensive empirical searches for weight scaling factors, the authors mathematically derive an optimal scaling factor ($\alpha = ||w_F||_1 / n_{w_F}$) for the residual binarized weights based on L2 error minimization.
Figure 1: (a) We introduce Partially-Binarized Large Language Model (PB-LLM), where a small subset of the weights of the LLM are frozen and preserved with higher bit precision, while the remaining weights are binarized utilizing an optimal scaling factor strategy; (b) By using PB-LLM, an extremely low-bit LLM can be acquired efficiently (i.e., quantization-aware training converges quickly) while maintaining its language reasoning capabilities.

Datasets

  • Training/Fine-tuning (QAT): RedPajama-simple-1B (a transparent, open-source 0.1% subset of the RedPajama-1T dataset).
  • Evaluation:
  • Language modeling perplexity was evaluated on WikiText2, C4, and PTB.
  • Common-sense reasoning capabilities were tested across seven zero-shot benchmarks: BoolQ, PIQA, HellaSwag, WinoGrande, ARC-Easy, ARC-Challenge, and OBQA.

Key Insights and Ideas

  • Standard Binarization is Fatal for LLMs: Traditional binarization methods (like BNN, XNOR-Net, or Bi-Real Net) fail completely on LLMs, yielding performance that is worse than random chance.
Figure 2: We implement five renowned bi- narization methods on LLMs and assess the resultant binarized LLMs across seven zero- shot common sense reasoning tasks. Ran- dom represents the hypothetical worst base- line, indicating random guesses, while FP stands as the optimal baseline, representing full-precision OPT-1.3B. The exact values corresponding to this radar graph are detailed in the Appendix.
  • Salient Weights are Scattered Outliers: Visualizing the distribution of salient weights reveals that they are randomly and uniformly scattered across the weight matrix rather than clustered in specific columns. This necessitates an element-wise rather than a column-wise selection strategy.
Figure 3: Distribution of 5% salient weight.
  • Freezing Outliers Accelerates QAT: Freezing the high-precision salient weights during QAT drastically reduces optimization difficulty. PB-LLM QAT converges in just 1K–10K iterations, compared to the 100K iterations typically required by standard LLM QAT methods.
Figure 5: Training Loss Curves: When only 2% of weights are re- tained in their un-binarized state, the training loss converges more swiftly.
  • Analytical Scaling Beats Empirical Search: For 1-bit weights, the optimal scaling factor can be derived analytically using the L1-norm divided by the number of elements, bypassing the need for computationally expensive search steps.

Key Results

  • LLaMA-7B Benchmarks: Under a 4-bit equivalent storage setting (achieved by retaining 30% salient weights in 8-bit and binarizing the rest), PB-LLM scored an average zero-shot accuracy of 66.9% across the seven common-sense tasks. This virtually matched the full-precision baseline (68.7%) and outperformed standard 4-bit Round-To-Nearest (RTN) quantization (65.2%).
  • Extreme Compression: Even when dropping the ratio of salient weights to 10% (pushing the effective bitwidth significantly lower), PB-LLM maintained a respectable 60.6% average accuracy, whereas standard binarization methods collapsed entirely.
  • PTQ Performance: The post-training variant, PB-GPTQ, achieved a perplexity of 8.14 on the C4 dataset when using 50% salient weights, demonstrating a massive improvement over standard RTN methods.

Limitations and Future Work

  • Index Storage Overhead: Storing element-wise mixed-precision matrices requires saving the coordinates/indices of the high-precision weights. While the authors note that this can be handled via sparse matrix storage methods like Compressed Sparse Row (CSR) or bitmaps, they do not deeply optimize the actual hardware storage layout or memory footprint of the index in this study.
  • Scale Constraints: Due to computational resource limitations, the methodology was primarily validated on smaller LLM scales, specifically OPT-1.3B and LLaMA-7B. Evaluating the framework on larger models (e.g., 70B+ parameters) remains an open direction.

Summary updated

BibTeX
@inproceedings{shang2024pb,
  author = {Yuzhang Shang and Zhihang Yuan and Qiang Wu and Zhen Dong},
  title = {{PB-LLM: Partially Binarized Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=BifeBRhikU},
}
Figure