Testing Differential Privacy with Dual Interpreters

Hengchu Zhang, Edo Roth, Andreas Haeberlen, Benjamin C. Pierce, Aaron Roth

Abstract

Differential Privacy (DP) provides a rigorous mathematical framework for data privacy, but its implementation is notoriously error-prone. We present DPCheck, a framework designed to automatically verify whether a program satisfies DP requirements. By combining concrete instrumented execution with symbolic execution, DPCheck "synthesizes" privacy proofs for specific program runs. This approach allows it to distinguish between correct and buggy implementations of complex algorithms, including those with probabilistic termination like PrivTree, without requiring manual annotations from the programmer.

Introduction

Implementing Differential Privacy is a significant challenge even for experts. The mathematical proofs required to ensure an algorithm does not leak sensitive information are subtle, and small implementation errors can lead to catastrophic privacy failures. Existing verification methods generally fall into two categories: formal verification, which requires heavy manual effort and struggles with complex control flow, and statistical testing, which often requires massive sample sizes and can miss edge-case bugs.

DPCheck addresses this gap by focusing on algorithms like PrivTree, which involve loops with unpredictable iteration counts (probabilistic termination). Such algorithms are typically invisible to existing automated verification tools.

Methodology: The Dual Interpreter Strategy

The core innovation of DPCheck is its Dual Interpreter strategy, which adapts formal "pointwise" proof logic into a practical testing workflow.

Instrumented and Symbolic Execution

The framework operates in two main phases:

  1. Instrumented Interpreter: The program is executed on a sensitive dataset ($x_1$) thousands of times. The tool records every random sample (e.g., from a Laplace distribution) and groups these "traces" into buckets based on the final output.
  2. Symbolic Interpreter: The program is then run on a "neighboring" dataset ($x_2$) symbolically. Variables represent the random noise instead of concrete numbers.
Empirical distribution of program outputs grouped into buckets during instrumented execution.

SMT Coupling and Proof Synthesis

For every bucket of real outputs, DPCheck utilizes an SMT solver (Z3) to determine if a "coupling" exists. It asks whether the random noise from the $x_1$ runs can be "shifted" such that the $x_2$ run produces the exact same output while maintaining the total privacy cost ($\epsilon$) within the specified limit.

By using concrete traces to guide the symbolic interpreter, DPCheck avoids state explosion, exploring only the paths actually taken during testing. This "local proof synthesis" provides high statistical confidence in the program's privacy without requiring a global proof for all possible inputs.

Evaluation and Results

DPCheck was evaluated against a benchmark suite of 10 classic DP algorithms (e.g., NoisyMax, Sparse Vector, SmartSum) and their buggy variants.

Key Findings

  • Bug Detection: DPCheck successfully identified bugs in all 10 benchmark algorithms, typically in under 10 seconds.
  • PrivTree Success: It is the first tool to automatically distinguish between a correct PrivTree implementation and a buggy version lacking a depth bound.
  • Real-World Validation: The tool was used to validate the core privacy mechanism of the 2020 US Census Disclosure Avoidance System (DAS). During this process, it detected minute privacy leaks ($10^{-11}$) caused by floating-point rounding errors.

Conclusion

DPCheck represents a significant advancement in the automated testing of differentially private systems. By bridging the gap between formal proof and statistical testing, it provides a scalable way to verify complex, real-world privacy mechanisms. Future work will focus on scaling the SMT solving process and hardening implementations against floating-point vulnerabilities.

Summary updated

BibTeX
@article{zhang2020testing,
  author = {Hengchu Zhang and Edo Roth and Andreas Haeberlen and Benjamin C. Pierce and Aaron Roth},
  title = {{Testing Differential Privacy with Dual Interpreters}},
  journal = {Proc. ACM Program. Lang.},
  year = {2020},
  doi = {10.1145/3428233},
}
Figure