BiPFT: Binary Pre-trained Foundation Transformer with Low-Rank Estimation of Binarization Residual Polynomials

Xingrun Xing, Li Du, Xinyuan Wang, Xianlin Zeng, Yequan Wang, Zheng Zhang, Jiajun Zhang

TL;DR

BiPFT is the first 1-bit Binary Pre-trained Foundation Transformer, designed to bring the massive efficiency of binary neural networks (BNNs) to large-scale language modeling. By introducing a novel low-rank estimation method to correct binarization errors, it achieves a 56× reduction in operations and 28× memory savings while significantly outperforming previous task-specific binary models on the GLUE benchmark.

What Problem Does This Paper Address?

Large-scale foundation models like BERT have revolutionized Natural Language Understanding (NLU), but their massive computational and memory requirements make them nearly impossible to run on resource-constrained devices like smartphones.

While Binary Neural Networks (BNNs)—which represent weights and activations using only 1 bit (either -1 or +1)—offer a solution, they are notoriously difficult to train. Until now, binary Transformers were mostly "task-specific," meaning they were trained from scratch for a single task (like sentiment analysis) using complex distillation from a full-precision "teacher" model. These models are often unstable, highly sensitive to hyperparameters, and lack the general-purpose "knowledge" that makes foundation models so powerful.

Methods

The authors propose BiPFT, a framework that moves binary Transformers from task-specific training to the pre-training-then-finetuning paradigm.

1. The Pre-training Pipeline

Unlike previous methods that binarize a model after it has been trained in full precision, BiPFT is trained as a binary model from the start on massive datasets (BooksCorpus and Wikipedia). It uses standard objectives like Masked Language Modeling (MLM) and Next Sentence Prediction (NSP), supplemented by task-agnostic distillation to speed up convergence.

2. Estimating Binarization Residual Polynomials

The core technical innovation is how BiPFT handles Self-Attention. In a binary model, multiplying the Query (Q) and Key (K) matrices leads to significant "binarization error."

The authors mathematically decompose this error into binarization residual polynomials. To recover the lost information without sacrificing efficiency, they introduce low-rank estimators. Instead of calculating the full, expensive error term, they use a "rank-1" approximation that adds negligible computational overhead but allows the model to simulate full-precision attention much more accurately.

Datasets

  • Pre-training: The model was trained on BooksCorpus (800M words) and English Wikipedia (2500M words).
  • Evaluation: The authors used the GLUE (General Language Understanding Evaluation) benchmark, which includes eight diverse NLU tasks such as SST-2 (sentiment), MNLI (inference), and MRPC (paraphrase detection).

Key Insights and Ideas

  • Pre-training is the "Aha!" Moment: The authors found that pre-training a binary model on a massive corpus fundamentally changes its "learning capability." It makes the model far more robust to hyperparameter changes (like learning rate and batch size) compared to binary models trained only on small downstream datasets.
  • Data-Hungry Error Correction: The low-rank estimators used to fix binarization errors are "data-hungry." They don't work well when trained on small task-specific datasets, but they become highly effective when exposed to the vast amounts of data available during the pre-training phase.
  • Simplifying the Pipeline: By creating a binary foundation model, the authors eliminate the need for the complex, multi-stage distillation pipelines previously required to make binary BERTs work.

Key Results

  • Performance Leap: BiPFT-B surpassed the previous task-specific baseline by 15.4% on the GLUE benchmark.
  • Massive Efficiency: Compared to a standard full-precision BERT-base, BiPFT-B saves 56× operations and 28× memory for 1-bit activations.
  • Robustness: While previous binary models saw performance tank if the batch size or learning rate wasn't "just right," BiPFT maintained stable, high performance across a wide range of settings.
  • Closing the Gap: BiPFT narrows the performance gap between binary models and full-precision models (82.3% for FP-BERT vs. 70.8% for BiPFT-B) more effectively than any previous 1-bit approach.

Limitations and Future Work

  • NLU Focus: This work focuses on encoder-only models (BERT-like) for NLU tasks. The authors acknowledge that extending this to generative models (NLG) like GPT or LLaMA is a critical next step.
  • The Remaining Gap: While 70.8% is a huge step up for 1-bit models, there is still a ~12% performance gap compared to full-precision models.
  • Hardware Implementation: While the theoretical "operations" are reduced, the actual wall-clock speedup depends on specialized hardware kernels that can efficiently execute XNOR and popcount operations, which the paper does not implement directly.

Summary updated

BibTeX
@inproceedings{xing2024bipft,
  author = {Xingrun Xing and Li Du and Xinyuan Wang and Xianlin Zeng and Yequan Wang and Zheng Zhang and Jiajun Zhang},
  title = {{BiPFT: Binary Pre-trained Foundation Transformer with Low-Rank Estimation of Binarization Residual Polynomials}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i14.29542},
}
Figure