Online Convolutional Reparameterization

Mu Hu, Junyi Feng, Jiashen Hua, Baisheng Lai, Jianqiang Huang, Xiaojin Gong, Xiansheng Hua

Abstract Structural re-parameterization has emerged as a powerful technique to enhance deep learning models by maintaining complex architectures during training while deploying simplified, efficient versions for inference. However, this approach typically incurs significant training-time overhead in terms of memory and computation. This paper introduces Online Convolutional Re-parameterization (OREPA), a method that mathematically "squeezes" complex multi-branch training blocks into a single convolution during the training phase. By replacing non-linear Batch Normalization layers with linear scaling layers, OREPA reduces training-time memory overhead by up to 70% and doubles training speed without sacrificing accuracy.

Introduction

The paradigm of "complex during training, simple during inference" has gained traction through models like RepVGG, which utilize structural re-parameterization. By using multi-branch architectures during training, these models learn richer feature representations. Post-training, these branches are mathematically collapsed into a single convolutional layer for high-speed deployment.

Despite its benefits, structural re-parameterization is computationally expensive to train. Standard Batch Normalization (BN) layers are non-linear, preventing the merging of branches until training is complete. Consequently, the GPU must store intermediate feature maps for every branch at every step, leading to high memory consumption and slow training. OREPA addresses this bottleneck by enabling "online" merging of these branches.

Comparison of different re-parameterization paradigms: (a) No Re-param, (b) Structural Re-param (offline), (c) Online Re-param (OREPA), and (d) Deployed model.

Methodology

OREPA transforms the "heavy" training process into a "light" one through a two-stage pipeline: Block Linearization and Block Squeezing.

  1. Block Linearization: The authors identified that the primary value of BN in multi-branch blocks is not the normalization itself, but the learnable scaling factors that diversify optimization across branches. OREPA replaces non-linear BN layers with Linear Scaling Layers. This change makes the entire multi-branch block a linear system, allowing for mathematical simplification during the forward and backward passes.
  2. Block Squeezing: Leveraging the associativity and distributivity of convolution, OREPA merges the multiple branch kernels into a single "squeezed" kernel online during training. Instead of performing multiple convolutions on feature maps (which is memory-intensive), the model performs a single convolution with the merged kernel. This shifts complexity from the high-memory feature map level to the low-memory kernel level.
The OREPA pipeline: (a) Prototype Block with non-linear layers, (b) Linearized Block where BN is replaced by scaling, and (c) Training Block after squeezing into a single OREPA Conv.

Key Insights

A critical finding of this work is that simple learnable scaling vectors provide sufficient "optimization diversity" to prevent branch collapse, effectively replacing the need for full BN within the internal re-parameterization branches. Gradient analysis confirms that as long as branches have independent scaling factors and distinct initial states, they will be optimized differently even when collapsed into a single kernel.

Furthermore, the efficiency gains from OREPA allow for the inclusion of more sophisticated components that were previously cost-prohibitive. The authors introduced "Frequency Prior Filters" and "Linear Deep Stems," which contribute to further accuracy improvements.

Experimental Results

OREPA was rigorously evaluated on ImageNet-1k for classification, MS-COCO for object detection, and Cityscapes for semantic segmentation.

  • Efficiency: OREPA reduces training-time GPU memory usage by 65% to 75%.
  • Speed: Training speed is accelerated by 1.5× to 2.3× compared to traditional structural re-parameterization methods like DBB.
  • Performance: On ImageNet, OREPA-equipped models achieved accuracy gains of up to +0.6% over baseline re-param models. It also showed consistent improvements in downstream tasks, enhancing mAP in object detection and mIoU in semantic segmentation.

Conclusion and Future Work

OREPA successfully mitigates the training overhead of structural re-parameterization, making it a more practical choice for large-scale model training. While it excels in residual-style (ResNet) architectures, applying it to residual-free (VGG-style) architectures requires keeping some branches separate to avoid slight performance drops, which marginally increases training costs. Future research will focus on extending the full benefits of online squeezing to residual-free architectures without performance trade-offs and further optimizing initialization strategies for linear scaling layers.

Summary updated

BibTeX
@inproceedings{hu2022online,
  author = {Mu Hu and Junyi Feng and Jiashen Hua and Baisheng Lai and Jianqiang Huang and Xiaojin Gong and Xiansheng Hua},
  title = {{Online Convolutional Reparameterization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.00065},
}
Figure