Although Deep Neural Networks have become foundational in many areas of Machine Learning, high computational demands limit their application in resource-constrained environments. To address this issue, depth compression methods have been proposed to identify and linearize redundant activation functions, thereby allowing for the merging of layers without intermediate non-linearities. However, these methods face two key challenges: they cannot be directly applied to convolutions with padding due to the absence of an analytical solution for merging these layers, and they typically increase the kernel size of merged layers, thus limiting speed-up gains. To overcome these limitations, we propose an efficient strategy that enables merging of layers without an existing analytical solution, and also without increasing kernel size. We validate our approach across multiple architectures and datasets, and measure inference speed-up gains on real embedded platforms. We publicly released the code at https://github.com/ShulzhenkoPetr/deep-to-shallow.
Figures & tables
Figure 1: Accuracy vs. speed-up for ResNet18 on ImageNet-1k. Unlike the Reference model, the proposed Shrunk model converts additional linearized activations into actual speed-up while preserving accuracy.
Figure 2: Illustration of the proposed method. Layers connected through linearized activations are merged and replaced by a single trainable layer. Only these layers are optimized during fine-tuning, while all others are kept frozen.
Method
Kernel size
Loss
Shrunk acc.
Analytical solution
5
–
91.61
Ours
5
LA ( 3 )
91.07
3
LA ( 3 )
90.61
3
LComb ( 4 )
91.28
Table 1: CIFAR-10 accuracy of ResNet18 Shrunk models with analytical and loss-based merging under different kernel sizes.
Model
Ref.
#
Shrunk
(Tref−Tshrunk)↑ (ms)
acc.
Merged
acc.
Raspi5
Jetson
2080Ti
ResNet18
63.10
3
64.20
+17.0
+1.8
+0.5
MobileNetv2
70.44
3
70.47
+2.0
+1.9
+0.6
ResNet50
74.93
2
75.08
+30.0
+2.3
+0.8
Swin-T
77.54
2
77.51
+28.0
+1.2
+0.3
Table 2: ImageNet accuracy and inference-time reduction of Reference and Shrunk models across architectures and devices.
Method
# Merged
Ref. acc.
Shrunk acc.
Smallest weights
2
92.20
92.27
Smallest gradients
2
92.35
92.40
TLC
2
92.63
92.67
EASIER
2
92.85
92.84
Table 3: CIFAR-10 accuracy of Reference and Shrunk ResNet18 models with different activation linearization methods.
Model
Kernel
Ref.
Shrunk
(Tref−Tshrunk)↑ (ms)
acc.
acc.
Raspi5
Jetson
2080Ti
ResNet18
5
92.68
92.69
-3.2
-1.5
-0.1
3
92.68
92.32
+10.4
+0.4
+0.9
DS3
92.68
91.79
+16.3
+2.5
+0.9
Table 4: CIFAR-10 test accuracy of ResNet18 Shrunk models with 7 linearized activations and 4 merged blocks, evaluated across different kernel sizes used in the merged convolutional layers.
Model (#)
Kernel
Raspi5
J. Nano
J. Orin
R18 (3)
3×3
×1.12
×1.12
×1.14
5×5
×1.01
×0.79
×1.14
R34 (6)
3×3
×1.14
×1.15
×1.17
5×5
×0.96
×0.74
×1.07
Table 5: ImageNet inference speed-up ( Tref/Tshrunk , batch 1) of ResNet Shrunk models, for the merged-layer kernel size 3×3 (ours) and the 5×5 kernel an analytical merge requires. The merged architecture is identical in both rows, isolating the effect of kernel growth.
Figure 3: Test accuracy and convergence time of ResNet18 Shrunk models under different training strategies.
Model
Reference
LA
LD
LCE
Shrunk
acc.
acc.
ResNet18
92.68
–
–
✓
90.26
–
✓
–
92.27
✓
–
–
10.00
✓
–
✓
90.39
✓
✓
–
92.32
Table 6: Ablation of loss components for ResNet18 Shrunk models on CIFAR-10 and Tiny ImageNet.
Scaling network depth has been a central driver behind the success of modern foundation models, yet recent investigations suggest that deep layers are often underutilized. This paper revisits the default mechanism for deepening neural networks, namely residual connections, from an optimization perspective. Rigorous analysis proves that the layout of residual connections can fundamentally shape convergence behavior, and even induces an exponential gap in convergence rates. Prompted by this insight, we introduce adaptive neural connection reassignment (ANCRe), a principled and lightweight framework that parameterizes and learns residual connectivities from the data. ANCRe adaptively reassigns residual connections with negligible computational and memory overhead (<1%), while enabling more effective utilization of network depth. Extensive numerical tests across pre-training of large language models, diffusion models, and deep ResNets demonstrate consistently accelerated convergence, boosted performance, and enhanced depth efficiency over conventional residual connections.
Yilang Zhang, Bingcong Li, Niao He +1
ML Research, Morgan Stanley, New York, NY 10019 · Department of CS, ETH Zürich, 8092 Zürich, Switzerland · Department of ECE, University of Minnesota, Minneapolis, MN 55455
This paper introduces Deep Microcompression (DMC), a hardware-aware pipeline for deep learning inference on bare-metal microcontrollers. DMC integrates structured pruning, quantization-aware training, and fixed-length bit-packing to achieve a 55.8× weight compression ratio on LeNet-5 (98.77% accuracy), generating a dependency-free C library with deterministic latency. On the RP2040 (Cortex-M0+), DMC reduces binary size by 3× versus TensorFlow Lite while matching its accuracy. Critically, DMC enables the first documented deployment of a standard CNN on the ATmega328P, a device constrained to 2KB SRAM, previously considered infeasible for CNN inference.
Opegbemi Matthias Busoye, Tolulope Matthew Busoye, Eghonghon-aye Eigbe
Deploying large convolutional neural networks (CNNs) on resource-constrained devices is challenging due to their high computational cost. While dynamic execution methods are promising, existing approaches for CNNs typically require specialized training or fine-tuning, limiting their effectiveness when applied to pre-trained models and requiring data access. To address this gap, we propose HASTE (Hashing for Tractable Efficiency), a plug-and-play convolution module that enables training-free, dynamic compression of large pre-trained CNNs. At inference time, HASTE uses locality-sensitive hashing to identify and merge redundant channels of latent feature maps on a patch-wise basis. This process simultaneously compresses the depth of both input features and their corresponding filters, resulting in computationally cheaper convolutions. We conduct extensive experiments on CIFAR-10 and ImageNet across a range of architectures, demonstrating a 46.2% FLOPs reduction in a ResNet34 on CIFAR-10 with only a 1.25% drop in accuracy, without any retraining. We support our claims by comprehensive ablation studies to validate our core design choices, an analysis of the method's properties and limitations, and a discussion that connects our channel merging scheme to the conceptually related task of token merging in Vision Transformers. Our results demonstrate that HASTE provides an effective solution for steerable compression of pre-trained CNNs at runtime, opening new possibilities for the deployment of efficient deep learning methods.
Lukas Meiner, Jens Mehnert, Alexandru Paul Condurache
Robert Bosch GmbH, Leonberg, Germany. · Universität zu Lübeck, Lübeck, Germany.