N Neurarch Try it See it Changes Bot Pricing API Open app

Comparisons / ViT-B/16 vs Swin-Tiny

ViT-B/16 vs Swin-Tiny

A flat vision transformer against a hierarchical one.

Swin-Tiny has 20M more parameters than ViT-B/16: 74 layers added, 2 removed, 4 changed.

Baseline

ViT-B/16

Layers
11
Parameters
8.4M
Input
3 × 224 × 224
Output
196 × 1000
Forward-passes
yes
Est. train cost
$0.105
Compared

Swin-Tiny

Layers
83
Parameters
28M
Input
3 × 224 × 224
Output
1000
Forward-passes
yes
Est. train cost
$0.288

The deltas

Every number is Swin-Tiny relative to ViT-B/16.

Parameters
+20M (+234%)
Layers
+72
Added
74
Removed
2
Changed
4
Unchanged
7

Which GPUs each one fits

Memory for the graph at the input shape both declare. A highlighted row is a card one of them fits and the other does not, which is the difference that decides a purchase.

GPUViT-B/16Swin-Tiny
T4 16GBfitsfits
A100 40GBfitsfits
H100 80GBfitsfits

Layer by layer

Aligned in topological order. 7 of 87 rows are the same layer with the same parameters.

Show all 87 rows
ViT-B/16Swin-Tiny
LayerParamsOutputLayerParamsOutput
1sameimage
Input
3 × 224 × 224image
Input
3 × 224 × 224
2changed
patchSize, embedDim
patch_embed
Patch Embed
591K196 × 768patch_embed_4x4
Patch Embed
4.7K3136 × 96
3removedpos_embed
Positional Encoding
196 × 768—
4removeddropout
Dropout
196 × 768—
5added—s1b1_norm1
Layer Norm
1923136 × 96
6added—s1b1_window_attn
Multi Head Attention
37K3136 × 96
7added—s1b1_res1
Add
3136 × 96
8added—s1b1_norm2
Layer Norm
1923136 × 96
9added—s1b1_mlp
Feed Forward
74K3136 × 96
10added—s1b1_res2
Add
3136 × 96
11added—s1b2_norm1
Layer Norm
1923136 × 96
12added—s1b2_shifted_window_attn
Multi Head Attention
37K3136 × 96
13added—s1b2_res1
Add
3136 × 96
14added—s1b2_norm2
Layer Norm
1923136 × 96
15added—s1b2_mlp
Feed Forward
74K3136 × 96
16added—s1b2_res2
Add
3136 × 96
17added—merge_patches_n15
Reshape
784 × 384
18added—patch_merging_2
Linear
74K784 × 192
19added—s2b1_norm1
Layer Norm
384784 × 192
20added—s2b1_window_attn
Multi Head Attention
148K784 × 192
21added—s2b1_res1
Add
784 × 192
22added—s2b1_norm2
Layer Norm
384784 × 192
23added—s2b1_mlp
Feed Forward
296K784 × 192
24added—s2b1_res2
Add
784 × 192
25added—s2b2_norm1
Layer Norm
384784 × 192
26added—s2b2_shifted_window_attn
Multi Head Attention
148K784 × 192
27added—s2b2_res1
Add
784 × 192
28added—s2b2_norm2
Layer Norm
384784 × 192
29added—s2b2_mlp
Feed Forward
296K784 × 192
30added—s2b2_res2
Add
784 × 192
31added—merge_patches_n28
Reshape
196 × 768
32added—patch_merging_3
Linear
295K196 × 384
33added—s3b1_norm1
Layer Norm
768196 × 384
34added—s3b1_window_attn
Multi Head Attention
591K196 × 384
35added—s3b1_res1
Add
196 × 384
36added—s3b1_norm2
Layer Norm
768196 × 384
37added—s3b1_mlp
Feed Forward
1.2M196 × 384
38added—s3b1_res2
Add
196 × 384
39added—s3b2_norm1
Layer Norm
768196 × 384
40added—s3b2_shifted_window_attn
Multi Head Attention
591K196 × 384
41added—s3b2_res1
Add
196 × 384
42added—s3b2_norm2
Layer Norm
768196 × 384
43added—s3b2_mlp
Feed Forward
1.2M196 × 384
44added—s3b2_res2
Add
196 × 384
45added—s3b3_norm1
Layer Norm
768196 × 384
46added—s3b3_window_attn
Multi Head Attention
591K196 × 384
47added—s3b3_res1
Add
196 × 384
48added—s3b3_norm2
Layer Norm
768196 × 384
49added—s3b3_mlp
Feed Forward
1.2M196 × 384
50added—s3b3_res2
Add
196 × 384
51added—s3b4_norm1
Layer Norm
768196 × 384
52added—s3b4_shifted_window_attn
Multi Head Attention
591K196 × 384
53added—s3b4_res1
Add
196 × 384
54added—s3b4_norm2
Layer Norm
768196 × 384
55added—s3b4_mlp
Feed Forward
1.2M196 × 384
56added—s3b4_res2
Add
196 × 384
57added—s3b5_norm1
Layer Norm
768196 × 384
58added—s3b5_window_attn
Multi Head Attention
591K196 × 384
59added—s3b5_res1
Add
196 × 384
60added—s3b5_norm2
Layer Norm
768196 × 384
61added—s3b5_mlp
Feed Forward
1.2M196 × 384
62added—s3b5_res2
Add
196 × 384
63added—s3b6_norm1
Layer Norm
768196 × 384
64added—s3b6_shifted_window_attn
Multi Head Attention
591K196 × 384
65added—s3b6_res1
Add
196 × 384
66added—s3b6_norm2
Layer Norm
768196 × 384
67added—s3b6_mlp
Feed Forward
1.2M196 × 384
68added—s3b6_res2
Add
196 × 384
69added—merge_patches_n65
Reshape
49 × 1536
70added—patch_merging_4
Linear
1.2M49 × 768
71added—s4b1_norm1
Layer Norm
1.5K49 × 768
72added—s4b1_window_attn
Multi Head Attention
2.4M49 × 768
73added—s4b1_res1
Add
49 × 768
74added—s4b1_norm2
Layer Norm
1.5K49 × 768
75added—s4b1_mlp
Feed Forward
4.7M49 × 768
76added—s4b1_res2
Add
49 × 768
77samenorm_1
Layer Norm
1.5K196 × 768s4b2_norm1
Layer Norm
1.5K49 × 768
78changed
numHeads
attn
Multi Head Attention
2.4M196 × 768s4b2_shifted_window_attn
Multi Head Attention
2.4M49 × 768
79sameresidual_1
Add
196 × 768s4b2_res1
Add
49 × 768
80samenorm_2
Layer Norm
1.5K196 × 768s4b2_norm2
Layer Norm
1.5K49 × 768
81changed
hiddenDim, embedDim
mlp
Feed Forward
4.7M196 × 768s4b2_mlp
Feed Forward
4.7M49 × 768
82sameresidual_2
Add
196 × 768s4b2_res2
Add
49 × 768
83samenorm_final
Layer Norm
1.5K196 × 768final_norm
Layer Norm
1.5K49 × 768
84added—to_channels
Permute
768 × 49
85added—avgpool
Global Avg Pool1d
768
86changed
inFeatures
head
Linear
196 × 1000classifier
Linear
769K1000
87sameclass_logits
Output
196 × 1000class_logits
Output
1000

What this is not

Take it further

Open either graph in the editor, change it, and check it again: ViT-B/16 · Swin-Tiny

Compare any two models of your own, including anything on Hugging Face: the comparison tool.

Machine-readable: this page as markdown · the pair index · POST https://www.neurarch.com/api/v1/plan for a graph of your own.

Related comparisons

ResNet Block vs ViT-B/16
Convolution against attention for images.
BERT Base vs ViT-B/16
The same transformer applied to text and to images.
ViT-B/16 vs DiT-XL/2
A vision transformer against a diffusion transformer.