Proving Differential Privacy with Shadow Execution

Yuxin Wang, Zeyu Ding, Guanhong Wang, Daniel Kifer, Danfeng Zhang · DOI

Abstract

Recent work on formal verification of differential privacy shows a trend toward usability and expressiveness—generating a correctness proof of sophisticated algorithms while minimizing the annotation burden on programmers. Sometimes, combining those two requires substantial changes to program logics: one recent paper is able to verify Report Noisy Max automatically, but it involves a complex verification system using customized program logics and verifiers. In this paper, we propose a new proof technique, called shadow execution, and embed it into a language called ShadowDP. ShadowDP uses shadow execution to generate proofs of differential privacy with very few programmer annotations and without relying on customized logics and verifiers. In addition to verifying Report Noisy Max, we show that it can verify a new variant of Sparse Vector that reports the gap between some noisy query answers and the noisy threshold. Moreover, ShadowDP reduces the complexity of verification: for all of the algorithms we have evaluated, type checking and verification in total takes at most 3 seconds, while prior work takes minutes on the same algorithms.

Introduction

Differential privacy (DP) has become the gold standard for releasing statistical information while protecting individual privacy. However, implementing DP algorithms is notoriously error-prone; even minor implementation bugs can lead to significant privacy leaks. Consequently, formal verification—mathematically proving that an algorithm satisfies DP—is critical.

Historically, verification tools have faced a strict trade-off between usability and expressiveness. Tools based on "randomness alignment" (such as LightDP) are efficient and require few annotations but fail on complex algorithms where control flow depends on random noise. Conversely, tools based on "approximate coupling" can handle these complex algorithms but rely on bespoke, heavy-duty probabilistic logics that are slow to execute and cannot leverage standard software verification infrastructure. This paper introduces ShadowDP, a system that bridges this gap by transforming probabilistic verification into a standard safety verification problem.

The Shadow Execution Technique

The core innovation of ShadowDP is a novel proof technique called shadow execution. To prove differential privacy, one must compare two executions of a program on "adjacent" databases (databases differing by only one record).

  1. Randomness Alignment: Traditional alignment-based proofs attempt to mathematically "shift" the random noise injected into the second execution so that its output matches the first, calculating the privacy cost of that shift. This fails when the program's future behavior depends on the specific noise generated.
  2. Shadow Execution: ShadowDP solves this by simultaneously tracking a shadow execution—a hypothetical run on the adjacent database that uses the exact same noise as the original run.
  3. Selective Alignment: When the program samples random noise, ShadowDP allows the proof to dynamically choose between using "aligned" noise (which incurs a privacy cost) or switching to "shadow" noise (which incurs no cost), depending on the program's current state. This flexibility allows the system to handle algorithms like Report Noisy Max that were previously out of reach for alignment-based tools.

System Architecture and Workflow

ShadowDP operates through a multi-stage pipeline designed to outsource the heavy lifting of verification to highly optimized, off-the-shelf tools:

  • Flow-Sensitive Type System: ShadowDP uses a specialized type system to automatically track the mathematical "distance" between variables across the different executions.
  • Program Transformation: The probabilistic ShadowDP program is compiled into a standard, non-probabilistic C program. During this transformation, random sampling is replaced with non-deterministic assignments (havoc), and the privacy cost is explicitly tracked in a dedicated variable, v_epsilon.
  • Standard Verification: Because the output is standard C code, the system can use off-the-shelf verifiers like CPAChecker. If the verifier can prove that v_epsilon ≤ ε at the end of the transformed program, the original algorithm is guaranteed to be ε-differentially private.

Evaluation and Key Results

The authors evaluated ShadowDP on a benchmark suite of standard DP algorithms, including Report Noisy Max, various versions of the Sparse Vector Technique (SVT), and Prefix Sum.

Performance

ShadowDP demonstrates a massive performance advantage over prior coupling-based verifiers. For all tested algorithms, the total time for type checking and verification was under 3 seconds. In contrast, state-of-the-art tools using complex probabilistic logics took up to 580 seconds to verify the same Sparse Vector algorithms.

Expressiveness

ShadowDP successfully verified Report Noisy Max, an algorithm that requires tracking complex dependencies between noise and control flow. Furthermore, the authors used ShadowDP to verify a novel variant of SVT called Gap Sparse Vector. This variant releases the actual numerical gap between a noisy query and a noisy threshold, rather than just a boolean indicator, providing more utility while maintaining rigorous privacy guarantees.

Limitations and Future Work

While ShadowDP represents a significant step forward, it currently has limitations. Off-the-shelf verifiers sometimes struggle with non-linear arithmetic, occasionally requiring programmers to provide manual loop invariants or fix ε to a constant value. Additionally, the current implementation focuses on the Laplace mechanism and does not yet support the Exponential mechanism.

Future work aims to fully automate annotation generation, expand support for diverse noise distributions, and leverage the transformed non-probabilistic programs for bug-finding via symbolic execution.

Summary updated

BibTeX
@inproceedings{wang2019proving,
  author = {Yuxin Wang and Zeyu Ding and Guanhong Wang and Daniel Kifer and Danfeng Zhang},
  title = {{Proving Differential Privacy with Shadow Execution}},
  booktitle = {PLDI},
  year = {2019},
  doi = {10.1145/3314221.3314619},
}
Figure