Introduction
Structural Reparameterization (SRP) has emerged as a powerful technique for enhancing neural network performance without increasing inference-time computational costs. By utilizing a complex, multi-branch architecture during training and mathematically collapsing it into a streamlined single-branch structure for deployment, SRP offers "free" accuracy gains. However, existing SRP methods have predominantly focused on convolutional (CONV) layers, leaving fully connected (FC) layers—which are critical in modern Transformers and mobile-optimized CNNs—largely unaddressed.
RepFC introduces a universal SRP block designed specifically for dense layers. By expanding FC layers into parallel branches during training and squeezing them back for inference, RepFC achieves significant accuracy improvements across a wide range of architectures with zero additional overhead at runtime.
Methodology
The core of the proposed approach is the Reparametrizable Fully Connected (RepFC) block. It leverages the additivity and homogeneity of linear layers to fuse multiple parallel operations into a single weight matrix.
Key technical innovations include:
- Feature Masking: Unlike traditional SRP that replicates inputs, RepFC splits the input feature vector into subsets. Different branches process different parts of the data, forcing the model to learn more diverse and robust feature representations.
- Multi-Branch Variants: The authors propose RepFC-III (3 branches) and RepFC-V (5 branches) to provide flexibility between training complexity and performance gains.
- Stabilization (BN vs. Scaling): Branches are stabilized using either Batch Normalization (BN) or learnable scaling factors. Scaling factors are particularly effective for Transformers, where standard BN can conflict with Layer Normalization.
- Online RepFC: To mitigate the increased training time associated with multi-branch networks, an "Online" variant dynamically merges branch weights during the forward pass, significantly reducing computational overhead.
Experimental Evaluation
RepFC was rigorously tested on CIFAR-100 and ImageNet-1K across diverse architectures, including classic CNNs (AlexNet, VGG-16), mobile-friendly models (MobileNet-V3, EfficientNet-B0), and modern Transformers (Swin-tiny, FastViT).
The results demonstrate consistent, "free" performance gains:
- AlexNet: Accuracy improved by 1.46 p.p. on ImageNet-1K.
- EfficientNet-B0: Saw a 1.14 p.p. boost.
- FastViT-T8: This hybrid Transformer achieved a 0.75 p.p. improvement.
- Finetuning: When applied to pre-trained models, RepFC outperformed standard finetuning by up to 1.33 p.p.
Key Insights
A significant finding is that focusing SRP on FC layers can be more effective than expanding every convolutional layer. In AlexNet, where FC layers comprise 95% of parameters, applying RepFC only to the classification head yielded superior results compared to whole-network CONV expansion. Furthermore, RepFC is orthogonal to existing CONV-based SRP methods; combining them leads to even higher performance.
Another remarkable discovery is the enhanced pruning resilience of RepFC-trained models.
As shown in the figure above, models trained with RepFC maintain significantly higher accuracy even when the pruning percentage of the FC layer approaches 100%. This suggests that RepFC encourages the model to learn more essential and redundant features, making it ideal for extremely lightweight deployment scenarios.
Conclusion and Future Work
RepFC successfully extends the benefits of Structural Reparameterization to dense layers, providing a plug-and-play solution for both CNNs and Transformers. While it introduces some training-time complexity, the "Online" variant effectively manages this overhead. Future research may explore more sophisticated branch output processing and extend the application of RepFC to other domains like Natural Language Processing (NLP), where dense layers are ubiquitous.
Summary updated