XONN: XNOR-based Oblivious Deep Neural Network Inference

M. Sadegh Riazi, Mohammad Samragh, Hao Chen, Kim Laine, Kristin E. Lauter, Farinaz Koushanfar

Introduction

As Deep Learning (DL) services migrate to the cloud, a significant "privacy vs. utility" deadlock has emerged. Clients require powerful AI models but are hesitant to share sensitive raw data, such as medical records. Conversely, service providers seek to protect their proprietary models. "Oblivious inference" offers a cryptographic solution, allowing a server to perform inference on a client's private data without either party revealing their secrets. However, traditional methods have been too slow or communication-intensive for practical use.

The Challenge of Oblivious Inference

Existing secure computation frameworks, such as Homomorphic Encryption (HE) and Yao’s Garbled Circuits (GC), face scalability issues. Matrix multiplication—the fundamental operation of DL—is quadratically expensive in GC. Furthermore, hybrid protocols often require a communication round for every network layer, leading to prohibitive latency on standard internet connections.

Methodology: Hardware-Software Co-Design

XONN addresses these bottlenecks through a hardware-software co-design approach, tailoring the neural network architecture to the strengths of the cryptographic protocol.

Binary Neural Networks and Garbled Circuits

The core innovation of XONN is the use of Binary Neural Networks (BNNs), where weights and activations are restricted to $\pm1$. In the context of Garbled Circuits, this is transformative. The Free-XOR optimization allows XNOR operations to be computed with virtually zero cost in terms of computation and communication.

Comparison of standard dot product vs. BNN-optimized XNOR and PopCount operations.

As shown in the figure above, the standard multiplication and summation are replaced by bitwise XNOR and a population count (PopCount). This alignment between the ML model and the cryptographic primitive drastically reduces the overhead of secure inference.

Accuracy Preservation: Scaling and Trimming

To mitigate the accuracy loss often associated with binarization, XONN employs a two-step process:

  1. Linear Scaling: The number of neurons per layer is increased (e.g., by a factor $s=2$ or $3$) to enhance the model's representational capacity.
  2. Network Trimming: A novel algorithm identifies and removes redundant neurons, minimizing the GC runtime while maintaining target accuracy.
The scaling and pruning process used to recover accuracy in BNNs.

Specialized Protocols and Engines

Because the initial input layer typically involves non-binary data, XONN introduces Oblivious Conditional Addition (OCA). This specialized protocol, based on Oblivious Transfer, is 6x faster than standard GC for the first layer. Additionally, a pipelined C++ engine manages memory dynamically, enabling the framework to support much deeper networks than previously possible.

Evaluation and Results

XONN was evaluated on standard vision benchmarks (MNIST, CIFAR-10) and four medical diagnosis datasets.

Performance and Scalability

XONN demonstrates massive speedups over prior state-of-the-art methods:

  • Speedup: Up to 7x faster than Gazelle, 37x faster than SecureML, and 93x faster than MiniONN.
  • Latency: MNIST inference is completed in ~0.15 seconds, while CIFAR-10 takes approximately 5.79 seconds.
  • Depth: XONN is the first framework to successfully perform oblivious inference on a 21-layer network, whereas previous methods struggled beyond 10 layers due to communication overhead.

Constant Round Complexity

By relying primarily on GC after the first layer, XONN maintains constant communication rounds regardless of network depth. This makes it uniquely suited for real-world "Internet-setting" deployments where high latency is a factor.

Conclusion

XONN proves that privacy-preserving deep learning is practical when models are trained to be "GC-friendly." By leveraging the synergy between BNNs and Garbled Circuits, XONN achieves unprecedented scalability and speed, paving the way for secure AI in sensitive domains like healthcare. While BNNs still face an accuracy gap on extremely complex datasets like ImageNet, the framework's ability to handle deep architectures marks a significant milestone in oblivious inference.

Summary updated

BibTeX
@inproceedings{riazi2019xonn,
  author = {M. Sadegh Riazi and Mohammad Samragh and Hao Chen and Kim Laine and Kristin E. Lauter and Farinaz Koushanfar},
  title = {{XONN: XNOR-based Oblivious Deep Neural Network Inference}},
  booktitle = {USENIX Security},
  year = {2019},
  url = {https://openreview.net/forum?id=ZNN9SIpSwv},
}
Figure