N Neurarch Architectures Models Checks Data Docs Open the app

Comparisons / ResNet Block vs ViT-B/16

ResNet Block vs ViT-B/16

Convolution against attention for images.

ViT-B/16 has 8.4M more parameters than ResNet Block: 8 layers added, 4 removed, 3 changed.

Baseline

ResNet Block

Layers
7
Parameters
74K
Input
64 × 32 × 32
Output
64 × 32 × 32
Forward-passes
yes
Est. train cost
$0.045
Compared

ViT-B/16

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

The deltas

Every number is ViT-B/16 relative to ResNet Block.

Parameters
+8.4M (114× the size)
Layers
+4
Added
8
Removed
4
Changed
3
Unchanged
2

Which GPUs each one fits

Each side is measured at its own declared input (64 × 32 × 32 against 3 × 224 × 224). Both columns are right about their own model; the difference between them is not a fact about the designs.

GPUResNet BlockViT-B/16
T4 16GBfitsfits
A100 40GBfitsfits
H100 80GBfitsfits

Layer by layer

Aligned in topological order. 2 of 17 rows are the same layer with the same parameters.

Hide all 17 rows
ResNet BlockViT-B/16
LayerParamsOutputLayerParamsOutput
1changed
shape
Input
Input
64 × 32 × 32image
Input
3 × 224 × 224
2removedConv2D_1
Conv2d
64064 × 32 × 32
3addedpatch_embed
Patch Embed
591K196 × 768
4addedpos_embed
Positional Encoding
196 × 768
5addeddropout
Dropout
196 × 768
6changed
type, normalizedShape
BatchNorm_1
Batch Norm
64 × 32 × 32norm_1
Layer Norm
1.5K196 × 768
7removedReLU_1
Relu
64 × 32 × 32
8removedConv2D_2
Conv2d
64064 × 32 × 32
9addedattn
Multi Head Attention
2.4M196 × 768
10addedresidual_1
Add
196 × 768
11changed
type, normalizedShape
BatchNorm_2
Batch Norm
64 × 32 × 32norm_2
Layer Norm
1.5K196 × 768
12addedmlp
Feed Forward
4.7M196 × 768
13sameAdd
Add
64 × 32 × 32residual_2
Add
196 × 768
14removedReLU_2
Relu
64 × 32 × 32
15addednorm_final
Layer Norm
1.5K196 × 768
16addedhead
Linear
196 × 1000
17sameOutput
Output
64 × 32 × 32class_logits
Output
196 × 1000

What this is not

Take it further

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

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 Simple CNN
What the residual connection costs and what it buys.
ViT-B/16 vs Swin-Tiny
A flat vision transformer against a hierarchical one.
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.