OpenDP's discrete Laplace sampler shows periodic artifacts, fixed by exact rational implementation
OpenDP's discrete Laplace sampler contains systematic periodic distortions due to a faulty rational arithmetic component, and their exact-rational replacement eliminates these artifacts
Security & privacy arXiv 1 Oct 2026 Measurement Prototype evidence
Published as “Detection and Resolution of Periodic Artifacts in OpenDP's Discrete Laplace Sampler”
Why it matters
Fixing the bug restores both statistical correctness of the noise sampler and the intended differential-privacy guarantees, which is critical for any deployment relying on OpenDP.
Summary
The authors discovered periodic artifacts in OpenDP’s discrete Laplace sampler caused by a bug in the bernoulli_exp1 primitive’s rational arithmetic, which bias the noise distribution and violate ε-DP guarantees. Using 1,000,000 samples they showed the faulty implementation fails χ2 tests (e.g., χ2 = 128, p ≈ 0) and produces a discrete Laplace distribution with χ2 = 2.1×10^3, p = 0. They fixed the bug by either patching the dashu library or replacing bernoulli_exp1 with an exact Taylor-series sampler, after which all components pass goodness-of-fit tests (e.g., χ2 = 275.4, p = 0.499) and the privacy-loss random variable stays within the theoretical bounds. The evidence is strong, based on large-scale empirical testing and statistical validation.
What they found 2
- The original bernoulli_exp1 primitive fails statistical tests with extreme deviation.
“The bernoulli_exp1 function returns z = 11.30 with p ≈0 and χ2 = 127.7.”
- After fixing the primitive, the discrete Laplace sampler matches the theoretical distribution.
“The distribution passes the χ2 goodness-of-fit test with χ2 = 275.4 on 276 degrees of freedom (p = 0.499), indicating excellent agreement with the theoretical model.”
Caveats 4
- Even after correction, the Bernoulli(exp(-x)) sampler shows a modest χ2 = 3.22 with p = 0.073, indicating residual statistical fluctuation.
- The Taylor-series implementation is 15.7% slower than the fixed implementation, showing a performance trade-off.
- We present this as a conjecture based on the empirical evidence above, not as a rigorous PLRV analysis.
- Turning the qualitative observation that the bound is violated into a quantitative statement about the effective privacy violation would require a dedicated privacy-loss accounting analysis, which we do not attempt here.
What’s new here 4
- Systematic top-down diagnostic methodology to isolate sampling bugs in hierarchical DP implementations.
- Identification of a specific rational-arithmetic bug in the dashu library affecting bernoulli_exp1.
- Alternative exact Taylor-series implementation for Bernoulli(exp(-x)) that eliminates artifacts.
- Empirical demonstration that the artifacts can cause measurable violations of ε-DP guarantees.