Skip to content

dump: v0.2.0#1

Merged
amyssnippet merged 8 commits into
masterfrom
feat/add-math-primitives
Feb 8, 2026
Merged

dump: v0.2.0#1
amyssnippet merged 8 commits into
masterfrom
feat/add-math-primitives

Conversation

@amyssnippet

Copy link
Copy Markdown
Member

rewrote differential privacy from google to rust

Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
Copilot AI review requested due to automatic review settings February 8, 2026 11:22
@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Rust-backed differential privacy accounting core (PyO3) and expands the Python API surface to mirror Google’s dp_accounting, including RDP primitives/accountants, Gaussian mechanism calibration, and PLD composition.

Changes:

  • Added Rust implementations for Gaussian mechanism calibration and a PLD engine (FFT-based) plus new RDP primitives/conversions exposed via _core.
  • Added Python modules for DpEvent algebra, privacy accountant base classes, RDP/PLD accountants, and mechanism calibration utilities.
  • Added extensive tests/benchmarks and updated docs + CI configuration.

Reviewed changes

Copilot reviewed 27 out of 29 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
tests/test_all_mechanisms.py Adds mechanism accuracy cross-validation vs dp_accounting plus speed benchmark tests.
tests/smoke_test.py Adds an import-and-basic-usage smoke check (currently runs at import time).
src/pld.rs New Rust PLD engine with discretization + FFT-based composition and ε/δ queries.
src/math.rs Switches special functions to libm and adds stability helpers (abs_sinpi, log_erfc).
src/lib.rs Exposes new PyO3 functions/classes (Gaussian calibration, RDP primitives, PLD PMF).
src/gaussian.rs Implements analytical Gaussian calibration (Balle & Wang) with bisection root-finding.
src/accounting.rs Adds WOR Gaussian RDP, Laplace RDP, and RDP→δ conversion helpers; tweaks constants.
python/dp_accelerator/rdp.py Adds RDP primitives, conversions, and an RdpAccountant compatible API.
python/dp_accelerator/privacy_accountant.py Adds PrivacyAccountant base + NeighboringRelation enum and compose/ledger logic.
python/dp_accelerator/pld/privacy_loss_distribution.py Adds high-level PLD wrapper and multiple factory methods (some SciPy-based).
python/dp_accelerator/pld/pld_privacy_accountant.py Adds PLDAccountant that composes DpEvents into PLDs.
python/dp_accelerator/pld/pld_pmf.py Adds Dense/Sparse PLD PMF wrappers delegating heavy ops to Rust.
python/dp_accelerator/pld/__init__.py Exposes PLD public API.
python/dp_accelerator/mechanism_calibration.py Adds DP mechanism calibration search (SciPy brentq optional, bisection fallback).
python/dp_accelerator/gaussian_mechanism.py Python API for Gaussian calibration delegating to Rust.
python/dp_accelerator/dp_event_builder.py Adds event builder/ledger for composed DpEvents.
python/dp_accelerator/dp_event.py Adds DpEvent class hierarchy matching dp_accounting.
python/dp_accelerator/_core.pyi Updates typing stubs for new Rust-exposed functions.
python/dp_accelerator/__init__.py Re-exports many new APIs at package root; keeps __version__.
benchmark_pld.py Adds PLD benchmark script vs Google implementation.
benchmark_accuracy_speed.py Adds large benchmark suite comparing accuracy + speed vs dp_accounting.
README.md Updates documentation to describe new features, APIs, and architecture.
Cargo.toml Adds Rust deps (rustfft, libm) for PLD and special functions.
Cargo.lock Locks new Rust dependency graph.
.gitignore Ignores differential-privacy/ directory.
.github/workflows/codeql.yml Adds CodeQL workflow (currently invalid YAML indentation).
.github/workflows/check-signatures.yml Adds workflow enforcing signed commits.
.github/workflows/CI.yml Tightens pytest invocation to pytest tests/ -v.
.cargo/config.toml Adds macOS linker flags for dynamic lookup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/codeql.yml
Comment thread .github/workflows/check-signatures.yml Outdated
Comment thread src/lib.rs
Comment thread python/dp_accelerator/pld/privacy_loss_distribution.py
Comment thread python/dp_accelerator/rdp.py
Comment thread python/dp_accelerator/dp_event_builder.py
Comment thread tests/test_all_mechanisms.py
Comment thread tests/smoke_test.py
Comment thread python/dp_accelerator/pld/privacy_loss_distribution.py
Comment thread python/dp_accelerator/rdp.py Outdated
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
Copilot AI review requested due to automatic review settings February 8, 2026 11:30
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
@amyssnippet amyssnippet force-pushed the feat/add-math-primitives branch from f0f96a6 to 839176e Compare February 8, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 29 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/dp_accelerator/rdp.py
Comment thread tests/test_all_mechanisms.py
Comment thread tests/test_all_mechanisms.py
Comment thread python/dp_accelerator/pld/privacy_loss_distribution.py
Comment thread src/lib.rs
Comment thread python/dp_accelerator/rdp.py
@amyssnippet amyssnippet self-assigned this Feb 8, 2026
@amyssnippet amyssnippet enabled auto-merge February 8, 2026 11:40
@amyssnippet amyssnippet disabled auto-merge February 8, 2026 11:41
@amyssnippet amyssnippet merged commit ddca84d into master Feb 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants