NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

BiViT: Extremely Compressed Binary Vision Transformers

Yefei He, Zhenyu Lou, Luoming Zhang, Jing Liu, Weijia Wu, Hong Zhou, Bohan Zhuang

Introduction

Vision Transformers (ViTs) have set new benchmarks in computer vision, yet their deployment on edge devices is hindered by massive parameter counts and high computational demands. While Binary Neural Networks (BNNs) offer a solution by compressing weights and activations to a single bit, they have historically struggled with Transformer architectures. BiViT addresses this by introducing the first framework to successfully push ViTs into the 1-bit binarization realm, achieving up to 32× compression and significant speedups.

Addressing the Binarization Gap

The failure of standard binarization in ViTs stems from two main issues:

  1. The Softmax Mismatch: Standard binarization assumes balanced value distributions. However, Softmax attention scores are "long-tailed," where a few values are high and most are near zero. Forcing a 50/50 split destroys the attention mechanism.
  2. Optimization Difficulty: Binary ViTs are extremely sensitive to information loss compared to CNNs, making them harder to train from scratch.

Proposed Methods

Softmax-aware Binarization (SAB)

To resolve the softmax mismatch, BiViT employs Softmax-aware Binarization. Instead of a fixed threshold, SAB dynamically calculates an optimal threshold for each attention vector to minimize quantization error. This approach preserves the sparse nature of attention maps, which is critical for maintaining model performance.

Comparison of the proposed Softmax-aware Binarization scheme against previous softmax-agnostic methods.

Cross-layer Binarization (CLB) and Parameterized Scales

BiViT uses a two-stage training scheme called Cross-layer Binarization to stabilize optimization, first binarizing self-attention modules and then MLPs. Additionally, Parameterized Weight Scales (PWS) introduce learnable, channel-wise scaling factors, allowing the model to prioritize important channels with minimal overhead.

Key Insights

The Necessity of Pretraining

A critical finding is that binary ViTs depend heavily on pretraining. Initializing from a pretrained Swin-T model resulted in a 16.4% accuracy boost over random initialization, a much larger margin than typically seen in CNNs. This highlights that binary ViTs are more sensitive to initialization than their convolutional counterparts.

Impact of pretraining on the accuracy of binarized Swin-T and Nest-T architectures.

Sparsity and MLP Efficiency

The authors realized that binary attention should be sparse to reflect Softmax behavior. Furthermore, while weights are binarized, keeping MLP activations in full precision offers a superior accuracy-efficiency trade-off, as MLPs handle the bulk of parameters and computation.

Performance Evaluation

BiViT demonstrates state-of-the-art performance across multiple benchmarks:

  • TinyImageNet: Outperformed previous methods by nearly 20% (52.21% vs 32.39% for NesT-T).
  • ImageNet: Achieved a competitive 75.6% Top-1 accuracy with a binarized Swin-S.
  • Efficiency: Measured a 4.39× reduction in matrix multiplication latency on an RTX 3090.
  • Downstream Tasks: Proved robust for object detection, reaching 40.8 mAP on COCO using a Cascade Mask R-CNN framework.

Conclusion

BiViT marks a significant milestone in Transformer compression. While a performance gap remains compared to full-precision models, the framework provides a viable path for deploying powerful ViTs on resource-constrained hardware. Future improvements will likely involve low-level kernel optimizations to fully realize the theoretical 32× speedup of bit-wise operations.

Summary updated

BibTeX
@inproceedings{he2023bivit,
  author = {Yefei He and Zhenyu Lou and Luoming Zhang and Jing Liu and Weijia Wu and Hong Zhou and Bohan Zhuang},
  title = {{BiViT: Extremely Compressed Binary Vision Transformers}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  doi = {10.1109/iccv51070.2023.00520},
}
Figure