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

SafetyNets: Verifiable Execution of Deep Neural Networks on an Untrusted Cloud

Zahra Ghodsi, Tianyu Gu, Siddharth Garg

Abstract

As deep learning models are increasingly deployed via Machine Learning as a Service (MLaaS), the integrity of outsourced computations remains a critical concern. This paper presents SafetyNets, a framework designed to provide verifiable execution of deep neural networks (DNNs) on untrusted cloud infrastructure. By representing DNNs as arithmetic circuits and utilizing an interactive proof protocol based on the Sum-Check technique, SafetyNets allows a client to verify the correctness of inference results with significantly less computational effort than performing the inference locally. Our evaluation demonstrates that SafetyNets achieves verification speedups of 8x to 82x while maintaining high accuracy on standard benchmarks.

1. Introduction

The rise of complex deep learning models has led many users and organizations to outsource inference tasks to specialized cloud providers. However, this reliance on third-party infrastructure introduces a "trust gap." A cloud provider might behave "lazily" by using a simplified, less accurate model to reduce operational costs, or "maliciously" by intentionally misclassifying specific inputs to subvert system security.

While cryptographic techniques like homomorphic encryption address data privacy, ensuring the integrity of the computation—proving that the cloud actually performed the specified mathematical operations—is a distinct challenge. Traditional Verifiable Computing (VC) methods often suffer from prohibitive overhead, where the cost of generating a proof exceeds the cost of the original computation. SafetyNets addresses this by optimizing interactive proofs specifically for the structure of neural networks.

2. Methodology

SafetyNets treats a neural network as an arithmetic circuit—a sequence of additions and multiplications performed over a finite field (integers modulo a large prime $p$).

2.1 The Interactive Proof Protocol

The system employs a protocol where a client (the verifier) and the cloud (the prover) engage in a multi-round exchange:

  1. Inference: The client sends a batch of inputs to the cloud, which returns the classification results.
  2. Challenge-Response: The parties engage in a Sum-Check protocol. The client issues random mathematical challenges, and the cloud provides responses based on its internal layer-by-layer computations.
  3. Verification: The client verifies the consistency of these responses. If the cloud attempted to cheat at any layer, the mathematical properties of the protocol ensure that the inconsistency will be detected with extremely high probability.

2.2 Architectural Optimizations

To make DNNs compatible with efficient interactive proofs, SafetyNets introduces several key innovations:

  • Quadratic Activations: Standard non-polynomial activations like ReLU or Sigmoid are difficult to represent in arithmetic circuits. SafetyNets utilizes quadratic activations ($f(x) = x^2$), which are mathematically efficient for proofs and serve as universal approximators.
  • Quantization: Since the protocol operates on finite fields, floating-point weights and activations are scaled and rounded into integers. This quantization process is carefully managed to preserve model precision.
  • Efficient Arithmetic: By using Mersenne primes (e.g., $2^{61}-1$), SafetyNets leverages optimized modular arithmetic, keeping the prover's overhead below 5%.

3. Experimental Evaluation

The framework was evaluated using three datasets: MNIST (handwritten digits), MNIST-Back-Rand (digits with random backgrounds), and TIMIT (speech recognition).

3.1 Performance Metrics

The results indicate that SafetyNets is highly practical for real-world MLaaS applications:

  • Verification Efficiency: For the client, verifying the proof is 8x to 82x faster than executing the model locally. This provides a clear incentive for outsourcing.
  • Prover Overhead: The cloud provider incurs only a modest 5% increase in computation time to generate the proof compared to standard, unverified execution.
  • Communication Bandwidth: The protocol is extremely lightweight. A proof for a batch of 2048 images requires less than 8 KB of data exchange—smaller than a single low-resolution image.

3.2 Accuracy

Despite the constraints imposed by quadratic activations and quantization, SafetyNets maintains competitive accuracy. It achieved 99.4% on MNIST and 75.22% on the TIMIT phoneme classification task, demonstrating that the requirements for verifiability do not necessitate a significant sacrifice in model performance.

4. Discussion and Limitations

SafetyNets demonstrates that integrity in cloud inference is significantly cheaper to achieve than privacy. However, certain limitations remain. The current framework does not support Max-Pooling or non-polynomial activations like ReLU. Additionally, very deep networks may face challenges with "exploding" values due to the $x^2$ activation, requiring specialized training techniques like gradient clipping. Furthermore, while SafetyNets ensures the cloud is honest, it does not provide data privacy; combining these two properties remains a primary direction for future research.

5. Conclusion

SafetyNets provides a robust solution for the verifiable execution of DNNs. By bridging the gap between theoretical verifiable computing and practical deep learning requirements, it enables a future where MLaaS can be both efficient and mathematically trustworthy.

Summary updated

BibTeX
@inproceedings{ghodsi2017safetynets,
  author = {Zahra Ghodsi and Tianyu Gu and Siddharth Garg},
  title = {{SafetyNets: Verifiable Execution of Deep Neural Networks on an Untrusted Cloud}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
}
Figure