Crypto-Oriented Neural Architecture Design

Avital Shafran, Gil Segev, Shmuel Peleg, Yedid HoshenOpenReview 2019 · DOI

Crypto-Oriented Neural Architecture Design

Abstract

As neural networks revolutionize many applications, significant privacy conflicts between model users and providers emerge. The cryptography community developed a variety of techniques for secure computation to address such privacy issues. As generic techniques for secure computation are typically prohibitively ineffective, many efforts focus on optimizing their underlying cryptographic tools. Differently, we propose to optimize the initial design of crypto-oriented neural architectures and provide a novel Partial Activation layer. The proposed layer is much faster for secure computation. Evaluating our method on three state-of-the-art architectures (SqueezeNet, ShuffleNetV2, and MobileNetV2) demonstrates significant improvement to the efficiency of secure inference on common evaluation metrics.

The Privacy Deadlock in Deep Learning

Deep learning often creates a "privacy deadlock" between data owners and model providers. For instance, a hospital possessing sensitive patient MRI scans cannot share them with a tech company owning a proprietary diagnostic model due to strict privacy regulations. Conversely, the company is reluctant to share its model to protect intellectual property.

Secure Multi-Party Computation (MPC) and Homomorphic Encryption (HE) provide a path forward by enabling models to run on encrypted data. However, a massive performance gap exists. In standard computing, non-linear operations like ReLU (Rectified Linear Unit) or Max Pooling are computationally inexpensive. In secure computation, these operations become the primary bottleneck, requiring extensive communication rounds and high bandwidth. While most research focuses on optimizing cryptographic protocols, this work asks: "Can we make the neural networks themselves more crypto-friendly?"

Methods: Designing for Cryptography

The proposed crypto-oriented design philosophy centers on three main strategies to minimize expensive non-linearities:

  1. Partial Activation Layers: Instead of applying a non-linear activation to every channel in a layer, the channels are split into two branches. One branch receives the activation, while the other remains linear. The branches are then concatenated. This significantly reduces the number of expensive cryptographic protocols triggered per layer.
Architecture of the proposed Partial Activation layer.
  1. Activation Removal: Empirical testing revealed that many activation layers in modern architectures like MobileNetV2 or SqueezeNet can be removed entirely with negligible impact on accuracy. In a crypto-oriented context, a 0%-partial activation represents a substantial efficiency gain.
  2. Alternative Non-Linearities:
    • Average Pooling: Replacing Max Pooling (which requires complex secure comparisons) with Average Pooling allows for local computation in many MPC protocols, eliminating network communication for these layers.
  3. Standard ReLU: Replacing ReLU6 with standard ReLU. Since ReLU6 involves two comparisons (min and max), it is twice as expensive as a standard ReLU in a secure environment.

Key Insights: The "Cost Flip"

A central realization of this work is that standard efficiency metrics, such as FLOPs, are often irrelevant for secure inference. In the cryptographic domain, the number and type of non-linearities dictate latency and communication costs.

Comparison of runtime for original vs. no-activation models in (a) non-secure and (b) secure computation environments.

As shown in Figure 1, removing activations has a disproportionate impact on secure runtime compared to standard runtime. In the secure case (b), removing activations leads to a dramatic reduction in runtime (over 60%), whereas in the non-secure case (a), the difference is negligible (around 10%). This "Cost Flip" underscores why architecture design is a high-leverage tool for private AI. Furthermore, the success of Partial Activation suggests that modern networks are "over-activated," and a mix of linear and non-linear paths is sufficient for learning complex features.

Experimental Results

The researchers evaluated these methods on standard benchmarks including CIFAR-10, CIFAR-100, MNIST, and Fashion-MNIST. To provide fair baselines, popular architectures were downscaled for these datasets.

  • MobileNetV2 (CIFAR-10): Achieved a 79% reduction in communication complexity and a 63% reduction in communication rounds. Runtime dropped from 41 seconds to 17 seconds per secure inference, with accuracy only decreasing from 94.49% to 93.44%.
  • SqueezeNet: Communication was reduced by approximately 54%, and runtime improved by 38% on CIFAR datasets.

Across all models, aligning the architecture with the underlying physics of cryptographic protocols—where linear operations are essentially "free"—yielded massive performance improvements.

Limitations and Future Directions

While the results on CIFAR are promising, future work should explore whether these crypto-oriented designs scale to ImageNet-level tasks. Additionally, the 50% split for partial activations was a heuristic; employing Neural Architecture Search (NAS) specifically tuned for cryptographic cost functions could discover more optimal, per-layer ratios. Finally, while the general principles apply broadly, the optimal architecture may vary depending on the specific cryptographic primitives used, such as Functional Encryption versus specific MPC protocols.

Summary updated

BibTeX
@misc{shafran2019crypto,
  author = {Avital Shafran and Gil Segev and Shmuel Peleg and Yedid Hoshen},
  title = {{Crypto-Oriented Neural Architecture Design}},
  year = {2019},
  eprint = {1911.12322},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.12322},
  howpublished = {OpenReview},
}
Figure