NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CrypTFlow2: Practical 2-Party Secure Inference

Deevashwer Rathee, Mayank Rathee, Nishant Kumar, Nishanth Chandran, Divya Gupta, Aseem Rastogi, Rahul Sharma

Introduction

Secure 2-party computation (2PC) is a critical technology for privacy-preserving machine learning, allowing a server to provide inference services without seeing the client's private data, and vice versa. Despite its potential, scaling 2PC to realistic deep neural networks (DNNs) has been hindered by two major hurdles: the high cost of non-linear activations like ReLU and the accuracy degradation caused by approximate fixed-point arithmetic.

CrypTFlow2 addresses these challenges by introducing a cryptographic framework that enables secure DNN inference at the scale of ImageNet. By providing bitwise equivalence to cleartext execution, it ensures model accuracy is preserved while achieving significant performance gains over previous state-of-the-art methods.

Technical Innovations

CrypTFlow2 introduces a system architecture called SCI (Secure and Correct Inference), which relies on several novel cryptographic building blocks.

Optimized Millionaires' Protocol

The "Millionaires' problem"—determining which of two numbers is larger without revealing the values—is fundamental to secure comparison. CrypTFlow2 utilizes a new recursive tree-based protocol leveraging 1-out-of-$2^m$ Oblivious Transfer (OT). This approach significantly reduces communication overhead compared to traditional Garbled Circuits (GC) and other prior protocols.

Comparison of communication and rounds for Millionaires' protocols.

Efficient ReLU and DReLU Protocols

Building on the improved comparison protocol, the authors developed a more efficient method for computing the Derivative of ReLU (DReLU), which indicates the sign of a value. This DReLU protocol is then used to construct the full ReLU activation and Maxpool layers. These protocols are designed to be both communication-efficient and computationally fast, addressing the primary bottleneck in secure DNN execution.

Performance comparison of ReLU protocols across different rings.

Faithful Division and Truncation

A major issue in prior 2PC frameworks is "drift"—the accumulation of errors due to approximate division and truncation in fixed-point math. CrypTFlow2 introduces a mathematical theorem that decomposes division into local operations and a small set of "correction terms" handled via secure comparison. This ensures the 2PC result is bitwise identical to cleartext execution, maintaining the model's original accuracy.

Dual Backends: SCI_OT and SCI_HE

To handle different network conditions, the system supports two backends:

  • SCI_OT: Uses Oblivious Transfer for linear layers, optimized for low-latency LAN environments where computation is the primary bottleneck.
  • SCI_HE: Uses Homomorphic Encryption, which is more communication-efficient and better suited for high-latency WAN (internet) connections.

Evaluation and Results

CrypTFlow2 was evaluated on standard benchmarks including MNIST, CIFAR-10, and CIFAR-100, with a specific focus on scaling to ImageNet.

  • Scale: It is the first system to successfully run ImageNet-scale models like ResNet50 and DenseNet121 in a 2PC setting. ResNet50 inference can be completed in under a minute over a LAN.
  • Speed: Non-linear layers, such as ReLUs, are evaluated 20x–30x faster than in Delphi, the previous state-of-the-art. On SqueezeNet, total runtime dropped from 4.5 minutes to just 33 seconds.
  • Communication: The framework requires an order of magnitude less communication than standard Garbled Circuit-based approaches.

Conclusion

CrypTFlow2 demonstrates that secure, large-scale DNN inference is practical. By prioritizing mathematical correctness and optimizing the core comparison protocols, the authors have removed the primary bottlenecks of ReLU evaluation and fixed-point drift. While currently focused on semi-honest security and inference tasks, CrypTFlow2 sets a new standard for performance and accuracy in private machine learning.

Summary updated

BibTeX
@inproceedings{rathee2020cryptflow,
  author = {Deevashwer Rathee and Mayank Rathee and Nishant Kumar and Nishanth Chandran and Divya Gupta and Aseem Rastogi and Rahul Sharma},
  title = {{CrypTFlow2: Practical 2-Party Secure Inference}},
  booktitle = {CCS},
  year = {2020},
  doi = {10.1145/3372297.3417274},
}
Figure