Efficient ConvNets: Depthwise Separability, Mobile Architectures, and Re-parameterization
Where convnets still win
Most deployed convnets run on phones, cameras, cars, and embedded boards: budgets in milliseconds and milliwatts. Three ideas organize the efficient regime:
0.54M trainable parameters; a dense twin at the same widths would need about 4.7M, the 8.8\times gap the cost ratio predicts:
model = MiniMobileNet()X = d2l.normal((1, 96, 96, 1), 0, 1)assert model.net(X).shape == (1, 10)sum(int(tf.size(w)) for w in model.net.trainable_weights)
542474
Matched parameter budget
Same parameter budget, same head, 10 epochs of Fashion-MNIST at 96×96; the dense net must stop at 128 channels where the separable one reaches 512:
for name, (acc, seconds) in runs.items(): params =sum(p.numel() for p in models[name].parameters())print(f'{name}: {params:,} params, 'f'val acc {acc:.3f}, {seconds:.1f} s/epoch')
mini-MobileNet: 542,474 params, val acc 0.913
VGG-style: 583,594 params, val acc 0.922
Accuracy is comparable across frameworks and seeds; the ordering of the two models is noise. Mini-MobileNet uses 7.7\times fewer multiply-adds (50M vs. 385M), but its epochs are only about 2–3\times faster: FLOPs are not latency (depthwise convolutions are memory-bound).
The inverted bottleneck
ResNet bottlenecks compress around the expensive dense 3×3. Once the 3×3 is depthwise, wide is cheap and MobileNetV2 inverts the block:
thin residual stream, 1 \times 1 expansion (6×),
depthwise 3×3 in the wide space,
linear1 \times 1 projection back (no ReLU: it would destroy information in the thin space).
The tensors alive across blocks are the thin ones, so activation memory stays small. ConvNeXt reused this exact shape with a 7×7 depthwise convolution.
Scaling and searching
EfficientNet: scale depth, width, resolution together (\alpha^\phi, \beta^\phi, \gamma^\phi, one budget knob \phi); base block found by architecture search.
EfficientNetV2: search rewards training speed; drops depthwise blocks from early high-resolution stages (memory-bound there) and grows image size during training.
MobileNetV4: one universal inverted bottleneck covering four block variants; searched to be near Pareto-optimal across phone CPUs, DSPs, GPUs, and NPUs.
The block is human insight; the allocation is an optimization problem against measured latency.
RepVGG: train branches, ship a stack
Multi-branch nets train better (ResNet’s lesson); plain 3×3 stacks run faster (one big kernel per layer, one live tensor). RepVGG gets both: train with branches, then fuse them exactly.
Train-time: 3×3 + 1×1 + identity, each with BN. Inference: one 3×3 convolution, same function.
The train-time block
class RepVGGBlock(tf.keras.Model):"""Train-time block: 3x3, 1x1, and identity branches, each with BN."""def__init__(self, num_channels):super().__init__()self.conv3 = tf.keras.layers.Conv2D(num_channels, 3, padding='same', use_bias=False)self.conv1 = tf.keras.layers.Conv2D(num_channels, 1, use_bias=False)self.bn3 = tf.keras.layers.BatchNormalization(epsilon=1e-5)self.bn1 = tf.keras.layers.BatchNormalization(epsilon=1e-5)self.bn0 = tf.keras.layers.BatchNormalization(epsilon=1e-5)def call(self, X, training=False):return tf.keras.activations.relu(self.bn3(self.conv3(X), training=training)+self.bn1(self.conv1(X), training=training)+self.bn0(X, training=training))
Maximum difference: order 10^{-6}, i.e. single-precision roundoff. Same function, one kernel, no BN at inference.
Deployment has the last word
“Mathematically identical” holds in FP32. The fused kernel sums branches of very different scales, so its weight and activation distributions are wide, and naive INT8 quantization collapses: 75.1% → 40.2% top-1 for a fused RepVGG. Quantization-aware re-parameterization fixes it.
The idea industrialized anyway: MobileOne (sub-millisecond phone backbones) and FastViT (re-param conv stages + attention) both ship on consumer devices.
Recap: convnets at the edge, 2026
Depthwise separability: \sim k^2 cheaper convolutions, small accuracy cost.
Inverted bottleneck: expensive tensors are the transient ones.
Compound scaling / search: allocate budget by optimization.
Re-parameterization: the trained net and the shipped net differ, connected by exact weight algebra.
Cheapest tier: plain depthwise convnets. Flagship phones: conv-attention hybrids. Pure ViT: only with a dedicated NPU.
FLOPs are a proxy; hardware keeps score in memory traffic.