SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.02394 · CVPR · 2025

BHViT: Binarized Hybrid Vision Transformer

Chengzhong Xu, Tian Gao, Yu Zhang, Zhiyuan Zhang, Hui Kong, Huajun Liu, Kaijie Yin, 5hv1hw 'hl76pdoo

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 29 functions out of this paper's own repositories and ran 16 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
IMRL/BHViT — 16 of 29
FunctionStatusWhere it lives
BHViTEmbeddings Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("7e1832d29c4089e3")
BHViTPatchEmbeddings Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("a1f47c9b7b8a2b6a")
BinaryActivation_Attention Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("e1be08d992cdbec6")
BinaryQuantizer Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("7864a7f2d635f1cc")
GSB_Attention Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("bc00cba6dd4fd931")
LayerScale Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("5a33cb0660a4f8f5")
LearnableBiasnn Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("80ac18a2d3335ec2")
PatchEmbed Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("f74b4e57f68230ce")
RPReLU Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("5053a360d7323930")
Shift Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("8a8583dbbaae1dd0")
Shift2 Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("2383072bc4ad455a")
Shift_channel_mix Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("818b750a4ca6f3f2")
SymQuantizer Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("a22c340e89f0aa29")
Token_for_Attention Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("7da1d198566520b7")
TwnQuantizer Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("f04ba986abc61036")
windows_split Ran IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("00e8fb5b0d52f96f")
BHViTAttention Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("80e2ed60aa621a51")
BHViTEncoder Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("6937c2e66bd08ef0")
BHViTLayer Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("39ca817be9205f9e")
BHViTModel Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("061e33af6401f92a")
BHViTSelfAttention Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("8856810408ef8784")
BHViTSelfOutput Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("58380fdab4ebd58e")
BinaryPatchEmbed Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("50f22547e2f27990")
GCLayer Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("505e71bceab8cb1a")
QuantizeConv2d Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("0af4680021d038d8")
QuantizeLinear Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("0cefbcad32882f70")
ViTIntermediate Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("e071c97816d8e232")
ViTOutput Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("b0f024c430a3ab21")
token_mixer Not yet run IMRL/BHViT/transformer/BHViT.py
code served (permissive licence) · get_code("f4252cbcf11d1708")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Model binarization has made significant progress in enabling real-time and energy-efficient computation for convolutional neural networks (CNN), offering a potential solution to the deployment challenges faced by Vision Transformers (ViTs) on edge devices. However, due to the structural differences between CNN and Transformer architectures, simply applying binary CNN strategies to the ViT models will lead to a significant performance drop. To tackle this challenge, we propose BHViT, a binarizationfriendly hybrid ViT architecture and its full binarization model with the guidance of three important observations. Initially, BHViT utilizes the local information interaction and hierarchical feature aggregation technique from coarse to fine levels to address redundant computations stemming from excessive tokens. Then, a novel module based on shift operations is proposed to enhance the performance of the binary Multi-Layer Perceptron (MLP) module without significantly increasing computational overhead. In addition, an innovative attention matrix binarization method based on quantization decomposition is proposed to evaluate the token's importance in the binarized attention matrix. Finally, we propose a regularization loss to address the inadequate optimization caused by the incompatibility between the weight oscillation in the binary layers and the Adam Optimizer. Extensive experimental results demonstrate that our proposed algorithm achieves SOTA performance among binary ViT methods. The source code is released at: https://github.com/IMRL/BHViT.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2503.02394")
get_code_for_paper("2503.02394")
have("2503.02394")

Connect an agent — have() is free.