Papers › BHViT: Binarized Hybrid Vision Transformer

BHViT: Binarized Hybrid Vision Transformer

4 Mar 2025CVPR 2025 1arXiv:2503.02394archive 2025-07-28

Tian Gao, Zhiyuan Zhang, Yu Zhang, Huajun Liu, Kaijie Yin, Chengzhong Xu, Hui Kong

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 binarization-friendly 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 Multilayer 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.

PaperPDFConference PDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 29 code samples harvested from 1 repository linked to this paper: 16 ran (of which 13 constructed an object rather than computing a result; 15 with no instrument failure: 0 honoured, 0 violated, 15 with no contract checked; 1 where Syntology's instrument failed) · 13 unverified. Where Syntology's instrument failed: 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 29 samples from 1 repository, 16 ran (15 with no instrument failure; 1 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

IMRL/BHViT officialmentioned on GitHubpytorchSyntology: 29 samples, 16 ran (1 instrument-failed) · 13 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

29 samples harvested: 16 ran (of which 13 constructed an object rather than computing a result; 15 with no instrument failure: 0 honoured, 0 violated, 15 with no contract checked; 1 where Syntology's instrument failed) · 13 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran; the contract check could not run
15ran
13unverified

Licence: 0 of the 29 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from IMRL/BHViT. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 6 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

IMRL/BHViT official repository 29 samples, 16 ran (1 instrument-failed) · 13 unverified
BHViTEmbeddings transformer/BHViT.py ran · metamorphic tier: deterministic MIT (permissive) · 7e1832d29c4089e3 · report fixture: returned BHViTEmbeddings · level recorded 2026-09-22
BHViTPatchEmbeddings transformer/BHViT.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · a1f47c9b7b8a2b6a · report fixture: returned BHViTPatchEmbeddings · level recorded 2026-09-22
BinaryActivation_Attention transformer/BHViT.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · e1be08d992cdbec6 · report fixture: returned BinaryActivation_Attention · level recorded 2026-09-22
BinaryQuantizer transformer/BHViT.py ran MIT (permissive) · 7864a7f2d635f1cc · report fixture: returned BinaryQuantizer · level recorded 2026-09-22
GSB_Attention transformer/BHViT.py ran MIT (permissive) · bc00cba6dd4fd931 · report fixture: returned GSB_Attention · level recorded 2026-09-22
LayerScale in 15 papers transformer/BHViT.py ran · metamorphic tier: deterministic MIT (permissive) · 5a33cb0660a4f8f5 · report fixture: returned LayerScale · level recorded 2026-09-22
LearnableBiasnn transformer/BHViT.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 80ac18a2d3335ec2 · report fixture: returned LearnableBiasnn · level recorded 2026-09-22
PatchEmbed in 123 papers
census: 9 implementations from 9 papers, 6 distinct outputs on one shared input
transformer/BHViT.py ran · metamorphic tier: deterministic MIT (permissive) · f74b4e57f68230ce · report fixture: returned PatchEmbed · level recorded 2026-09-22
RPReLU transformer/BHViT.py ran · metamorphic tier: deterministic MIT (permissive) · 5053a360d7323930 · report fixture: returned RPReLU · level recorded 2026-09-22
Shift transformer/BHViT.py ran fingerprinted MIT (permissive) · 8a8583dbbaae1dd0 · report fixture: signature x:Tensor/4/float, dim:int/0/int · returned Tensor · level recorded 2026-09-24
Shift2 transformer/BHViT.py ran fingerprinted MIT (permissive) · 2383072bc4ad455a · report fixture: signature x:Tensor/4/float, dim:int/0/int · returned Tensor · level recorded 2026-09-24
Shift_channel_mix transformer/BHViT.py ran fingerprinted MIT (permissive) · 818b750a4ca6f3f2 · report fixture: returned Shift_channel_mix · level recorded 2026-09-22
SymQuantizer transformer/BHViT.py ran MIT (permissive) · a22c340e89f0aa29 · report fixture: returned SymQuantizer · level recorded 2026-09-22
Token_for_Attention transformer/BHViT.py ran · metamorphic tier: deterministic MIT (permissive) · 7da1d198566520b7 · report fixture: returned Token_for_Attention · level recorded 2026-09-22
TwnQuantizer transformer/BHViT.py ran MIT (permissive) · f04ba986abc61036 · report fixture: returned TwnQuantizer · level recorded 2026-09-22
windows_split transformer/BHViT.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted MIT (permissive) · 00e8fb5b0d52f96f · report fixture: signature x:Tensor/4/float, window_size:int/0/int · returned Tensor · level recorded 2026-09-22
BHViTAttention transformer/BHViT.py unverified MIT (permissive) · 80e2ed60aa621a51 · report
BHViTEncoder transformer/BHViT.py unverified MIT (permissive) · 6937c2e66bd08ef0 · report
BHViTLayer transformer/BHViT.py unverified MIT (permissive) · 39ca817be9205f9e · report
BHViTModel transformer/BHViT.py unverified MIT (permissive) · 061e33af6401f92a · report
BHViTSelfAttention transformer/BHViT.py unverified MIT (permissive) · 8856810408ef8784 · report
BHViTSelfOutput transformer/BHViT.py unverified MIT (permissive) · 58380fdab4ebd58e · report
BinaryPatchEmbed transformer/BHViT.py unverified MIT (permissive) · 50f22547e2f27990 · report
GCLayer transformer/BHViT.py unverified MIT (permissive) · 505e71bceab8cb1a · report
QuantizeConv2d transformer/BHViT.py unverified MIT (permissive) · 0af4680021d038d8 · report
QuantizeLinear in 5 papers transformer/BHViT.py unverified MIT (permissive) · 0cefbcad32882f70 · report
ViTIntermediate transformer/BHViT.py unverified MIT (permissive) · e071c97816d8e232 · report
ViTOutput transformer/BHViT.py unverified MIT (permissive) · b0f024c430a3ab21 · report
token_mixer transformer/BHViT.py unverified MIT (permissive) · f4252cbcf11d1708 · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for BHViT (graph method: BHViT). 29 bricks; individually on a fixture: 16 ran (of which 13 constructed an object rather than computing a result; 15 with no instrument failure: 0 honoured, 0 violated, 15 with no contract checked; 1 where Syntology's instrument failed) · 13 unverified. The assembly has not been run end-to-end.

  1. BHViTModel entry · level 0 · unverified · 061e33af6401f92a
  2. BHViTEmbeddings model · level 1 · ran · 7e1832d29c4089e3
  3. BHViTEncoder helper · level 0 · unverified · 6937c2e66bd08ef0
  4. BHViTPatchEmbeddings helper · level 1 · ran · a1f47c9b7b8a2b6a
  5. BHViTLayer model · level 0 · unverified · 39ca817be9205f9e
  6. BinaryPatchEmbed helper · level 0 · unverified · 50f22547e2f27990
  7. GCLayer model · level 0 · unverified · 505e71bceab8cb1a
  8. PatchEmbed helper · level 1 · ran · f74b4e57f68230ce
  9. BHViTAttention helper · level 0 · unverified · 80e2ed60aa621a51
  10. LayerScale helper · level 1 · ran · 5a33cb0660a4f8f5
  11. Shift helper · level 1 · ran · 8a8583dbbaae1dd0
  12. Shift2 helper · level 1 · ran · 2383072bc4ad455a
  13. Shift_channel_mix helper · level 1 · ran · 818b750a4ca6f3f2
  14. ViTIntermediate helper · level 0 · unverified · e071c97816d8e232
  15. ViTOutput helper · level 0 · unverified · b0f024c430a3ab21
  16. QuantizeConv2d model · level 0 · unverified · 0af4680021d038d8
  17. RPReLU helper · level 1 · ran · 5053a360d7323930
  18. token_mixer helper · level 0 · unverified · f4252cbcf11d1708
  19. BHViTSelfAttention model · level 0 · unverified · 8856810408ef8784
  20. BHViTSelfOutput model · level 0 · unverified · 58380fdab4ebd58e
  21. QuantizeLinear model · level 0 · unverified · 0cefbcad32882f70
  22. BinaryQuantizer helper · level 1 · ran · 7864a7f2d635f1cc
  23. SymQuantizer helper · level 1 · ran · a22c340e89f0aa29
  24. TwnQuantizer helper · level 1 · ran · f04ba986abc61036
  25. LearnableBiasnn helper · level 1 · ran · 80ac18a2d3335ec2
  26. BinaryActivation_Attention helper · level 1 · ran · e1be08d992cdbec6
  27. GSB_Attention helper · level 1 · ran · bc00cba6dd4fd931
  28. Token_for_Attention helper · level 1 · ran · 7da1d198566520b7
  29. windows_split helper · level 1 · ran; the contract check could not run (RAISES) · 00e8fb5b0d52f96f

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2503.02394") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

BinarizationQuantization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections