Making Models Shallow Again: Jointly Learning to Reduce Non-Linearity and Depth for Latency-Efficient Private Inference

Souvik Kundu, Yuke Zhang, Dake Chen, Peter A. Beerel

Introduction

Machine Learning as a Service (MLaaS) has become a cornerstone of modern AI deployment, yet it introduces significant privacy concerns when sensitive client data is processed on remote servers. Private Inference (PI) addresses this by utilizing cryptographic protocols—such as Homomorphic Encryption (HE) and Secure Multi-Party Computation (MPC)—to allow servers to execute models on encrypted data. However, the computational overhead of these protocols is immense.

While previous research has focused almost exclusively on reducing the number of ReLU (Rectified Linear Unit) operations, this paper argues that such an approach is insufficient. As non-linearities are removed, the latency of linear layers (MAC operations) and the overall depth of the network become the new primary bottlenecks. This work introduces a novel optimization framework designed to jointly reduce both non-linearity and model depth, effectively "making models shallow again" for maximum PI efficiency.

The Bottleneck in Private Inference

In standard plaintext inference, convolutional layers (MACs) account for the majority of the latency. In the encrypted domain of PI, the situation is reversed: non-linear activations like ReLUs are orders of magnitude more expensive than linear operations. Consequently, state-of-the-art PI research has prioritized "ReLU-sparse" architectures.

However, the authors identify a "diminishing returns" phenomenon. Once the ReLU count is significantly reduced, the remaining linear layers—which were previously a negligible fraction of the PI cost—begin to dominate the total execution time. To achieve true latency efficiency, a model must not only be ReLU-sparse but also structurally shallow.

Methodology: A Three-Stage Framework

The authors propose a three-stage pipeline to transform deep, non-linear networks into shallow, efficient versions without catastrophic loss in accuracy.

1. ReLU Sensitivity Analysis

Before structural changes are made, the network undergoes a sensitivity analysis to determine which layers are most critical for maintaining accuracy. The researchers observed a consistent pattern: earlier layers in deep networks are generally less sensitive to ReLU removal than deeper layers. This insight guides the subsequent "shallowing" process.

2. Gated Branching (GB)

For blocks identified as having low sensitivity, the authors replace complex, deep structures (such as ResNet basic blocks) with a single, shallow CONV-BN unit. To prevent the training instability typically associated with such drastic architectural changes, they introduce Gated Branching.

A gating parameter ($\gamma_g$) is used to create a weighted combination of the original deep branch and the new shallow branch. During training, $\gamma_g$ is adjusted to gradually shift the model's reliance from the deep branch to the shallow one. This allows for a smooth transfer of learned features, ensuring the shallow branch can eventually stand alone during inference.

3. Auxiliary Knowledge Distillation (AKD)

To address depth in the later stages of the network, the authors employ Auxiliary Knowledge Distillation. They place an Auxiliary Classifier (AC) at a strategically chosen shallow point in the architecture. Using a full-ReLU teacher model, the student network is trained to achieve high performance at this early exit point.

The optimization uses a composite loss function:

  • Cross-Entropy Loss: For standard classification.
  • KL-Divergence: To align the student's output distribution with the teacher's.
  • PRAM Loss: To minimize the feature map mismatch between the student and teacher, ensuring the shallow representation retains essential information.

Experimental Evaluation

The framework was evaluated on the CIFAR-10 and CIFAR-100 datasets using ResNet18 and Wide Residual Network (WRN-22-8) architectures. The results demonstrate a significant improvement over previous state-of-the-art methods like SENet.

  • ReLU Reduction: The method achieved up to a 19.23× reduction in ReLU operations compared to baseline models.
  • Structural Efficiency: Beyond ReLUs, the framework reduced MAC operations by up to 1.47× and total model depth by up to 1.73×.
  • Performance Trade-offs: On CIFAR-100, the authors produced a ResNet18 variant with ~26× fewer ReLUs and 1.3× fewer MACs, maintaining a competitive accuracy of 76.3% (down from a 78% baseline).

Compared specifically to SENet, the proposed method provided an additional 1.4× depth reduction and 1.27× MAC savings for the same ReLU budget, proving the efficacy of joint optimization.

Conclusion

This paper shifts the paradigm of Private Inference optimization from purely ReLU-centric to a holistic approach that considers both non-linearity and structural depth. By leveraging Gated Branching and Auxiliary Knowledge Distillation, the authors demonstrate that deep neural networks can be significantly compressed in both dimensions. This "shallowing" of models is a critical step toward making privacy-preserving machine learning practical for real-world, low-latency applications.

Summary updated

BibTeX
@inproceedings{kundu2023making,
  author = {Souvik Kundu and Yuke Zhang and Dake Chen and Peter A. Beerel},
  title = {{Making Models Shallow Again: Jointly Learning to Reduce Non-Linearity and Depth for Latency-Efficient Private Inference}},
  booktitle = {Workshops @ CVPR},
  year = {2023},
}
Figure